proxy contract

contract ERC20ProxyDelegator {
    constructor(ERC20Votes _token, address _delegate) {
        _token.approve(msg.sender, type(uint256).max);

Main contract function which creates the proxy contract.

    function retrieveProxyContractAddress(
        ERC20Votes _token,
        address _delegate
    ) private view returns (address) {
        bytes memory bytecode = abi.encodePacked(
            abi.encode(_token, _delegate)
        bytes32 hash = keccak256(
                uint256(0), // salt
        return address(uint160(uint256(hash)));

In the above contract creation code I have seen that the salt is not unique.If i can managed to give the same inputs all the time (_token ,_delegate) can i able to produce same address all the time?

1 Answer 1


Yes, given none of the inputs change, this function is deterministic. However, if any of the inputs (salt, creationCode, _token, _delegate) change, this will change. It should also be noted that this function is deterministic at each address it is deployed to, but would return different addresses for the same salt, creationCode, _token, and _delegate combination if it were called on two different instances (contract deployments).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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