Skip to content

Instantly share code, notes, and snippets.

@ps2-controller
Created August 27, 2019 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ps2-controller/fd8e339955b36ef18be5b1fbd7a58091 to your computer and use it in GitHub Desktop.
Save ps2-controller/fd8e339955b36ef18be5b1fbd7a58091 to your computer and use it in GitHub Desktop.
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