I am facing an issue and I can't figure what's going wrong.
It is a very simple scenario:
A smart-contract, that implements ERC20 and ERC20Mintable from OpenZeppelin.
pragma solidity ^0.5.0;
import "./openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
contract MyToken is ERC20, ERC20Mintable {}
Another smart-contract that received some MyToken.
pragma solidity ^0.5.0;
import "./MyToken.sol";
contract TokenInteraction {
address public tokenAddress;
constructor(address _tokenAdd) public {
tokenAddress = _tokenAdd;
}
function transferToken(address to) public {
MyToken myToken = MyToken(tokenAddress);
myToken.transfer(to, 1);
}
}
I checked that TokenInteraction has more than one token, but when I call transferToken
the transaction revert
.
I don't understand what's happening.
Many thanks for you help!
EDIT : Concerning the deployment and the testing methodology, I use Remix IDE on localhost and I deploy on Ganache running locally. To test it, I just mint a token to TokenInteraction and then try to call transferToken to another address
TokenInteraction
and then try to calltransferToken
to another address.