mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Fixed decoding bug
This commit is contained in:
parent
6f8767a505
commit
c87da94839
|
@ -31,12 +31,16 @@ contract DydxFlashloaner is ICallee, DydxFlashloanBase {
|
||||||
bytes memory data
|
bytes memory data
|
||||||
) public {
|
) public {
|
||||||
require(sender == address(this), "not-same-sender");
|
require(sender == address(this), "not-same-sender");
|
||||||
CastData memory cd = abi.decode(data, (CastData));
|
CastData memory cd;
|
||||||
|
(cd.dsa, cd.token, cd.amount, cd.targets, cd.data) = abi.decode(
|
||||||
|
data,
|
||||||
|
(address, address, uint256, address[], bytes[])
|
||||||
|
);
|
||||||
|
|
||||||
IERC20 tokenContract;
|
IERC20 tokenContract;
|
||||||
if (cd.token == ethAddr) {
|
if (cd.token == ethAddr) {
|
||||||
tokenContract = IERC20(wethAddr);
|
tokenContract = IERC20(wethAddr);
|
||||||
tokenContract.approve(getAddressWETH(), cd.amount);
|
tokenContract.approve(wethAddr, cd.amount);
|
||||||
tokenContract.withdraw(cd.amount);
|
tokenContract.withdraw(cd.amount);
|
||||||
payable(cd.dsa).transfer(cd.amount);
|
payable(cd.dsa).transfer(cd.amount);
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,5 +81,9 @@ contract DydxFlashloaner is ICallee, DydxFlashloanBase {
|
||||||
require(sub(iniBal, finBal) < 5, "amount-paid-less");
|
require(sub(iniBal, finBal) < 5, "amount-paid-less");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
contract InstaDydxFlashLoan is DydxFlashloaner {
|
||||||
|
|
||||||
receive() external payable {}
|
receive() external payable {}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user