In Vyper, there's a built-in function called
Duplicates a contract’s code and deploys it as a new instance, by means of a DELEGATECALL.
If my understanding is correct, what
create_forwarder_to does is:
- Choose an existing contract instance
- Deploy a new contract
Bthat will behave the same as
A's functions whenever there's an incoming function call to
The size of bytecode of
B can be extremely small, since it's not deploying
A again but deploying a forwarder contract that utilizes
Here is an example of a forwarder contract in Uniswap, and you can see how the forwarder contract is deployed in the factory contract of Uniswap. (
create_forwarder_to was called
create_with_code_of before and got renamed in this release.)
How can I do what
create_forwarder_to does with Solidity?