Creating our Token Discussion

mint()
Creates amount tokens and assigns them to account , increasing the total supply.

Emits a transfer event with from set to the zero address.

send() function is used to transfer values from one account to another, but with specific conditions (customized by the programmer), also this function will trigger a gas cost even if it fails, because the idea of the send function is to execute a transfer and get a response even if it fails.

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

For anyone using the newer version of the openzeppelin-solidy package (>= 3.0.0), the ERC20Detailed contract has been rolled into the ERC20 contract, so no need to inherit it or reference it in the constructor (in fact, it no longer exists to reference). Also, the ERC20 contract uses 18 decimals by default, so we don’t need to specify it in the constructor.

Code is mostly the same though:

pragma solidity 0.6.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract JoyCredit is ERC20 {

	constructor (string memory _name, string memory _symbol)
	ERC20(_name, _symbol)
	public
	{}

	function mint(address to, uint256 amount) public returns(bool) {
		_mint(to, amount);
		return true;
	}

}
3 Likes

Another change if you are using the newer version of openzeppelin:

You will also need to instruct truffle to use a version of the solidity compiler that is 0.6.0 or greater.

Add this in truffle-config.js:

compilers: {
    solc: {
      version: "0.6.0",
    }
  }
3 Likes

Hey Everyone. If your anything like me i imagine you are or at least were struggling quite a lot with getting things set up and working properly in this section on creating the tokens. The course material is very outdated as it is from 2018 so obviously things have evolved a lot since then. I want to share what i did to get things to compile in hope that if someone is majorly stuck like i was that it helps in some way even if a little.

However perhaps its a little nice that this is so as it forces you to do your own research to get things working which ultimately enhances your overall learning and knowledge. I want to share what i did to get things working with this section in hope that if anyone sees this post and is in a rut for hours like i was that it is useful and can help you get things working.

So the first problem that i encountered is that openzeppelin has changed a lot since Filips video and the ERC20 folder is missing a few files that we see in the video. If you just run

 npm install openzeppelin-solidity 

it will install the current version which i believe is v4.5 or something. If you use this version you will have to make changes to your code to get things to compile. I ran into a lot of trouble here originally I tried to change the version in truffle-config.js i tried uninstalling truffle and reinstalling it, everything and eventually i did something stupid which resulted in the truffle develop command not working. So i decided to go back to square one and start over.

I had to completely uninstall truffle to fix the truffle develop command issue and just so you can follow along my current versions are shown below

Truffle

If you use the same then you should hopefully not run into any issues if you follow exactly what i did. The next thing i did was to not use the latest version of openzeppelin. I reckon that Filip was using an old version like v2 or something since the video was filmed in 2018. The earlies version that can be cloned now is v2.3 (which i think is still newer than Filips). To download this version simple type

npm install [email protected]

This will give you all of the required ERC20 contracts to follow along with Filips tutorial. However we have another issue. This might not apply to everyone but if you type

pragma solidity 0.5.0

at the beginning of you gameToken contract it will not work and throw an error like this or something sismilar depending on what version your using

Source file requires different compiler version (current compiler is 0.8.4+commit.c7e474f2.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version

I tried fixing this by changing the version in the truffle.config.js file but wasnt good. So what i did was i went into the migrations.sol file in the contracts folder and copied the pragma declaration from there it should be

//SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

this will work. For me the minimum version that i could use was 0.8.4 so that lies in the range above so it works. However if you downloaded v2.3 of openzeppelin all pragma declartaions in the token folder in node_modules is 0.5.0 i think. Thus when importing ERC20 and ERC20Detailed into our GameToken contract it wont work as the same version error is thrown. So what i did was pasted the pragma declaration above into those two files and no errors are thrown. Now there is so many contratcs in the tokens folder but the pragma declaration doesnt need to be changed unless we actually want to use the contratct. So just adjust when as required each time you use one of those contratcs no need to painstakingly go through them all.

I realise this may not be the best method but it works for me. The last thing you will need to do to get things to compile if using v2.3 is to remove the OnlyMinters modifier from the mint function in our GameToken contract. And with that if you have the same versions of truffle node and soliditity as me and followed this post you should be able to compile with no problems. Just incase i will show the outputs from my terminal below so you can follow along

compile1

compile2

compile3

compile4

There definitely is much better ways to go about this but I hope someone finds this post useful so that it can save you all of trouble that i went through when i first started this section.

3 Likes

Nice @mcgrane5, this is a very cleaver trick for most of our courses to be honest, since solidity has been upgrading its syntax, courses like this one are being a quite a pain to complete since the openzepellin contracts arrives with the last solidity version, which can be hard to follow for some students, but by your method, you basically are downloading an old version of the openzepellin contracts right? i mean you can download exactly the version of the contracts that the course advice to.

Also, you could use the OnlyMinter modifier, just need to create a minter profile to an address so it can be the only one with permissions to mint tokens (if you remove it, everyone can).
You can jump directly to this lesson on Etherum Programming 201, which is the one that explain how to use openzepellin roles, or you can also jump into the entire course (could have other new lessons that are interesting for you)
https://academy.ivanontech.com/products/ethereum-smart-contract-programming-201/categories/4829942/posts/16252015

Amazing man, thank you very much for sharing this!

Carlos Z

1 Like

Hi @thecil,

Yes i dowloaded the older version of openzeppelin. However I read a post in this forum that said in the current version of openzeppelin the ERC20Detailed contract had been intergrated with the ERC20.sol contract so now that i have finished deploying to ropsten i might go back and use the current version to see if i can get it working and figure out what adjustments i have to make.

Also thank you for sharing that about the onlyMinters modifier. I will go back and implement that. I am actually gonna start ethereum 201 today or tomorrow i took a few days off after completing 101 to explore solidity some more and to play around a lot with trying to optimise and optimise my multuistig wallet contract to give it some extra featutres and increase security so i was doing that for a few days but the my next goal is to do 201 and smart contract security these courrses seem very intresting to me.

2 Likes

Hi @filip, @ivan hope all is well,

I’m struggling a little on this course on a couple of things and it doesn’t seem that there’s many people doing this particular course to be able to assist. Would you mind helping out? The first error message i’m getting doesn’t prevent the game form playing but I can’t locate this particular issue:

     Phaser v3.15.1 (WebGL | Web Audio)  https://phaser.io
(index):55 game is loading assets
(index):88 game is setting up the assets etc.
96phaser.min.js:1 Uncaught TypeError: Cannot read property 'texture' of undefined
    at initialize.setCurrentFrame (phaser.min.js:1)
    at initialize.updateFrame (phaser.min.js:1)
    at initialize.updateAndGetNextTick (phaser.min.js:1)
    at initialize.nextFrame (phaser.min.js:1)
    at initialize.setFrame (phaser.min.js:1)
    at initialize.update (phaser.min.js:1)
    at initialize.preUpdate (phaser.min.js:1)
    at initialize.update (phaser.min.js:1)
    at initialize.h.emit (phaser.min.js:1)
    at initialize.step (phaser.min.js:1)

The html code is as follows:

<!DOCTYPE html>
<html>
  <head>
    <title>Our Awesome Game</title>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js"></script>
    <script src ="https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js"></script>
    <script src="eth.js"></script>

  </head>


  <body>
    <h1>Collect Coins & Win Money</h1>
    <h2>Collect 100 Bitcoin in 60 Seconds</h2>


    <script>
      var cursors;
      var knight;
      var crates;
      var coinTimer;

      var score = 0;
      var scoreText;

      var secondsLeft = 60;
      var timeLeftText;
      var timeLeftTimer;

      var gameOver = false;

      // Configure the game, (height, wodth, render-type, game loop functions)
      var config = {
        width:800,
        height:450,
        type:Phaser.AUTO,

        scene:{
          preload: gamePreload,
          create: gameCreate,
          update: gameUpdate
        },

        physics:{
          default:"arcade",
          arcade:{
            gravity:{y:300},
            debug:false
          }
        }

      }

      function gamePreload(){
        // Loading Assets
        console.log("game is loading assets");
        this.load.image("knight", "assets/knight.png");
        this.load.image("crate", "assets/crate.png");
        this.load.image("background", "assets/background.png");
        this.load.image("bitcoin", "assets/bitcoin.png");

        // load the run animation frames
        this.load.image("run_frame_1", "assets/knight/run/Run (1).png");
        this.load.image("run_frame_2", "assets/knight/run/Run (2).png");
        this.load.image("run_frame_3", "assets/knight/run/Run (3).png");
        this.load.image("run_frame_4", "assets/knight/run/Run (4).png");
        this.load.image("run_frame_5", "assets/knight/run/Run (5).png");
        this.load.image("run_frame_6", "assets/knight/run/Run (6).png");
        this.load.image("run_frame_7", "assets/knight/run/Run (7).png");
        this.load.image("run_frame_8", "assets/knight/run/Run (8).png");
        this.load.image("run_frame_9", "assets/knight/run/Run (9).png");
        this.load.image("run_frame_10", "assets/knight/run/Run (10).png");

        // load the idle animation frames
        this.load.image("idle_frame_1", "assets/knight/idle/Idle (1).png");
        this.load.image("idle_frame_2", "assets/knight/idle/Idle (2).png");
        this.load.image("idle_frame_3", "assets/knight/idle/Idle (3).png");
        this.load.image("idle_frame_4", "assets/knight/idle/Idle (4).png");
        this.load.image("idle_frame_5", "assets/knight/idle/Idle (5).png");
        this.load.image("idle_frame_6", "assets/knight/idle/Idle (6).png");
        this.load.image("idle_frame_7", "assets/knight/idle/Idle (7).png");
        this.load.image("idle_frame_8", "assets/knight/idle/Idle (8).png");
        this.load.image("idle_frame_9", "assets/knight/idle/Idle (9).png");
        this.load.image("idle_frame_10", "assets/knight/idle/Idle (10).png");
      }

      function gameCreate(){
        // Monitoring inputs and telling game how to update
        console.log("game is setting up the assets etc.");

        // Create background
        this.add.image(300,150,"background");


        // Create the knight
        knight = this.physics.add.sprite(100,100,"knight");
        knight.body.setSize(400,600,200,10);
        knight.scaleX = 0.1;
        knight.scaleY = knight.scaleX;

        // Create the crates
        crates = this.physics.add.staticGroup();

        // Floor
        crates.create(40,450, "crate");
        crates.create(120,450, "crate");
        crates.create(200,450, "crate");
        crates.create(280,450, "crate");
        crates.create(360,450, "crate");
        crates.create(520,450, "crate");
        crates.create(600,450, "crate");
        crates.create(680,450, "crate");
        crates.create(760,450, "crate");


        // Crates in the air
        crates.create(40,250, "crate");
        crates.create(120,250, "crate");
        crates.create(200,250, "crate");
        crates.create(280,250, "crate");
        crates.create(760,350, "crate");
        crates.create(600,150, "crate");
        crates.create(680,300, "crate");

        // Create Animations
        this.anims.create({
          key:"knight_run",
          frames:[
            {key: "run_frame_1"},
            {key: "run_frame_2"},
            {key: "run_frame_3"},
            {key: "run_frame_4"},
            {key: "run_frame_5"},
            {key: "run_frame_6"},
            {key: "run_frame_7"},
            {key: "run_frame_8"},
            {key: "run_frame_9"},
            {key: "run_frame_10"},
          ],
          frameRate: 10,
          repeat: 1
        });

        this.anims.create({
          key:"knight_idle",
          frames:[
            {key: "idle_frame_1"},
            {key: "idle_frame_2"},
            {key: "idle_frame_3"},
            {key: "idle_frame_4"},
            {key: "idle_frame_5"},
            {key: "idle_frame_6"},
            {key: "idle_frame_7"},
            {key: "idle_frame_8"},
            {key: "idleframe_9"},
            {key: "idle_frame_10"},
          ],
          frameRate: 10,
          repeat: 1
        });

        this.physics.add.collider(crates, knight);

        scoreText = this.add.text(16,16, "Bitcoin Bag: 0",
                                  {fontSize: "32px",
                                  fill: "#000"});

        timeLeftText = this.add.text(16,66, secondsLeft + "seconds left",
                                  {fontSize: "32px",
                                  fill: "#f00"});

        cursors = this.input.keyboard.createCursorKeys();

        coinTimer = this.time.addEvent({
          delay: Phaser.Math.Between(0,3000),
          callback: generateCoins,
          callbackScope: this,
          repeat: -1
        });

        timLeftTimer = this.time.addEvent({
          delay: 1000,
          callback: updateTimeLeft,
          callbackScope: this,
          repeat: -1
      });

      }

      function updateTimeLeft(){

        if(gameOver) return;

        secondsLeft -=1;
        timeLeftText.setText(secondsLeft + "seconds left");

        if(secondsLeft<=0){
          this.physics.pause();
          gameOver = true;
        }
      }

      function generateCoins(){

      var coins = this.physics.add.group({
          key: "bitcoin",
          repeat: 1,
          setXY:{
            x: Phaser.Math.Between(0,800),
            y:-100,
            stepX: Phaser.Math.Between(30,100)
          }
        });

        coins.children.iterate (function(child){
          child.setBounceY(Phaser.Math.FloatBetween(0.4,1.5))

        });

        this.physics.add.collider(coins, crates);
        this.physics.add.overlap(knight, coins, collectCoin, null, this)

      }

      function collectCoin(knight, coin){
        coin.disableBody(true, true);
        score +=1;
        scoreText.setText("Bitcoin Bag:" + score);
      }

      function gameUpdate(){
        // Initial set up logic on the assets and other setup

        if(cursors.left.isDown){
          knight.setVelocityX(-200);
          knight.play("knight_run", true);
          knight.flipX = true;
        }
        else if(cursors.right.isDown){
          knight.setVelocityX(200);
          knight.play("knight_run", true);
          knight.flipX = false;
        }
        else{
          knight.setVelocityX(0);
          knight.play("knight_idle", true);
        }

        if(cursors.up.isDown && knight.body.touching.down){
          knight.setVelocityY(-300);
        }

      }

      var game = new Phaser.Game(config);



      </script>


  </body>


</html>

The other issue I have is with the eth.js file and the following appears on the console:

eth.js:1 Uncaught ReferenceError: Web3 is not defined
    at eth.js:1

My eth.js file is as follows:

web3 = new Web3 (new Web3.providers.HttpProvider("http:/localhost:9545"));

var abi = [
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "_name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "_symbol",
        "type": "string"
      },
      {
        "internalType": "uint8",
        "name": "_decimals",
        "type": "uint8"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "owner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "Approval",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "Transfer",
    "type": "event"
  },
  {
    "constant": true,
    "inputs": [
      {
        "internalType": "address",
        "name": "owner",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      }
    ],
    "name": "allowance",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "approve",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [
      {
        "internalType": "address",
        "name": "owner",
        "type": "address"
      }
    ],
    "name": "balanceOf",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "decimals",
    "outputs": [
      {
        "internalType": "uint8",
        "name": "",
        "type": "uint8"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "subtractedValue",
        "type": "uint256"
      }
    ],
    "name": "decreaseAllowance",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "addedValue",
        "type": "uint256"
      }
    ],
    "name": "increaseAllowance",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "name",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "symbol",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "totalSupply",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "transfer",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "transferFrom",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "internalType": "address",
        "name": "_to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "_value",
        "type": "uint256"
      }
    ],
    "name": "mint",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

var contract = new web3.eth.Contract(abi, "0xEb8ccCd2D57FB6C61Ec22be8C1eF85C1F0226b3a");

console.log(contract);

function mintAfterGame (address, nrOfTokens){
  contract.methods.mint(address, nrOfTokens).send({from: address})
  .on('receipt', receipt => {
    alert ("Transaction Complete");
  })
}

Any guidance would be hugely appreciated

Need help with truffle-config.json:

DESKTOP-UHR2GAU:Solidity macbookpro$ truffle develop
Connected to existing Truffle Develop session at http://127.0.0.1:9545/

Error: The network id specified in the truffle config (5777) does not match the one returned by the network (4447). Ensure that both the network and the provider are properly configured.
at Object.detectAndSetNetworkId (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:110:1)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:24:1)
at Object.develop (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:82:1)
at Object.runConsole (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/develop.js:39:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/develop.js:131:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:147:1)
Truffle v5.3.9 (core: 5.3.9)
Node v14.17.0
DESKTOP-UHR2GAU:Solidity macbookpro$

Here is my truffle-config.json:
/**

  • Use this file to configure your truffle project. It’s seeded with some
  • common settings for different networks and features like migrations,
  • compilation and testing. Uncomment the ones you need or modify
  • them to suit your project as necessary.
  • More information about configuration can be found at:
  • trufflesuite.com/docs/advanced/configuration
  • To deploy via Infura you’ll need a wallet provider (like @truffle/hdwallet-provider)
  • to sign your transactions before they’re sent to a remote public node. Infura accounts
  • are available for free at: infura.io/register.
  • You’ll also need a mnemonic - the twelve word phrase the wallet uses to generate
  • public/private key pairs. If you’re publishing your code to GitHub make sure you load this
  • phrase from a file you’ve .gitignored so it doesn’t accidentally become public.

*/

// const HDWalletProvider = require(’@truffle/hdwallet-provider’);
// const infuraKey = “fj4jll3k…”;
//
// const fs = require(‘fs’);
// const mnemonic = fs.readFileSync(".secret").toString().trim();

module.exports = {
/**

  • Networks define how you connect to your ethereum client and let you set the
  • defaults web3 uses to send transactions. If you don’t specify one truffle
  • will spin up a development blockchain for you on port 9545 when you
  • run develop or test. You can ask a truffle command to use a specific
  • network from the command line, e.g
  • $ truffle test --network
    */

networks: {
// Useful for testing. The development name is special - truffle uses it by default
// if it’s defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the host, port and network_id
// options below to some value.
//
development: {
host: “127.0.0.1”, // Localhost (default: none)
port: 9545, // Standard Ethereum port (default: none)
network_id: “*”, // Any network (default: none)
},
// Another network with more advanced options…
// advanced: {
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: , // Account to send txs from (default: accounts[0])
// websocket: true // Enable EventEmitter interface for web3 (default: false)
// },
// Useful for deploying to a public network.
// NB: It’s important to wrap the provider as a function.
// ropsten: {
// provider: () => new HDWalletProvider(mnemonic, https://ropsten.infura.io/v3/YOUR-PROJECT-ID),
// network_id: 3, // Ropsten’s id
// gas: 5500000, // Ropsten has a lower block limit than mainnet
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
// },
// Useful for private networks
// private: {
// provider: () => new HDWalletProvider(mnemonic, https://network.io),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
},

// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},

// Configure your compilers
compilers: {
solc: {
version: “0.5.1”, // Fetch exact version from solc-bin (default: truffle’s version)
// docker: true, // Use “0.5.1” you’ve installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: “byzantium”
// }
}
},

// Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true
//
// Note: if you migrated your contracts prior to enabling this field in your Truffle project and want
// those previously migrated contracts available in the .db directory, you will need to run the following:
// $ truffle migrate --reset --compile-all

db: {
enabled: true
}
};

I need help with the truffle develop command

1 Like

hey @siratoure95 are you trying to deploy locally or to the testnet. Also can you post that code in a code block i need to see which parts are commented/uncommented in your machine. I do preesume your just trying to deploy locally using truffle develop and the truffle migrate --reset command?

That fixed it thank you :slight_smile:

1 Like

I am receiving the error “command not found” when inputting truffle init

I initially had npm permissions issues but watched this video from the previous lecture’s discussion: https://www.youtube.com/watch?v=bxvybxYFq2o&t=177s

At 4:30 in the video it instructs to add a new export — does anyone know what key I need to press to actually add that export? I type it out but cannot figure out how to actually get it to stick and just end up terminating the terminal session on my Mac :frowning:

Obviously I am new to and not great with terminal. Thank you to everyone!

Hey @adykor, hope you are well.

Did you install truffle in your project folder?

npm install -g truffle
https://www.trufflesuite.com/docs/truffle/getting-started/installation

npm is the node package manager require to install apps like truffle.

Carlos Z

The question is: Shouldn’t the course be already updated? It is two years old. I’ve been learning learning more from the moralis youtube channel than from Ivan academy. I’m starting to wish I didn’t spend the money…It seems that there is a lot more interest in pushing Moralis than the academy.

2 Likes

Hey @RBeato. I think you are definitely right this course does need an update. In not sure why there never got around to this as the solidity 101 and 201 course wre now updated as of a few minths ago. However i will say one thing i thibk you should perhaps finish solidity 201 first before trying this course if you have not already in solidity 201 there is extensive sections on using the openzeppelin library and also using truffle. Once you complete these two you will find that the axtuall token implantation oart of this course is not that difficult.

I actually btoke my laptop which had the code for my version if this coursew project. So i actually plan to do it again. Next time around i am going to record myself doing it and post links to the solutiins in these sections. I think the outdated parts are the older version of the openzeppelin library and also the way in which filip sets up his infura node. That whole section on using that weird wallet website is not nessecary you can do the exact same thing with metamask ganache and infura for deploying to test net

I finished Ethereeum Smart Contract Programming 101 and 201. That is not really the point. The point is that this course is 2 years old. Some of the others like the Defi ones are also outdated.
I have been learning new things here and Moralis is a great project but for the amount of money I paid I would expect up-to-date courses.

1 Like

i agreee some of the older courses definitely need improvement and refurbishment. I actually lost all my code for this course as my laptop broke and basically i got sent a new device so i lost lodes of code on my old machine including my solution to this course. Having said that i actually plan to redo thus course as i have much better understanding of solidity now and i want to improve the frontend and optimize or bring up-to-date the erc20 token integration part of the course. So if you stick around i will be posting video solutions to this course (which desperately needs an update)

Sadly is true sir, the space evolve so fast that is hard from our side to keep up the speed, Amadeo for example is working on a new DeFi 101 (no release date yet, just stay tuned), and that one its only 1 year old.

We are working on many projects at these moment, but one of our goals is to slowly update all the courses.

Carlos Z

1 Like

problem 4
plz tell me that ERC20Detailed file is missing so how can i get that file

1 Like

@filip can you plz help me in this problem