mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Refactor
This commit is contained in:
parent
e392dd6262
commit
ac505457cd
|
@ -23,7 +23,7 @@ abstract contract Basic is DSMath, Stores {
|
|||
sellDec = address(sellAddr) == getEthAddr() ? 18 : sellAddr.decimals();
|
||||
}
|
||||
|
||||
function encodeEvent(string eventName, bytes eventParam) internal pure returns (bytes memory) {
|
||||
function encodeEvent(string memory eventName, bytes memory eventParam) internal pure returns (bytes memory) {
|
||||
return abi.encode(eventName, eventParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
||||
import { OneProtoData, OneProtoMultiData, OneInchData} from "./interface.sol";
|
||||
|
||||
contract Events {
|
||||
event LogSell(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
import { DSMath } from "../../common/math.sol";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface, OneProtoData, OneProtoMultiData, OneInchData} from "../../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../../common/interfaces.sol";
|
||||
import { Stores } from "../../common/stores.sol";
|
||||
import { OneInchInterace, OneProtoInterface, OneProtoMappingInterface } from "./interface.sol";
|
||||
import { OneInchInterace, OneProtoInterface, OneProtoMappingInterface, OneProtoData, OneProtoMultiData, OneInchData } from "./interface.sol";
|
||||
import { Helpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
|
@ -379,6 +379,4 @@ abstract contract OneInch is OneProto {
|
|||
|
||||
contract ConnectOne is OneInch {
|
||||
string public name = "1inch-1proto-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
contract Events {
|
||||
event LogClaimedComp(uint256 compAmt, uint256 setId);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.5;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
interface ComptrollerInterface {
|
||||
function claimComp(address holder) external;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
import { TokenInterface , MemoryInterface, EventInterface, InstaMapping } from "../../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface, InstaMapping } from "../../common/interfaces.sol";
|
||||
import { Stores } from "../../common/stores.sol";
|
||||
import { ComptrollerInterface, COMPInterface } from "./interface.sol";
|
||||
import { Helpers } from "./helpers.sol";
|
||||
|
@ -12,7 +12,7 @@ abstract contract CompResolver is Events, Helpers {
|
|||
* @dev Claim Accrued COMP Token.
|
||||
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
|
||||
*/
|
||||
function ClaimComp(uint setId) external payable returns (bytes calldata) {
|
||||
function ClaimComp(uint setId) external payable returns (bytes memory) {
|
||||
TokenInterface compToken = TokenInterface(getCompTokenAddress());
|
||||
uint intialBal = compToken.balanceOf(address(this));
|
||||
ComptrollerInterface(getComptrollerAddress()).claimComp(address(this));
|
||||
|
@ -29,7 +29,7 @@ abstract contract CompResolver is Events, Helpers {
|
|||
* @param tokens Array of tokens supplied and borrowed.
|
||||
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
|
||||
*/
|
||||
function ClaimCompTwo(address[] calldata tokens, uint setId) external payable returns (bytes calldata) {
|
||||
function ClaimCompTwo(address[] calldata tokens, uint setId) external payable returns (bytes memory) {
|
||||
uint _len = tokens.length;
|
||||
address[] memory ctokens = new address[](_len);
|
||||
for (uint i = 0; i < _len; i++) {
|
||||
|
@ -53,7 +53,7 @@ abstract contract CompResolver is Events, Helpers {
|
|||
* @param borrowTokens Array of tokens borrowed.
|
||||
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
|
||||
*/
|
||||
function ClaimCompThree(address[] calldata supplyTokens, address[] calldata borrowTokens, uint setId) external payable returns (bytes calldata) {
|
||||
function ClaimCompThree(address[] calldata supplyTokens, address[] calldata borrowTokens, uint setId) external payable returns (bytes memory) {
|
||||
(address[] memory ctokens, bool isBorrow, bool isSupply) = mergeTokenArr(supplyTokens, borrowTokens);
|
||||
|
||||
address[] memory holders = new address[](1);
|
||||
|
@ -74,7 +74,7 @@ abstract contract CompResolver is Events, Helpers {
|
|||
* @dev Delegate votes.
|
||||
* @param delegatee The address to delegate votes to.
|
||||
*/
|
||||
function delegate(address delegatee) external payable returns (bytes calldata) {
|
||||
function delegate(address delegatee) external payable returns (bytes memory) {
|
||||
COMPInterface compToken = COMPInterface(getCompTokenAddress());
|
||||
require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee.");
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ pragma solidity ^0.7.0;
|
|||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -275,8 +275,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
uint256 getId,
|
||||
uint256 setId
|
||||
) internal {
|
||||
bytes32 _eventCode;
|
||||
bytes memory _eventParam;
|
||||
emit LogSell(
|
||||
address(oneProtoData.buyToken),
|
||||
address(oneProtoData.sellToken),
|
||||
|
@ -285,16 +283,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
getId,
|
||||
setId
|
||||
);
|
||||
_eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
_eventParam = abi.encode(
|
||||
address(oneProtoData.buyToken),
|
||||
address(oneProtoData.sellToken),
|
||||
oneProtoData._buyAmt,
|
||||
oneProtoData._sellAmt,
|
||||
getId,
|
||||
setId
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
event LogSellTwo(
|
||||
|
@ -311,8 +299,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
uint256 getId,
|
||||
uint256 setId
|
||||
) internal {
|
||||
bytes32 _eventCode;
|
||||
bytes memory _eventParam;
|
||||
emit LogSellTwo(
|
||||
address(oneProtoData.buyToken),
|
||||
address(oneProtoData.sellToken),
|
||||
|
@ -321,16 +307,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
getId,
|
||||
setId
|
||||
);
|
||||
_eventCode = keccak256("LogSellTwo(address,address,uint256,uint256,uint256,uint256)");
|
||||
_eventParam = abi.encode(
|
||||
address(oneProtoData.buyToken),
|
||||
address(oneProtoData.sellToken),
|
||||
oneProtoData._buyAmt,
|
||||
oneProtoData._sellAmt,
|
||||
getId,
|
||||
setId
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
event LogSellMulti(
|
||||
|
@ -348,8 +324,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
uint256 getId,
|
||||
uint256 setId
|
||||
) internal {
|
||||
bytes32 _eventCode;
|
||||
bytes memory _eventParam;
|
||||
emit LogSellMulti(
|
||||
oneProtoData.tokens,
|
||||
address(oneProtoData.buyToken),
|
||||
|
@ -359,17 +333,6 @@ abstract contract OneProtoEventResolver is OneInchResolver {
|
|||
getId,
|
||||
setId
|
||||
);
|
||||
_eventCode = keccak256("LogSellMulti(address[],address,address,uint256,uint256,uint256,uint256)");
|
||||
_eventParam = abi.encode(
|
||||
oneProtoData.tokens,
|
||||
address(oneProtoData.buyToken),
|
||||
address(oneProtoData.sellToken),
|
||||
oneProtoData._buyAmt,
|
||||
oneProtoData._sellAmt,
|
||||
getId,
|
||||
setId
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,8 +350,6 @@ abstract contract OneInchEventResolver is OneProtoEventResolver {
|
|||
OneInchData memory oneInchData,
|
||||
uint256 setId
|
||||
) internal {
|
||||
bytes32 _eventCode;
|
||||
bytes memory _eventParam;
|
||||
emit LogSellThree(
|
||||
address(oneInchData.buyToken),
|
||||
address(oneInchData.sellToken),
|
||||
|
@ -397,16 +358,6 @@ abstract contract OneInchEventResolver is OneProtoEventResolver {
|
|||
0,
|
||||
setId
|
||||
);
|
||||
_eventCode = keccak256("LogSellThree(address,address,uint256,uint256,uint256,uint256)");
|
||||
_eventParam = abi.encode(
|
||||
address(oneInchData.buyToken),
|
||||
address(oneInchData.sellToken),
|
||||
oneInchData._buyAmt,
|
||||
oneInchData._sellAmt,
|
||||
0,
|
||||
setId
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,6 +586,4 @@ abstract contract OneInch is OneProto {
|
|||
|
||||
contract ConnectOne is OneInch {
|
||||
string public name = "1inch-1proto-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -206,6 +206,4 @@ abstract contract BasicResolver is AaveHelpers {
|
|||
|
||||
contract ConnectAave is BasicResolver {
|
||||
string public name = "Aave-v1.1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -263,6 +263,4 @@ abstract contract BasicResolver is AaveHelpers {
|
|||
|
||||
contract ConnectAaveV2 is BasicResolver {
|
||||
string public name = "AaveV2-v1.1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -42,10 +42,6 @@ abstract contract BasicResolver is Stores {
|
|||
setUint(setId, amt);
|
||||
|
||||
emit LogDeposit(erc20, amt, getId, setId);
|
||||
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(erc20, amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,16 +72,10 @@ abstract contract BasicResolver is Stores {
|
|||
setUint(setId, amt);
|
||||
|
||||
emit LogWithdraw(erc20, amt, to, getId, setId);
|
||||
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,address,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(erc20, amt, to, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract ConnectBasic is BasicResolver {
|
||||
string public constant name = "Basic-v1.1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -121,10 +121,6 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,9 +162,6 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, mintAmt);
|
||||
|
||||
emit LogDeposit(token, _amt, mintAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, mintAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,15 +209,10 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogWithdraw(token, _amt, _curveAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, _curveAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contract ConnectCurve is CurveProtocol {
|
||||
string public name = "Curve-susd-v1.2";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -96,15 +96,9 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectCurveThreePool is CurveProtocol {
|
||||
string public name = "Curve-3pool-v1.0";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
|
@ -76,16 +76,10 @@ abstract contract CurveGaugeEvent is GaugeHelper {
|
|||
|
||||
function emitLogWithdraw(string memory gaugePoolName, uint _amt, uint getId, uint setId) internal {
|
||||
emit LogWithdraw(gaugePoolName, _amt, getId, setId);
|
||||
bytes32 _eventCodeWithdraw = keccak256("LogWithdraw(string,uint256,uint256,uint256)");
|
||||
bytes memory _eventParamWithdraw = abi.encode(gaugePoolName, _amt, getId, setId);
|
||||
emitEvent(_eventCodeWithdraw, _eventParamWithdraw);
|
||||
}
|
||||
|
||||
function emitLogClaimedReward(string memory gaugePoolName, uint crvAmt, uint rewardAmt, uint setIdCrv, uint setIdReward) internal {
|
||||
emit LogClaimedReward(gaugePoolName, crvAmt, rewardAmt, setIdCrv, setIdReward);
|
||||
bytes32 _eventCode = keccak256("LogClaimedReward(string,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(gaugePoolName, crvAmt, rewardAmt, setIdCrv, setIdReward);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,9 +123,6 @@ abstract contract CurveGauge is CurveGaugeEvent {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogDeposit(gaugePoolName, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(string,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(gaugePoolName, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,7 +228,5 @@ abstract contract CurveGauge is CurveGaugeEvent {
|
|||
|
||||
contract ConnectCurveGauge is CurveGauge {
|
||||
string public name = "Curve-Gauge-v1.0";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { Stores } from "../common/stores.sol";
|
||||
|
@ -45,15 +45,10 @@ abstract contract CurveVestingProtocol is CurveVestingHelpers {
|
|||
setUint(setId, claimedAmt);
|
||||
|
||||
emit LogClaim(address(this), claimedAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogClaim(address,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(address(this), claimedAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectCurveVesting is CurveVestingProtocol {
|
||||
string public name = "Curve-vesting-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { Stores } from "../common/stores.sol";
|
||||
|
@ -103,9 +103,6 @@ abstract contract CurveSBTCProtocol is CurveSBTCHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,9 +144,6 @@ abstract contract CurveSBTCProtocol is CurveSBTCHelpers {
|
|||
setUint(setId, mintAmt);
|
||||
|
||||
emit LogDeposit(token, _amt, mintAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, mintAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -195,15 +189,10 @@ abstract contract CurveSBTCProtocol is CurveSBTCHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogWithdraw(token, _amt, _curveAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, _curveAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectSBTCCurve is CurveSBTCProtocol {
|
||||
string public name = "Curve-sbtc-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -138,9 +138,6 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
|
||||
}
|
||||
|
||||
|
@ -183,9 +180,6 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, mintAmt);
|
||||
|
||||
emit LogDeposit(token, _amt, mintAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, mintAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,15 +227,10 @@ abstract contract CurveProtocol is CurveHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogWithdraw(token, _amt, _curveAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, _curveAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contract ConnectCurveY is CurveProtocol {
|
||||
string public name = "Curve-y-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -179,9 +179,6 @@ abstract contract BasicResolver is DydxHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogDeposit(token, _marketId, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _marketId, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,9 +211,6 @@ abstract contract BasicResolver is DydxHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogWithdraw(token, _marketId, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _marketId, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,9 +240,6 @@ abstract contract BasicResolver is DydxHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogBorrow(token, _marketId, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogBorrow(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _marketId, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,15 +276,10 @@ abstract contract BasicResolver is DydxHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogPayback(token, _marketId, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogPayback(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _marketId, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract ConnectDydx is BasicResolver {
|
||||
string public name = "Dydx-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
|
||||
interface AccountInterface {
|
||||
|
@ -43,10 +43,6 @@ abstract contract FlashLoanResolver is Stores {
|
|||
AccountInterface(address(this)).disable(getDydxLoanAddr());
|
||||
|
||||
emit LogDydxFlashLoan(token, tokenAmt);
|
||||
bytes32 _eventCode = keccak256("LogDydxFlashLoan(address,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, tokenAmt);
|
||||
(uint _type, uint _id) = connectorID();
|
||||
EventInterface(getEventAddr()).emitEvent(_type, _id, _eventCode, _eventParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +50,4 @@ abstract contract FlashLoanResolver is Stores {
|
|||
|
||||
contract ConnectDydxFlashLoan is FlashLoanResolver {
|
||||
string public constant name = "dydx-flashloan-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import { DSMath } from '../common/math.sol';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -94,15 +94,10 @@ abstract contract KyberResolver is KyberHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory eventData = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(eventCode, eventData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract ConnectKyber is KyberResolver {
|
||||
string public name = "Kyber-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -25,15 +25,10 @@ abstract contract MockProtocol is Stores, DSMath {
|
|||
|
||||
// common event standard
|
||||
emit LogMock(mockNumber, mockBalance, getId, setId);
|
||||
bytes32 eventCode = keccak256("LogMock(uint256,uint256,uint256,uint256)");
|
||||
bytes memory eventData = abi.encode(mockNumber, mockBalance, getId, setId);
|
||||
emitEvent(eventCode, eventData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contract ConnectMock is MockProtocol {
|
||||
string public name = "Mock-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
// import files from common directory
|
||||
|
@ -111,9 +111,6 @@ abstract contract Staking is StakingHelper {
|
|||
|
||||
setUint(setId, _amt);
|
||||
emit LogDeposit(address(stakingToken), stakingType, _amt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,bytes32,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(address(stakingToken), stakingType, _amt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +148,8 @@ abstract contract Staking is StakingHelper {
|
|||
setUint(setIdReward, rewardAmt);
|
||||
|
||||
emit LogWithdraw(address(stakingToken), stakingType, _amt, getId, setIdAmount);
|
||||
bytes32 _eventCodeWithdraw = keccak256("LogWithdraw(address,bytes32,uint256,uint256,uint256)");
|
||||
bytes memory _eventParamWithdraw = abi.encode(address(stakingToken), stakingType, _amt, getId, setIdAmount);
|
||||
emitEvent(_eventCodeWithdraw, _eventParamWithdraw);
|
||||
|
||||
emit LogClaimedReward(address(rewardToken), stakingType, rewardAmt, setIdReward);
|
||||
bytes32 _eventCodeReward = keccak256("LogClaimedReward(address,bytes32,uint256,uint256)");
|
||||
bytes memory _eventParamReward = abi.encode(address(rewardToken), stakingType, rewardAmt, setIdReward);
|
||||
emitEvent(_eventCodeReward, _eventParamReward);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,14 +176,9 @@ abstract contract Staking is StakingHelper {
|
|||
|
||||
setUint(setId, rewardAmt);
|
||||
emit LogClaimedReward(address(rewardToken), stakingType, rewardAmt, setId);
|
||||
bytes32 _eventCode = keccak256("LogClaimedReward(address,bytes32,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(address(rewardToken), stakingType, rewardAmt, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectStaking is Staking {
|
||||
string public name = "Staking-v1.1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -116,9 +116,6 @@ abstract contract SwerveProtocol is SwerveHelpers {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
|
||||
}
|
||||
|
||||
|
@ -161,9 +158,6 @@ abstract contract SwerveProtocol is SwerveHelpers {
|
|||
setUint(setId, mintAmt);
|
||||
|
||||
emit LogDeposit(token, _amt, mintAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, mintAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,15 +205,10 @@ abstract contract SwerveProtocol is SwerveHelpers {
|
|||
setUint(setId, _amt);
|
||||
|
||||
emit LogWithdraw(token, _amt, _swerveAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(token, _amt, _swerveAmt, getId, setId);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contract ConnectSwerve is SwerveProtocol {
|
||||
string public name = "Swerve-swUSD-v1.0";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.6.0;
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
// import files from common directory
|
||||
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
|
||||
import { Stores } from "../common/stores.sol";
|
||||
import { DSMath } from "../common/math.sol";
|
||||
|
||||
|
@ -194,7 +194,7 @@ abstract contract LiquidityHelpers is UniswapHelpers {
|
|||
minAmtA,
|
||||
minAmtB,
|
||||
address(this),
|
||||
now + 1
|
||||
block.timestamp + 1
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ abstract contract LiquidityHelpers is UniswapHelpers {
|
|||
minAmtA,
|
||||
minAmtB,
|
||||
address(this),
|
||||
now + 1
|
||||
block.timestamp + 1
|
||||
);
|
||||
}
|
||||
convertWethToEth(_tokenA, _amtA);
|
||||
|
@ -285,18 +285,6 @@ abstract contract UniswapLiquidity is LiquidityHelpers {
|
|||
getId,
|
||||
setId
|
||||
);
|
||||
|
||||
bytes32 _eventCode = keccak256("LogDepositLiquidity(address,address,uint256,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(
|
||||
tokenA,
|
||||
tokenB,
|
||||
_amtA,
|
||||
_amtB,
|
||||
_uniAmt,
|
||||
getId,
|
||||
setId
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
function emitWithdraw(
|
||||
|
@ -317,17 +305,6 @@ abstract contract UniswapLiquidity is LiquidityHelpers {
|
|||
getId,
|
||||
setIds
|
||||
);
|
||||
bytes32 _eventCode = keccak256("LogWithdrawLiquidity(address,address,uint256,uint256,uint256,uint256,uint256[])");
|
||||
bytes memory _eventParam = abi.encode(
|
||||
tokenA,
|
||||
tokenB,
|
||||
_amtA,
|
||||
_amtB,
|
||||
_uniAmt,
|
||||
getId,
|
||||
setIds
|
||||
);
|
||||
emitEvent(_eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,7 +431,7 @@ abstract contract UniswapResolver is UniswapLiquidity {
|
|||
_expectedAmt,
|
||||
paths,
|
||||
address(this),
|
||||
now + 1
|
||||
block.timestamp + 1
|
||||
)[0];
|
||||
|
||||
convertWethToEth(_buyAddr, _buyAmt);
|
||||
|
@ -462,10 +439,6 @@ abstract contract UniswapResolver is UniswapLiquidity {
|
|||
setUint(setId, _sellAmt);
|
||||
|
||||
emit LogBuy(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogBuy(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
(uint _type, uint _id) = connectorID();
|
||||
EventInterface(getEventAddr()).emitEvent(_type, _id, _eventCode, _eventParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,7 +483,7 @@ abstract contract UniswapResolver is UniswapLiquidity {
|
|||
_expectedAmt,
|
||||
paths,
|
||||
address(this),
|
||||
now + 1
|
||||
block.timestamp + 1
|
||||
)[1];
|
||||
|
||||
convertWethToEth(_buyAddr, _buyAmt);
|
||||
|
@ -518,16 +491,10 @@ abstract contract UniswapResolver is UniswapLiquidity {
|
|||
setUint(setId, _buyAmt);
|
||||
|
||||
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||
(uint _type, uint _id) = connectorID();
|
||||
EventInterface(getEventAddr()).emitEvent(_type, _id, _eventCode, _eventParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract ConnectUniswapV2 is UniswapResolver {
|
||||
string public name = "UniswapV2-v1";
|
||||
|
||||
constructor(uint256 _id) Stores(_id) public {}
|
||||
}
|
16608
package-lock.json
generated
16608
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/InstaDApp/dsa-connectors-new#readme",
|
||||
"dependencies": {
|
||||
"@openzeppelin/contracts": "^3.0.1",
|
||||
"@openzeppelin/contracts": "^3.4.0-solc-0.7",
|
||||
"@openzeppelin/upgrades": "^2.8.0",
|
||||
"@truffle/artifactor": "^4.0.45",
|
||||
"chalk": "^4.0.0",
|
||||
|
|
Loading…
Reference in New Issue
Block a user