0

https://github.com/rayonprotocol-research/solidity-upgradable-contracts/blob/master/contracts/Proxy.sol

I'm practicing proxy pattern but i dont know how to call function at logic contract from proxy contract. I think I should use Web3. so proxy pattern is for only web3 or can I call function from ethereum Wallet??
My english is not good sorry.

0

The client you use doesn't matter when invoking the forwarded functions.

When you have an unnamed function, any calls to the contract that don't match a function selector will be handled by this function. In the link you posted, the unnamed function will proxy the calls to the target contract.

    function () public {
        address contractAddr = targetAddress;
        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize)
            let result := delegatecall(gas, contractAddr, ptr, calldatasize, 0, 0)
            let size := returndatasize
            returndatacopy(ptr, 0, size)

            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
}

(the unnamed function from the code you posted)

You should take a look at Zeppelin's Transparent Proxy, which resolves an exploit: link to PR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.