mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Merge pull request #50 from Instadapp/1inch-update
Updated 1inch connector
This commit is contained in:
commit
6c5d8ae361
|
@ -9,10 +9,15 @@ abstract contract Helpers is DSMath, Basic {
|
||||||
/**
|
/**
|
||||||
* @dev 1Inch Address
|
* @dev 1Inch Address
|
||||||
*/
|
*/
|
||||||
address internal constant oneInchAddr = 0x111111125434b319222CdBf8C261674aDB56F3ae;
|
address internal constant oneInchAddr = 0x11111112542D85B3EF69AE05771c2dCCff4fAa26;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev 1inch swap function sig
|
* @dev 1inch swap function sig
|
||||||
*/
|
*/
|
||||||
bytes4 internal constant oneInchSig = 0x90411a32;
|
bytes4 internal constant oneInchSwapSig = 0x7c025200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev 1inch swap function sig
|
||||||
|
*/
|
||||||
|
bytes4 internal constant oneInchUnoswapSig = 0x2e95b6c8;
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ abstract contract OneInchResolver is Helpers, Events {
|
||||||
assembly {
|
assembly {
|
||||||
sig := mload(add(_data, 32))
|
sig := mload(add(_data, 32))
|
||||||
}
|
}
|
||||||
isOk = sig == oneInchSig;
|
isOk = sig == oneInchSwapSig || sig == oneInchUnoswapSig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,5 +124,5 @@ abstract contract OneInch is OneInchResolverHelpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2OneInch is OneInch {
|
contract ConnectV2OneInch is OneInch {
|
||||||
string public name = "1Inch-v1";
|
string public name = "1Inch-v1.1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,14 +82,21 @@ abstract contract OneHelpers is Stores, DSMath {
|
||||||
* @dev Return 1Inch Address
|
* @dev Return 1Inch Address
|
||||||
*/
|
*/
|
||||||
function getOneInchAddress() internal pure returns (address) {
|
function getOneInchAddress() internal pure returns (address) {
|
||||||
return 0x111111125434b319222CdBf8C261674aDB56F3ae;
|
return 0x11111112542D85B3EF69AE05771c2dCCff4fAa26;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Return 1inch swap function sig
|
* @dev Return 1inch swap function sig
|
||||||
*/
|
*/
|
||||||
function getOneInchSig() internal pure returns (bytes4) {
|
function getOneInchSwapSig() internal pure returns (bytes4) {
|
||||||
return 0x90411a32;
|
return 0x7c025200;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Return 1inch swap function sig
|
||||||
|
*/
|
||||||
|
function getOneInchUnoswapSig() internal pure returns (bytes4) {
|
||||||
|
return 0x2e95b6c8;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||||
|
@ -224,7 +231,7 @@ abstract contract OneInchResolver is OneProtoResolver {
|
||||||
assembly {
|
assembly {
|
||||||
sig := mload(add(_data, 32))
|
sig := mload(add(_data, 32))
|
||||||
}
|
}
|
||||||
isOk = sig == getOneInchSig();
|
isOk = sig == getOneInchSwapSig() || sig == getOneInchUnoswapSig();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OneInchData {
|
struct OneInchData {
|
||||||
|
@ -585,5 +592,12 @@ abstract contract OneInch is OneProto {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectOne is OneInch {
|
contract ConnectOne is OneInch {
|
||||||
string public name = "1inch-1proto-v1";
|
string public name = "1inch-1proto-v1.2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Connector Details
|
||||||
|
*/
|
||||||
|
function connectorID() public pure returns(uint _type, uint _id) {
|
||||||
|
(_type, _id) = (1, 98);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user