GithubHelp home page GithubHelp logo

Comments (6)

yarrumretep avatar yarrumretep commented on June 9, 2024 1

Hey @mrwillis - no worries, here is fine.

  1. The contract should not be a solidity library - it should be an ordinary contract but likely with an initialization pattern such as the one in the example. Yes - the Thing that is deployed initially is the master contract - the code for which is run for each of the 'clones' but with the clones' storage.
  2. The one without the numeric suffix is the easiest to start with. The numbered ones can be used to squeeze a few bytes of deployment cost out of the system by using a vanity contract address for the master. Not necessary in most cases. The numbers refer to the number of non-leading-zero bytes in the vanity address of the master contract.

Make sense?

Good luck and happy cloning!

Rock on,

pete

from clone-factory.

yarrumretep avatar yarrumretep commented on June 9, 2024 1

from clone-factory.

nateawelch avatar nateawelch commented on June 9, 2024 1

@mrwillis Just to elaborate on what pete said a little bit, there is no Solidity source for the cloned contracts. We wrote the assembly so it was as small as possible while still having complete return data and revert capabilities. If I were to write the equivalent of what it does in Solidity, it would just be a payable fallback function that takes the call data and calls the master contract with it, returns the result (including revert data), and does nothing else. If you wrote this in Solidity though, the bytecode would be a good amount larger.

from clone-factory.

mrwillis avatar mrwillis commented on June 9, 2024 1

Thanks all for the help. I managed to get it to work. I got my 500 line contract to be deployed with ~100k gas! Great improvement.

from clone-factory.

mrwillis avatar mrwillis commented on June 9, 2024

Thanks Pete.

Just so I have this clear, there still are contracts being deployed, it's just that these contracts simply delegatecalling everything to the master contract, is this right?

As well, if you had to write the source of the clones (in solidity), what would it look like? Just the storage members, the event and static declarations, and a bunch of methods with one line forwarding the call to the master with delegatecall?

Thanks again.

from clone-factory.

yarrumretep avatar yarrumretep commented on June 9, 2024

Great stuff, @mrwillis - I'll close this issue for now, feel free to reopen or just comment on it if you have further questions.

from clone-factory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.