Hello,
I am trying to make a staking application DApp and I am facing this problem when I launch the DApp:
Obviously, it's a problem of balance, this one is not enough big. I red this link too: https://forum.openzeppelin.com/t/example-on-how-to-use-erc20-token-in-another-contract/1682
In my SC of staking, I use this function to stake:
Everything works fine in Remix.
I don't understand very well how to set the balance to be greater than the transfer amount. Can I do this in the UI, in the 2_deploy_contracts.js?
This is my 2_deploy_contracts.js:
I set the initialStakeCoinSupply in SC token too:
contract StakeCoin is ERC20, Ownable {
uint256 public initialStakeCoinSupply = 1000000000000000000000000;
/**
@notice the constructor for the Staking coin token
@dev the owner is the admin of the interface
@param initialStakeCoinSupply The amount of initial tokens to mint on construction
<!> it works with Remix!
*/
constructor(uint initialStakeCoinSupply) ERC20("Stake Coin Token", "STC") {
_mint(owner(), initialStakeCoinSupply);
}
/**
* @notice produces some tokens for a smart contract
* @param to address of the recipient
* @param value amount of tokens to produce
* @return boolean did we produce some tokens?
* <!> it works with Remix!
*/
function mint(address to, uint256 value) public onlyOwner returns (bool) {
_mint(to, value);
return true;
}
If you have a piece of advice to give me, don't hesitate please,