Created
June 12, 2020 11:43
-
-
Save RachBLondon/55ad0c61bdfa69b94e467e8838b7f7e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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