diff options
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r-- | docs/contracts.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index c02c1490..3d592ecf 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -23,6 +23,9 @@ name as the contract) is executed once. From ``web3.js``, i.e. the JavaScript API, this is done as follows:: + // Need to specify some source including contract name for the data param below + var source = "contract CONTRACT_NAME { function CONTRACT_NAME(unit a, uint b) {} }"; + // The json abi array generated by the compiler var abiArray = [ { @@ -41,7 +44,8 @@ API, this is done as follows:: } ]; - var MyContract = web3.eth.contract(abiArray); + var MyContract_ = web3.eth.contract(source); + MyContract = web3.eth.contract(MyContract_.CONTRACT_NAME.info.abiDefinition); // deploy new contract var contractInstance = MyContract.new( 10, @@ -85,7 +89,7 @@ This means that cyclic creation dependencies are impossible. // Only the creator can alter the name -- // the comparison is possible since contracts // are implicitly convertible to addresses. - if (msg.sender == creator) + if (msg.sender == address(creator)) name = newName; } |