I had everything going until I got to the function.
function changeCap() public virtual {
require(hasRole(CHANGECAP_ROLE, _msgSender()), "must have ChangeCap role to change the cap");
}
I then fixed it after looking at otherās results and Pilipās, like so.
// Sets the new cap for tokens
function changeCap(uint256 cap_) public virtual {
require(cap_ >= 0, "ERC20Capped: Cap is 0");
require(hasRole(CHANGECAP_ROLE, _msgSender()), "must have ChangeCap role to change the cap");
_cap = cap_;
}
But as for the last function _beforeTokenTransferā¦I noticed Filipās addition is not in the current ERC20Capped.sol file.
ā¦Pilipās
if (from == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= cap(), "ERC20Capped: cap exceeded");
}
currently in ERC20Capped.sol file
/**
* @dev See {ERC20-_mint}.
*/
function _mint(address account, uint256 amount) internal virtual override {
require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
super._mint(account, amount);
}
Also: I tried to deploy the MyToken Contract but I get an Error message, āReferenceError: RenCoin is not definedā
Here is my Migration fileā¦
const MyToken = artifacts.require("MyToken");
module.exports = function (deployer, name, symbol, cap_ ) {
const userName = name;
const userSymbol = symbol;
const userCap = cap_;
deployer.deploy(MyToken, RenCoin, RENN, 100000);
};