mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
minor changes
This commit is contained in:
parent
32429d2b05
commit
8e98da39fd
|
@ -47,19 +47,18 @@ contract SwapHelpers {
|
|||
// require _connectors[i] == "1INCH-A" || "ZEROX-A" || "PARASWAP-A" || similar connectors
|
||||
|
||||
for (uint256 i = 0; i < _length; i++) {
|
||||
bytes4 swapData = bytes4(
|
||||
keccak256("swap(address,address,uint256,uint256,bytes,uint256)")
|
||||
);
|
||||
|
||||
if (
|
||||
keccak256(bytes(_connectors[i])) == keccak256(bytes("1INCH-A"))
|
||||
) {
|
||||
swapData = bytes4(
|
||||
bytes4 swapData = (keccak256(bytes(_connectors[i])) ==
|
||||
keccak256(bytes("1INCH-A")))
|
||||
? bytes4(
|
||||
keccak256(
|
||||
"sell(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
)
|
||||
: bytes4(
|
||||
keccak256(
|
||||
"swap(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
bytes memory _data = abi.encodeWithSelector(
|
||||
swapData,
|
||||
|
|
|
@ -54,11 +54,8 @@ abstract contract Swap is SwapHelpers, Events {
|
|||
uint256 _buyAmt;
|
||||
uint256 _sellAmt;
|
||||
|
||||
if (!success) {
|
||||
revert("swap-failed");
|
||||
} else {
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
}
|
||||
require(success, "swap-Aggregator-failed");
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
|
||||
_eventName = "LogSwapAggregator(string,address,address,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(
|
||||
|
|
|
@ -19,6 +19,7 @@ contract SwapHelpers {
|
|||
bytes[] callDatas;
|
||||
uint256 setId;
|
||||
}
|
||||
|
||||
/**
|
||||
*@dev Swap using the dex aggregators.
|
||||
*@param _connectors name of the connectors in preference order.
|
||||
|
@ -46,17 +47,18 @@ contract SwapHelpers {
|
|||
// require _connectors[i] == "1INCH-A" || "ZEROX-A" || "PARASWAP-A" || similar connectors
|
||||
|
||||
for (uint256 i = 0; i < _length; i++) {
|
||||
bytes4 swapData = bytes4(
|
||||
keccak256("swap(address,address,uint256,uint256,bytes,uint256)")
|
||||
);
|
||||
|
||||
if (keccak256(bytes(_connectors[i])) == keccak256(bytes("1INCH-A"))) {
|
||||
swapData = bytes4(
|
||||
bytes4 swapData = (keccak256(bytes(_connectors[i])) ==
|
||||
keccak256(bytes("1INCH-A")))
|
||||
? bytes4(
|
||||
keccak256(
|
||||
"sell(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
)
|
||||
: bytes4(
|
||||
keccak256(
|
||||
"swap(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
bytes memory _data = abi.encodeWithSelector(
|
||||
swapData,
|
||||
|
|
|
@ -54,11 +54,8 @@ abstract contract Swap is SwapHelpers, Events {
|
|||
uint256 _buyAmt;
|
||||
uint256 _sellAmt;
|
||||
|
||||
if (!success) {
|
||||
revert("swap-failed");
|
||||
} else {
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
}
|
||||
require(success, "swap-Aggregator-failed");
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
|
||||
_eventName = "LogSwapAggregator(string,address,address,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(
|
||||
|
|
|
@ -47,17 +47,18 @@ contract SwapHelpers {
|
|||
// require _connectors[i] == "1INCH-A" || "ZEROX-A" || "PARASWAP-A" || similar connectors
|
||||
|
||||
for (uint256 i = 0; i < _length; i++) {
|
||||
bytes4 swapData = bytes4(
|
||||
keccak256("swap(address,address,uint256,uint256,bytes,uint256)")
|
||||
);
|
||||
|
||||
if (keccak256(bytes(_connectors[i])) == keccak256(bytes("1INCH-A"))) {
|
||||
swapData = bytes4(
|
||||
bytes4 swapData = (keccak256(bytes(_connectors[i])) ==
|
||||
keccak256(bytes("1INCH-A")))
|
||||
? bytes4(
|
||||
keccak256(
|
||||
"sell(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
)
|
||||
: bytes4(
|
||||
keccak256(
|
||||
"swap(address,address,uint256,uint256,bytes,uint256)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
bytes memory _data = abi.encodeWithSelector(
|
||||
swapData,
|
||||
|
|
|
@ -54,11 +54,8 @@ abstract contract Swap is SwapHelpers, Events {
|
|||
uint256 _buyAmt;
|
||||
uint256 _sellAmt;
|
||||
|
||||
if (!success) {
|
||||
revert("swap-failed");
|
||||
} else {
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
}
|
||||
require(success, "swap-Aggregator-failed");
|
||||
(_buyAmt, _sellAmt) = decodeEvents(_connector, returnData);
|
||||
|
||||
_eventName = "LogSwapAggregator(string,address,address,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(
|
||||
|
|
Loading…
Reference in New Issue
Block a user