IntercoinContract
System for Deploying Intercoin Smart Contracts, Factories and Instances
Installation
Node
npm install @openzeppelin/contracts-ethereum-package
Deploy
when deploy it is no need to pass parameters in to constructor
Overview
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 |
Methods (IntercoinContract.sol)
init
initializing after deploy
produceFactory
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 |
registerInstance
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 |
checkInstance
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 |
renounceOwnership
Leaves the contract without owner
Methods (Factory.sol)
init
initializing after deploy
produce
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 |
Lifecycle
- 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