Update Contracts docs to make examples compile (#2170)

* Update access-control.adoc to make compile

Add call to `ERC20("MyToken", "TKN")` in `MyToken` constructor

* Update access-control.adoc to make compile

Add call to `ERC20("MyToken", "TKN")` in `MyToken` constructor

* Update access-control.adoc MyToken formatting

* Update erc20-supply.adoc to make compile

Add call to `ERC20("MyToken", "TKN")` in `ERC20FixedSupply` constructor

* Update erc20-supply.adoc to make compile

Add constructor to `ERC20WithMinerReward`

* Update erc20-supply.adoc to make compile

In `MinerRewardMinter` use `ERC20MinterPauser`

* Update erc20-supply.adoc to make compile

Add constructor and override to `ERC20WithAutoMinerReward`

* Update erc777.adoc to make compile

* Update gsn-strategies.adoc to make compile

* Update gsn-strategies.adoc to make compile

Fix imports, add overrides, and revert reason to `MyContract`
This commit is contained in:
Andrew B Coathup
2020-04-07 21:45:48 +10:00
committed by GitHub
parent 885378e421
commit 05d1618d01
4 changed files with 27 additions and 15 deletions

View File

@ -26,7 +26,7 @@ Starting with Contracts v2 this pattern is not only discouraged, but disallowed.
[source,solidity]
----
contract ERC20FixedSupply is ERC20 {
constructor() public {
constructor() public ERC20("Fixed", "FIX") {
_mint(msg.sender, 1000);
}
}
@ -44,6 +44,8 @@ The mechanism we will implement is a token reward for the miners that produce Et
[source,solidity]
----
contract ERC20WithMinerReward is ERC20 {
constructor() public ERC20("Reward", "RWD") {}
function mintMinerReward() public {
_mint(block.coinbase, 1000);
}
@ -64,9 +66,9 @@ The accounts with the minter role don't need to be externally owned, though, and
[source,solidity]
----
contract MinerRewardMinter {
ERC20DeployReady _token;
ERC20MinterPauser _token;
constructor(ERC20DeployReady token) public {
constructor(ERC20MinterPauser token) public {
_token = token;
}
@ -90,11 +92,13 @@ Adding to our previous supply mechanism, we can use this to mint a miner reward
[source,solidity]
----
contract ERC20WithAutoMinerReward is ERC20 {
constructor() public ERC20("Reward", "RWD") {}
function _mintMinerReward() internal {
_mint(block.coinbase, 1000);
}
function _transfer(address from, address to, uint256 value) internal {
function _transfer(address from, address to, uint256 value) internal override {
_mintMinerReward();
super._transfer(from, to, value);
}