System for Deploying Intercoin Smart Contracts, Factories and Instances
npm install @openzeppelin/contracts-ethereum-package
when deploy it is no need to pass parameters in to constructor
Once installed will be use methods:
| method name | called by | description |
|---|---|---|
| IntercoinContract.sol | ||
| init | owner | initializing after deploy |
| produceFactory | owner | creating factory possible to create contract instance |
| registerInstance | only factories created by IntercoinContract | registering contracts created by factories |
| checkInstance | anyone | checking contracts created by factory |
| renounceOwnership | owner |
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. |
| Factory.sol | ||
| init | owner | initializing after deploy |
| produce | anyone | creating contract insance |
initializing after deploy
creating factory possible to create contract instance
Emitted event ProducedFactory(address addr)
Params:
| name | type | description |
|---|---|---|
| contractInstance | address | contract's address which need to clone |
Return Values:
| name | type | description |
|---|---|---|
| factoryInstance | address | factory's address |
Registering contracts creating by factories
Params:
| name | type | description |
|---|---|---|
| addr | address[] | address of contract instance |
Return Values:
| name | type | description |
|---|---|---|
| success | bool | true if registered successful |
checking contracts created by factory
Params:
| name | type | description |
|---|---|---|
| addr | address[] | address of contract instance |
Return Values:
| name | type | description |
|---|---|---|
| success | bool | true if registered successfully before |
Leaves the contract without owner
initializing after deploy
creating factory possible to create contract instance
Emitted event Produced(address indexed caller, address indexed addr)
Return Values:
| name | type | description |
|---|---|---|
| addr | address | contract's address |
- owner deploy contract which need to be cloned. got
contract address - owner deploy IntercoinContract and call method init()
- create factory
- owner call method produceFactory(<
contract address>) at IntercoinContract. - emitted event ProducedFactory(<
factory address>)
- owner call method produceFactory(<
- creating contract
- anyone can call method produce() at newly created factory
- emitted event Produce(<
contract address>)
- now user can call init at newly created contract and would to be owner