proxy contract
contract ERC20ProxyDelegator {
constructor(ERC20Votes _token, address _delegate) {
_token.approve(msg.sender, type(uint256).max);
_token.delegate(_delegate);
}
}
Main contract function which creates the proxy contract.
function retrieveProxyContractAddress(
ERC20Votes _token,
address _delegate
) private view returns (address) {
bytes memory bytecode = abi.encodePacked(
type(ERC20ProxyDelegator).creationCode,
abi.encode(_token, _delegate)
);
bytes32 hash = keccak256(
abi.encodePacked(
bytes1(0xff),
address(this),
uint256(0), // salt
keccak256(bytecode)
)
);
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?