mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Restructure
This commit is contained in:
parent
1e69cb14b8
commit
db60f815ba
|
@ -1,10 +1,10 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { TokenInterface } from "./interfaces.sol";
|
import { TokenInterface } from "./interfaces.sol";
|
||||||
import { Stores } from "./stores.sol";
|
import { Stores } from "./stores.sol";
|
||||||
import { DSMath } from "./math.sol";
|
import { DSMath } from "./math.sol";
|
||||||
|
|
||||||
contract Basic is DSMath, Stores {
|
abstract contract Basic is DSMath, Stores {
|
||||||
|
|
||||||
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||||
amt = (_amt / 10 ** (18 - _dec));
|
amt = (_amt / 10 ** (18 - _dec));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
interface TokenInterface {
|
interface TokenInterface {
|
||||||
function approve(address, uint256) external;
|
function approve(address, uint256) external;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
|
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { MemoryInterface, EventInterface} from "./interfaces.sol";
|
import { MemoryInterface, EventInterface} from "./interfaces.sol";
|
||||||
|
|
||||||
|
|
||||||
contract Stores {
|
abstract contract Stores {
|
||||||
|
|
||||||
|
uint256 internal immutable _id;
|
||||||
|
|
||||||
|
constructor(uint256 id) public {
|
||||||
|
_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Return ethereum address
|
* @dev Return ethereum address
|
||||||
|
@ -59,7 +65,7 @@ contract Stores {
|
||||||
* @dev Connector Details - needs to be changed before deployment
|
* @dev Connector Details - needs to be changed before deployment
|
||||||
*/
|
*/
|
||||||
function connectorID() public view returns(uint model, uint id) {
|
function connectorID() public view returns(uint model, uint id) {
|
||||||
(model, id) = (0, 0);
|
(model, id) = (0, _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
import { OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
||||||
import { Stores } from "../../common/stores.sol";
|
|
||||||
|
|
||||||
contract Events is Stores {
|
contract Events {
|
||||||
event LogSell(
|
event LogSell(
|
||||||
address indexed buyToken,
|
address indexed buyToken,
|
||||||
address indexed sellToken,
|
address indexed sellToken,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { TokenInterface } from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
import { DSMath } from "../../common/math.sol";
|
import { DSMath } from "../../common/math.sol";
|
||||||
|
@ -6,7 +6,7 @@ import { Basic } from "../../common/basic.sol";
|
||||||
import { TokenInterface, OneProtoMappingInterface } from "./interface.sol";
|
import { TokenInterface, OneProtoMappingInterface } from "./interface.sol";
|
||||||
|
|
||||||
|
|
||||||
contract Helpers is DSMath, Basic {
|
abstract contract Helpers is DSMath, Basic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Return 1proto mapping Address
|
* @dev Return 1proto mapping Address
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { TokenInterface } from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
// import files from common directory
|
// import files from common directory
|
||||||
import { TokenInterface , MemoryInterface, EventInterface, OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
import { TokenInterface , MemoryInterface, EventInterface, OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
||||||
|
import { Stores } from "../../common/stores.sol";
|
||||||
import { OneInchInterace, OneProtoInterface, OneProtoMappingInterface } from "./interface.sol";
|
import { OneInchInterace, OneProtoInterface, OneProtoMappingInterface } from "./interface.sol";
|
||||||
import { Helpers } from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
|
|
||||||
contract OneProtoResolver is Helpers, Events {
|
abstract contract OneProtoResolver is Helpers, Events {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev 1proto contract swap handler
|
* @dev 1proto contract swap handler
|
||||||
|
@ -84,7 +85,7 @@ contract OneProtoResolver is Helpers, Events {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract OneInchResolver is OneProtoResolver {
|
abstract contract OneInchResolver is OneProtoResolver {
|
||||||
/**
|
/**
|
||||||
* @dev 1inch swap uses `.call()`. This function restrict it to call only swap/trade functionality
|
* @dev 1inch swap uses `.call()`. This function restrict it to call only swap/trade functionality
|
||||||
* @param callData - calldata to extract the first 4 bytes for checking function signature
|
* @param callData - calldata to extract the first 4 bytes for checking function signature
|
||||||
|
@ -128,7 +129,7 @@ contract OneInchResolver is OneProtoResolver {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contract OneProtoResolverHelpers is OneInchResolver {
|
abstract contract OneProtoResolverHelpers is OneInchResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Gets the swapping data onchain for swaps and calls swap.
|
* @dev Gets the swapping data onchain for swaps and calls swap.
|
||||||
|
@ -217,7 +218,7 @@ contract OneProtoResolverHelpers is OneInchResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract OneInchResolverHelpers is OneProtoResolverHelpers {
|
abstract contract OneInchResolverHelpers is OneProtoResolverHelpers {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Gets the swapping data from 1inch's API.
|
* @dev Gets the swapping data from 1inch's API.
|
||||||
|
@ -246,7 +247,7 @@ contract OneInchResolverHelpers is OneProtoResolverHelpers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract OneProto is OneInchResolverHelpers {
|
abstract contract OneProto is OneInchResolverHelpers {
|
||||||
/**
|
/**
|
||||||
* @dev Sell ETH/ERC20_Token using 1proto.
|
* @dev Sell ETH/ERC20_Token using 1proto.
|
||||||
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
||||||
|
@ -345,7 +346,7 @@ contract OneProto is OneInchResolverHelpers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract OneInch is OneProto {
|
abstract contract OneInch is OneProto {
|
||||||
/**
|
/**
|
||||||
* @dev Sell ETH/ERC20_Token using 1inch.
|
* @dev Sell ETH/ERC20_Token using 1inch.
|
||||||
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
||||||
|
@ -378,4 +379,6 @@ contract OneInch is OneProto {
|
||||||
|
|
||||||
contract ConnectOne is OneInch {
|
contract ConnectOne is OneInch {
|
||||||
string public name = "1inch-1proto-v1";
|
string public name = "1inch-1proto-v1";
|
||||||
|
|
||||||
|
constructor(uint256 _id) Stores(_id) public {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { Stores } from "../../common/stores.sol";
|
contract Events {
|
||||||
|
|
||||||
contract Events is Stores {
|
|
||||||
event LogClaimedComp(uint256 compAmt, uint256 setId);
|
event LogClaimedComp(uint256 compAmt, uint256 setId);
|
||||||
event LogDelegate(address delegatee);
|
event LogDelegate(address delegatee);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { InstaMapping } from "../../common/interfaces.sol";
|
import { InstaMapping } from "../../common/interfaces.sol";
|
||||||
import { DSMath } from "../../common/math.sol";
|
import { DSMath } from "../../common/math.sol";
|
||||||
import { Basic } from "../../common/basic.sol";
|
import { Basic } from "../../common/basic.sol";
|
||||||
|
|
||||||
contract Helpers is DSMath, Basic {
|
abstract contract Helpers is DSMath, Basic {
|
||||||
/**
|
/**
|
||||||
* @dev Return Compound Comptroller Address
|
* @dev Return Compound Comptroller Address
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
interface ComptrollerInterface {
|
interface ComptrollerInterface {
|
||||||
function claimComp(address holder) external;
|
function claimComp(address holder) external;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.5;
|
||||||
|
|
||||||
import { TokenInterface , MemoryInterface, EventInterface, InstaMapping } from "../../common/interfaces.sol";
|
import { TokenInterface , MemoryInterface, EventInterface, InstaMapping } from "../../common/interfaces.sol";
|
||||||
|
import { Stores } from "../../common/stores.sol";
|
||||||
import { ComptrollerInterface, COMPInterface } from "./interface.sol";
|
import { ComptrollerInterface, COMPInterface } from "./interface.sol";
|
||||||
import { Helpers } from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
contract CompResolver is Events, Helpers {
|
abstract contract CompResolver is Events, Helpers {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Claim Accrued COMP Token.
|
* @dev Claim Accrued COMP Token.
|
||||||
|
@ -101,4 +102,6 @@ contract CompResolver is Events, Helpers {
|
||||||
|
|
||||||
contract ConnectCOMP is CompResolver {
|
contract ConnectCOMP is CompResolver {
|
||||||
string public name = "COMP-v1";
|
string public name = "COMP-v1";
|
||||||
|
|
||||||
|
constructor(uint256 _id) Stores(_id) public {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "0.6.2"
|
version: "0.6.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
version: "0.6.5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user