From e079d20cbac3920bded1170396135184df281bee Mon Sep 17 00:00:00 2001 From: Doug Crescenzi Date: Fri, 6 Jul 2018 05:57:07 -0400 Subject: [PATCH 1/2] Minor improvements to Basil demo --- docs/docs/basil.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/docs/basil.md b/docs/docs/basil.md index ce14f8a..7438a45 100644 --- a/docs/docs/basil.md +++ b/docs/docs/basil.md @@ -29,6 +29,7 @@ Then, let's set up a directory for our project and initialize the npm package: ```sh mkdir basil cd basil +truffle init npm init --yes ``` @@ -37,7 +38,7 @@ npm init --yes Next, let's take a look at the `Basil` contract we will use to control the light bulb: ```sol -pragma solidity ^0.4.21; +pragma solidity ^0.4.24; import "openzeppelin-zos/contracts/ownership/Ownable.sol"; @@ -67,17 +68,17 @@ contract Basil is Ownable { g = _g; b = _b; highestDonation = msg.value; - NewDonation( + emit NewDonation( msg.sender, msg.value, r, g, b); } function withdraw(address wallet) public onlyOwner { - require(this.balance > 0); + require(address(this).balance > 0); require(wallet != address(0)); - uint256 value = this.balance; + uint256 value = address(this).balance; wallet.transfer(value); - Withdrawal(wallet, value); + emit Withdrawal(wallet, value); } } ``` @@ -117,7 +118,7 @@ By now, the json files looks like this: } ``` -OpenZeppelin will use this file to track your project's contracts on chain, making them upgradeable and dynamically linkable to pre-deployed libraries, as well see soon. +OpenZeppelin will use this file to track your project's contracts on chain, making them upgradeable and dynamically linkable to pre-deployed libraries, as we'll see soon. ## Deploying our first version of Basil, locally @@ -164,7 +165,7 @@ Another common thing that happens when developing smart contracts for Ethereum i We could modify `contracts/Basil.sol`. But now let's try something else. Let's make a new contract in `contracts/BasilERC721.sol`, that inherits from our initial version of Basil: ```sol -pragma solidity ^0.4.21; +pragma solidity ^0.4.24; import "./Basil.sol"; import "openzeppelin-zos/contracts/token/ERC721/MintableERC721Token.sol"; From e5b5e4ce2acca456e15a7de4c514c6421a9302e2 Mon Sep 17 00:00:00 2001 From: Doug Crescenzi Date: Sat, 7 Jul 2018 07:11:21 -0400 Subject: [PATCH 2/2] removed truffle init in Basil.md and updated version of Solidity in tutorial docs --- docs/docs/basil.md | 1 - docs/docs/building.md | 2 +- docs/docs/low_level_app.md | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/docs/basil.md b/docs/docs/basil.md index 7438a45..873967f 100644 --- a/docs/docs/basil.md +++ b/docs/docs/basil.md @@ -29,7 +29,6 @@ Then, let's set up a directory for our project and initialize the npm package: ```sh mkdir basil cd basil -truffle init npm init --yes ``` diff --git a/docs/docs/building.md b/docs/docs/building.md index 27aed49..5bf7653 100644 --- a/docs/docs/building.md +++ b/docs/docs/building.md @@ -15,7 +15,7 @@ npm install zos-lib Next, let's create a file named `MyContract.sol` in the `contracts/` folder with the following Solidity code: ```js -pragma solidity ^0.4.21; +pragma solidity ^0.4.24; import "zos-lib/contracts/migrations/Migratable.sol"; contract MyContract is Migratable { diff --git a/docs/docs/low_level_app.md b/docs/docs/low_level_app.md index ee7f44f..1de8c7a 100644 --- a/docs/docs/low_level_app.md +++ b/docs/docs/low_level_app.md @@ -34,7 +34,7 @@ await App.deploy(initialVersion) An initial version of the Solidity contract could look like: ```sol -pragma solidity ^0.4.21; +pragma solidity ^0.4.24; import "openzeppelin-zos/contracts/ownership/Ownable.sol"; import "openzeppelin-zos/contracts/math/SafeMath.sol"; @@ -87,7 +87,7 @@ npm install openzeppelin-zos Done! Now we can easily mint non-fungible tokens from our smart contract: ```sol -pragma solidity ^0.4.21; +pragma solidity ^0.4.24; import "./DonationsV0.sol"; import "openzeppelin-zos/contracts/token/ERC721/MintableERC721Token.sol";