I think this simple eg should work Example on how to use ERC20 token in another contract. Did I miss anything?
contract TokenReceiver {
IERC20 private _token;
event DoneStuff(address from);
/**
* @dev Constructor sets token that can be received
*/
constructor (IERC20 token) public {
_token = token;
}
/**
* @dev Do stuff, requires tokens
*/
function doStuff() external {
address from = msg.sender;
_token.transferFrom(from, address(this), _token.balanceOf(from));
_token.burn(from, _token.balanceOf(from));
emit DoneStuff(from);
}
}