Hello I am trying to build a proxy contract and I've seen two approaches:
1- "Specific" proxy function, where the proxy function can only call a specific function of the other contract.
Ex: (taken from this post)
contract Proxy is mortal {
address watch_addr = 0xEB1e2c19bd833b7f33F9bd0325B74802DF187935;
address user_addr = msg.sender;
function register(string _text){
Name name = Name(watch_addr);
name.register(_text);
}}
2- "Generic" proxy function, where the function can be used to call any other function of any other contracts:
contract Proxy is Owned {
event Forwarded (
address indexed destination,
uint value,
bytes data
);
function () payable{}
function forward(address destination, uint value, bytes data) onlyOwner {
if (!destination.call.value(value)(data)) {
throw;
}
Forwarded(destination, value, data);
}}
I have two questions:
1 - What are the advantages/disadvantages of the two techniques?
2 - How does one uses "Generic" proxy functions? I'm not sure how I construct the parameters value and data required to run the transaction. I'm also not sure if I need to fund the contract before (my guess is yes)