This is the deployer contract of truffle react
var MyToken = artifacts.require("MyToken.sol");
var MyTokenSale = artifacts.require("MyTokenSale.sol");
module.exports = async function(deployer){
let addr = await wev3.eth.getAccounts();
await deployer.deploy(MyToken, 10000);
await deployer.deploy(MyTokenSale, 1, addr[0], MyToken.address);
let instance = await MyToken.deployed();
await instance.transfer(MyTokenSale.address, 10000);
}
MyToken contract
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20("GoldBucks", "GLD") {
_mint(msg.sender, initialSupply);
}
}
MyTokenSale contract
pragma solidity ^0.8.1;
import "./Crowdsale.sol";
contract MyTokenSale is Crowdsale{
KycContract kyc;
constructor(
uint256 rate,
address payable wallet,
IERC20 token // this token will be sent to that particular addres that we specify in the deployer
)
Crowdsale(rate,wallet,token) public{
}
}
What is the use of MyToken.address in the deployer contract?