# Leveraging OpenZeppelin with Sound and Gigantic Steps

**URL:** <https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258>\
**Category:** Contracts\
**Tags:** erc20, erc721\
**Created:** [February 4, 2019, 5:12pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258 "2019-02-04T17:12:21Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![paulinablaszk](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/paulinablaszk/32/233_2.png) [@paulinablaszk](https://forum.openzeppelin.com/u/paulinablaszk)\
**Post date:** [February 25, 2019, 1:48pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/23 "2019-02-25T13:48:56Z")

</div>

@jaureguino I think you can try to change your gas limit in truffle.config to 300000 or even more and you will see if that is the problem.  
In your truffle.config.js you have **30 000** not **300 000**  
I tried to deploy your contract and the cost was:

 ![53](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/ffe85f028e5f42f1eebe33fa2683ba30635f2121.png)

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [February 25, 2019, 2:14pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/24 "2019-02-25T14:14:12Z")

</div>

@paulinablaszk you are so very kind,

Do you mean something like this 👇  
 ![new%20truffle](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/bc0a634b5fc22e26f3b5a3fb4d0d7244614fd97c.png)

---

<div class="post-metadata">

**Author:** ![paulinablaszk](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/paulinablaszk/32/233_2.png) [@paulinablaszk](https://forum.openzeppelin.com/u/paulinablaszk)\
**Post date:** [February 25, 2019, 2:16pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/25 "2019-02-25T14:16:14Z")

</div>

I think it should work 🙂

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [February 25, 2019, 2:17pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/26 "2019-02-25T14:17:09Z")

</div>

I just changed ganache as follows 👇 and will do a test

 ![new%20ganache](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/8e3fb13c2304befe32047f889c375b8c25602667.png)

It did not work… This is what I got 👇  
 ![last%20error](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/146f60041eef53d7cd0c1d7b84be61569e33f450.png)

🤦🏻‍♂️ **What to do? What to do?** 🤷‍♂️

I found out there is a bug on Web3 listed here 👇 [https://stackoverflow.com/questions/52956509/uncaught-error-returned-values-arent-valid-did-it-run-out-of-gas](https://stackoverflow.com/questions/52956509/uncaught-error-returned-values-arent-valid-did-it-run-out-of-gas)

Which I partially fixed with `truffle migrate --reset`

 ![first%20bug%20fizxed](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/e09aef86a8e33d224e810531b40e4f50918eb79f.png)

And here the other bug [https://github.com/trufflesuite/ganache/issues/960](https://github.com/trufflesuite/ganache/issues/960)

```auto
  networks: {
    development: {
      host: "localhost",
      port: 7545,
      gas: 10000000,
      gasPrice: 10,
      network_id: "*",
    },
  },
  compilers: {
    solc: {
      settings: {
        optimizer: {
          enabled: true, // Default: false
          runs: 1000 // Default: 200
        },
        evmVersion: "homestead" // Default: "byzantium"
      }
    }
  }
};

```

plus `truffle compile --all`

Testing… more to come…

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [February 26, 2019, 8:40pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/27 "2019-02-26T20:40:38Z")

</div>

Greetings everyone,

You are probably familiarized with the latest `TFF_Token.sol` contract 👇

```auto
pragma solidity ^0.5.0;

import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';

/**
 * @title TFF_Token http://estudios-amazonia.com/TheFaustFlick_WP.pdf
 * @dev ERC721 metadata minting logic leveraging openzeppelin-solidity v2.1.2
 * @dev ERC721 facilitates preventing: a) double-voting per token and
 * b) disabling trading during voting periods.
 */

contract TFF_Token is ERC721Full, ERC721MetadataMintable, Ownable {

// With Local Ganache Wallet
// address private Owner = 0x8045B92162Bb607454f8CF4CC44CBD9dff518495;
// With Kovan Metamask Wallet
  address private Owner = 0x14193178f8d8f20990988556B869eF28135826f7;
  string private Name = "TheFaustFlick";
  string private Symbol = "TFF";
  string private TokenURI = "http://thefaustflick.com/images/TFF_Token.png";
  uint256 private TokenId;
  uint8[4] private MintStage;
  uint256[4] private TokensToMint;

  // Constructor
  constructor() ERC721Full(Name, Symbol) public {
    TokenId = 1;
    for (uint8 counter = 0; counter <= 3; counter++) { MintStage[counter] = 0; }
    TokensToMint[0] = 500000;
    TokensToMint[1] = 3000000;
    TokensToMint[2] = 3000000;
    TokensToMint[3] = 3500000;
    Mint_TFF(0);
  }

  /**
   * @dev TFF Minter function * Warning * Review White Paper * Get last
   * TokenId to figure out next logically correct Mint_TFF(_Stage) value
   */
  function Mint_TFF(uint8 _Stage) public onlyOwner returns (bool) {
    if (MintStage[_Stage] == 0) {
      uint256 tokensToMint = TokensToMint[_Stage];
      for (uint256 counter = 1; counter <= tokensToMint; counter++) {
        mintWithTokenURI(Owner, TokenId, TokenURI);
        TokenId = TokenId.add(1);
      }
      MintStage[_Stage] = 1;
      return true;
    }
  }

  /**
   * @dev Gets Last TokenId function * Useful to determine how many TFF Tokens
   * have been minted. Helps figure the next logically correct Mint_TFF() Value
   */
  function GetLastTokenId() public view returns (uint256) {
      return TokenId;
  }

  function GetTokenURI() public view returns (string memory) {
      return TokenURI;
  }
}

```

Here is my `truffle-congif.js` file 👇

```auto
const path = require("path");
require('dotenv').config();
const devmnem = process.env.DEVMNEN;
const kovmnem = process.env.KOVMNEN;
const key = process.env.INFURA_API_KEY;
const HDWalletProvider = require("truffle-hdwallet-provider");

module.exports = {
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),
  networks: {
    development: {
      provider: function() {
        return new HDWalletProvider(devmnem, "http://127.0.0.1:7000/");
    },
    network_id: 5777,
    gas: 10000000000,
    gasPrice: 1,
    },
    kovan: {
      provider: function() {
        return new HDWalletProvider(kovmnem, 'https://kovan.infura.io/v3/' + key);
    },
      network_id: 42,
      gas: 4700000,
      gasPrice: 1,
    },
    ropsten: {
      provider: function() {
        return new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/v3/' + key);
    },
      network_id: 3,
      gas: 4700000,
      gasPrice: 21,
    },
    rinkeby: {
      provider: function() {
        return new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io/v3/' + key);
    },
      network_id: 4,
      gas: 4700000,
      gasPrice: 21,
    },
    mainnet: {
      provider: function() {
        return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/v3' + key);
    },
      network_id: 1,
      gas: 4700000,
      gasPrice: 5,
    }
  },
  compilers: {
    solc: {
      settings: {
        optimizer: {
          enabled: true, // Default: false
          runs: 1000 // Default: 200
        },
        evmVersion: "homestead" // Default: "byzantium"
      }
    }
  }
};

```

Here is my `.env` file 👇

```auto
KOVMNEN="[MNEMONIC]"
INFURA_API_KEY='b765cde076c04e2193620ea99d8dc786'

```

Should `[MNEMONIC]` be taken from the 12 words generated at [https://iancoleman.io/bip39/](https://iancoleman.io/bip39/) such as 👇  
 ![generate](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/c92c535a0f2e2ffea7d0820a6407fb1b37ddf00a.png)  
 ![select](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/e831031bee1605a28bb522928f0315ceddf793f8.png)

And the derived address obtained here 👇  
 ![derived%20key](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/d1ebbc4516eb8dc9a8aec4b837592b8a1dc66e58.png)  
should be used 👉 [https://faucet.kovan.network/](https://faucet.kovan.network/) to get some **ETH**?

And should it also be assigned to `address private Owner` in `TFF_Token.sol` ?

**Could anyone confirm/deny/correct?**

Thanks a lot!

Special thanks to @nventuro for putting me on the right path… I think…

g.a.

---

<div class="post-metadata">

**Author:** ![IvanTheGreatDev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ivanthegreatdev/32/6647_2.png) [@IvanTheGreatDev](https://forum.openzeppelin.com/u/IvanTheGreatDev)\
**Post date:** [February 26, 2019, 9:45pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/28 "2019-02-26T21:45:15Z")

</div>

Hello jaureguino!

The mnemonic comes from any ETH related wallet, Metamask can retrieve you the mnenomic, MyEtherWallet can, but using that tool will work as well. For production you would want to use a more securely obtained private key though.

The faucet depends on what testnet you’re on. Which network will you be deploying to if not your local ganache network?

The private key you use will affect who is marked as the owner of the contract, yes.

Hopefully that answers your questions.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [February 27, 2019, 12:17pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/29 "2019-02-27T12:17:30Z")

</div>

Dear @IvanTheGreatDev,

Thanks a lot for your response which in fact answers my questions. The `TFF_Token.sol` contract has been compiled and migrated into Kovan successfully. The following are the top 5 lines of the contract 👇

```auto
pragma solidity ^0.5.0;

import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';

```

When trying to verify, I got the following error 👇

 ![verifying%20error](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/7974b17c67846a75ec579236e9ba117040f2dddf.png)

I found this 👉 [https://ethereum.stackexchange.com/questions/64654/truffle-compile-gives-parser-error-error-parsing-openzeppelin-solidity-contract](https://ethereum.stackexchange.com/questions/64654/truffle-compile-gives-parser-error-error-parsing-openzeppelin-solidity-contract)

@nventuro,

I noticed that [https://www.npmjs.com/package/openzeppelin-solidity](https://www.npmjs.com/package/openzeppelin-solidity) was **“published”** 19 hours ago,  
 ![published](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/9b9dea0dc706736d21558065f6f85772347b0426.png)

Therefore, I have re-installed and compiled 👇  
 ![reinstalled](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/be8c8ab1629cd4944d49e973d8795e7a72d2f469.png)

and updated `"openzeppelin-solidity": "2.1.3"` and `"solc": "^0.5.0"` in `package.json` as 👇  
 ![updated%20package](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/c349d9dd95e74b1bd0cfcf93bc8e743ffe642e11.png)

I just re-deployed 👇  
 ![deploying](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/107fa67ca546fcf36fc1979f9115c150eddcbc94.png)

and I am still getting the same error when verifying the contract at Kovan… 👇

 ![kovan](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/3b8e9ce4faa39bcbd877190c6a6693224b7ca06f.png)

**any thoughts?**

g.a.

---

<div class="post-metadata">

**Author:** ![nventuro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nventuro/32/8_2.png) [@nventuro](https://forum.openzeppelin.com/u/nventuro)\
**Post date:** [February 27, 2019, 3:06pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/31 "2019-02-27T15:06:07Z")

</div>

> [@jaureguino](#):
>
> and I am still getting the same error when verifying the contract at Kovan… 👇

Etherscan won't be able to resolve the imports (see the error message). You'll need to use a tool such as [`truffle-flattener`](https://github.com/nomiclabs/truffle-flattener) to get a single file with all of the source code, or alternatively use [ZeppelinOS's `verify` command](https://docs.zeppelinos.org/docs/next/cli_verify.html), which will do all of that for you.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [February 27, 2019, 3:47pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/32 "2019-02-27T15:47:10Z")

</div>

Thanks @nventuro,

I could not get the ZeppelinOs´s verify command working for me, so I ended up doing as follows:  
`truffle-flattener ./contracts/TFF_Token.sol > ./contracts/FTFF_Token.sol`  
`copy ./contracts/TFF_Token.sol ./development/TFF_Token.sol`  
`del ./contracts/TFF_Token.sol`  
`rename ./contracts/FTFF_Token.sol ./contracts/TFF_Token.sol`  
`truffle compile --all`  
`truffle migrate --network kovan --reset`

And I got the following error while verifying

 ![Error%20Verify](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/a14b2176db2aa34a36f486d365180f4ca621a929.png)

I manually removed all the `pragma solidity ^0.5.0;` from `./contracts/TFF_Token.sol`, except the one on the first line. Then I did:

```auto
truffle compile --all
truffle migrate --network kovan --reset

```

When veryfying at [https://kovan.etherscan.io/](https://kovan.etherscan.io/) which file should I use?

`./contracts/TFF_Token.sol`  
or  
`./client/src/contracts/TFF_Token.json`

I tried both, separately of course, and it did not verify with either,

Then I found 👇 here 👉 [https://github.com/nomiclabs/truffle-flattener](https://github.com/nomiclabs/truffle-flattener)  
 ![limitations](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/555f3f3b08e6df00c1ba98c204e9c77bac4e6dcc.png)

So I checked 👉 [https://github.com/BlockCatIO/solidity-flattener](https://github.com/BlockCatIO/solidity-flattener) and found 👇  
 ![solidity](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/97590f56c197fa2cf6f677e138f1330e669f38fb.png)

So it seems that I need to install `Python 3.5+` and `pip` on my `windows 7`

Dear @nventuro,

I have been unable to get solidity-flattener nor parity installed/working property.

Could you please let walk me through using ZeppelinOs´s verify command ?

g.a.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [March 1, 2019, 3:20pm UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/33 "2019-03-01T15:20:25Z")

</div>

Project Update

During testing we realized that `transfer()` function only does so with one `tokenId` at a time 👉 [https://medium.com/horizongames/going-beyond-erc20-and-erc721-9acebd4ff6ef](https://medium.com/horizongames/going-beyond-erc20-and-erc721-9acebd4ff6ef) which significantly hampers purchasing ability; therefore we have decided to revert back to the `ERC20` solution.

We will leverage the `openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol` contract so that we can pause trading during voting period, thus avoid double-voting.

We are so pleased and grateful that the Zeppelin Team that already thought and delivered the **Pausable** functionality.

Cheers and more to come!

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [March 2, 2019, 1:53am UTC](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258/34 "2019-03-02T01:53:53Z")

</div>

Cheers Everybody!

The initial phase of our project has been completed successfully, not without your terrific development work and support 👍; the `pausable` functions were thoroughly tested and worked just as expected. 💪🏻

All the best for all of you. _I will certainly be coming back as we start working on our phase two._

**Keep up the great work!**

More to come!

g.a.

[Previous page](https://forum.openzeppelin.com/t/leveraging-openzeppelin-with-sound-and-gigantic-steps/258.md?page=1)
