Created
August 27, 2019 11:57
-
-
Save ps2-controller/fd8e339955b36ef18be5b1fbd7a58091 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
function redeem(uint256 amount) public { | |
ERC20 thisContract = ERC20(address(this)); | |
require(thisContract.transferFrom(msg.sender, address(this), amount), 'Please redeem'); | |
if(_closed) { | |
uint256 toTransfer = amount * _lenderEth / _totalSupply; | |
msg.sender.transfer(toTransfer); | |
toTransfer = amount * _lenderCollateral / _totalSupply; | |
daiContract.transfer(msg.sender, toTransfer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment