Skip to content

Commit

Permalink
gemjoin flash loan
Browse files Browse the repository at this point in the history
  • Loading branch information
nmushegian committed Oct 3, 2021
1 parent 4c63043 commit 2b5cbae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/join.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ contract GemJoin is Ward {
vat.slip(ilk, msg.sender, -int(wad));
require(gem.transfer(usr, wad), "GemJoin/failed-transfer");
}

function flash(uint amt, address code, bytes calldata data) external returns (bytes memory result) {
gem.transfer(code, amt);
bool ok; (ok, result) = code.call(data);
gem.transferFrom(code, address(this), amt);
return result;
}
}

contract DaiJoin is Math, Ward {
Expand Down
2 changes: 1 addition & 1 deletion src/vat.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ contract Vat is Math, Ward {

// --- CDP Fungibility ---
function fork(bytes32 ilk, address src, address dst, int dink, int dart) external {
drip(i);
drip(ilk);
prod();
Urn storage u = urns[ilk][src];
Urn storage v = urns[ilk][dst];
Expand Down

0 comments on commit 2b5cbae

Please sign in to comment.