Skip to content

Instantly share code, notes, and snippets.

@RachBLondon
Created June 12, 2020 11:43
Show Gist options
  • Save RachBLondon/55ad0c61bdfa69b94e467e8838b7f7e6 to your computer and use it in GitHub Desktop.
Save RachBLondon/55ad0c61bdfa69b94e467e8838b7f7e6 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.0;
import './IERC20.sol';
contract TryingToSendDaiToContract {
address dai;
uint public amount;
address public thisContract;
constructor() public {
dai = 0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD; //Kovan
amount = 9;
thisContract = address(this);
}
function transferDaiToContract() external {
IERC20 token = IERC20(dai);
token.approve(thisContract, amount);
token.transferFrom(msg.sender, thisContract, amount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment