Skip to content

Simple example application implementing factory pattern.

License

Notifications You must be signed in to change notification settings

ethereans/factory-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Factory Example

Sample application demonstring how to split big contracts and deploy in more than one transaction.

Contracts

This contracts are experimental and intended to study. Review e test carefully before using them.

Normal call

Factory directly returns new Contract(). Overwrites msg.sender! Can be used when sender's msg variable is not used. Smallest footprint.
src/normal/MyAppTokenFactoryN.sol
src/AppExampleN.sol

delegated call

Not working. Uses manual delegation by factory.delegatecall(): uses a storage pointer to read arguments and to return value;
src/AppExampleD.sol - gives error out of gas on delegation.
src/normal/MyAppTokenFactoryD.sol

library call

Use library for delegate call to MyAppTokenFactoryN. Overwrites msg.sender! Can be used when sender's msg variable is not used.
src/AppExampleNL.sol - works but contracts not splitted.
src/AppExampleNLF.sol - requires MyAppTokenFactoryN address in constructor;
src/library/MyAppTokenLibraryNF.sol using MyAppTokenLibraryNF for MyAppTokenFactoryNI;

Deploy

Deploy first MyAppTokenFactoryX.sol:MyAppTokenFactoryX and use the resulting address in the constructor of AppExampleX.sol:AppExampleX

Using ethereum-sandbox

Log-in into your live.ether.camp ide
Open file ethereum.json and set the contracts to be deployed, Delegated or Normal.
Press Run All Contracts.

About

Simple example application implementing factory pattern.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published