Skip to content

Immutably owned clones #19

Description

@BlinkyStitt

My cloned proxy deploys costs less the 1/10th of what they did before I found EIP 1167, so thanks for the awesome contract!

Some projects with vote locking (such as https://dao.curve.fi) require smart wallets to have restrictions on transfer in order to be approved. I've been thinking of how to accomplish this and I have a working, but likely not optimal, solution (which also uses CREATE2 and so is one way to solve #18).

At first I was just going to remove the functions for changing the owner, but because the proxy contract has a delegatecall, it would be able to change the state anyway.

Then I was going to try using the new immutable keyword, but we are using an init function instead of a standard constructor to do the setup.

Here's my current solution:

  1. My factory contract appends the immutable owner's address to the end of the contract. This ensures that create2 gives a new address for every user.

https://github.com/SatoshiAndKin/argobytes-contracts-brownie/blob/slim/contracts/abstract/clonefactory/CloneFactory.sol#L56

  1. And then my proxy contract gets its owner from the contract's code:

https://github.com/SatoshiAndKin/argobytes-contracts-brownie/blob/slim/contracts/abstract/ArgobytesAuth.sol#L41

My testnet deploy script works and I'm working on adding more tests this week. I wanted to post this here in case this is helpful for someone else (or in case its a terrible idea and I should be stopped). I'm very new to assembly and so this is probably not perfect. Any suggestions are welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions