From 7a9fc83a5fce6d2e673720673f25820250b384ab Mon Sep 17 00:00:00 2001 From: Mubaris NK Date: Mon, 15 Mar 2021 18:26:34 +0530 Subject: [PATCH] Improvements --- contracts/connectors/aave/v1/main.sol | 2 +- contracts/connectors/aave/v2/main.sol | 2 +- contracts/connectors/basic/main.sol | 2 +- contracts/connectors/compound/main.sol | 2 +- contracts/connectors/dydxFlash/events.sol | 5 --- contracts/connectors/dydxFlash/interface.sol | 5 --- contracts/connectors/dydxFlash/main.sol | 38 ---------------- contracts/connectors/gelato/main.sol | 2 +- contracts/connectors/instapool/main.sol | 2 +- contracts/connectors/kyber/main.sol | 2 +- contracts/connectors/makerdao/main.sol | 2 +- contracts/connectors/oasis/main.sol | 2 +- scripts/deploy.js | 47 +++++++------------- 13 files changed, 25 insertions(+), 88 deletions(-) delete mode 100644 contracts/connectors/dydxFlash/events.sol delete mode 100644 contracts/connectors/dydxFlash/interface.sol delete mode 100644 contracts/connectors/dydxFlash/main.sol diff --git a/contracts/connectors/aave/v1/main.sol b/contracts/connectors/aave/v1/main.sol index 76b83564..d0377747 100644 --- a/contracts/connectors/aave/v1/main.sol +++ b/contracts/connectors/aave/v1/main.sol @@ -155,5 +155,5 @@ abstract contract AaveResolver is Events, Helpers { } contract ConnectV2AaveV1 is AaveResolver { - string public name = "Aave-v1.1"; + string public name = "AaveV1-v1"; } diff --git a/contracts/connectors/aave/v2/main.sol b/contracts/connectors/aave/v2/main.sol index 16cc0dcd..1c00b606 100644 --- a/contracts/connectors/aave/v2/main.sol +++ b/contracts/connectors/aave/v2/main.sol @@ -179,5 +179,5 @@ abstract contract AaveResolver is Events, Helpers { } contract ConnectV2AaveV2 is AaveResolver { - string public name = "AaveV2-v1.1"; + string public name = "AaveV2-v1"; } diff --git a/contracts/connectors/basic/main.sol b/contracts/connectors/basic/main.sol index 4d59beac..e9f5edd8 100644 --- a/contracts/connectors/basic/main.sol +++ b/contracts/connectors/basic/main.sol @@ -70,5 +70,5 @@ abstract contract BasicResolver is Events, DSMath, Basic { } contract ConnectV2Basic is BasicResolver { - string public constant name = "Basic-v1.1"; + string public constant name = "Basic-v1"; } diff --git a/contracts/connectors/compound/main.sol b/contracts/connectors/compound/main.sol index 2a60c3b7..b47843f3 100644 --- a/contracts/connectors/compound/main.sol +++ b/contracts/connectors/compound/main.sol @@ -246,5 +246,5 @@ abstract contract CompoundResolver is Events, Helpers { } contract ConnectV2Compound is CompoundResolver { - string public name = "Compound-v1.3"; + string public name = "Compound-v1"; } diff --git a/contracts/connectors/dydxFlash/events.sol b/contracts/connectors/dydxFlash/events.sol deleted file mode 100644 index 2b646778..00000000 --- a/contracts/connectors/dydxFlash/events.sol +++ /dev/null @@ -1,5 +0,0 @@ -pragma solidity ^0.7.0; - -contract Events { - event LogDydxFlashLoan(address indexed token, uint256 tokenAmt); -} diff --git a/contracts/connectors/dydxFlash/interface.sol b/contracts/connectors/dydxFlash/interface.sol deleted file mode 100644 index a67a958d..00000000 --- a/contracts/connectors/dydxFlash/interface.sol +++ /dev/null @@ -1,5 +0,0 @@ -pragma solidity ^0.7.0; - -interface DydxFlashInterface { - function initiateFlashLoan(address _token, uint256 _amount, bytes calldata data) external; -} diff --git a/contracts/connectors/dydxFlash/main.sol b/contracts/connectors/dydxFlash/main.sol deleted file mode 100644 index 40c6df53..00000000 --- a/contracts/connectors/dydxFlash/main.sol +++ /dev/null @@ -1,38 +0,0 @@ -pragma solidity ^0.7.0; - -import { DSMath } from "../../common/math.sol"; -import { Basic } from "../../common/basic.sol"; -import { TokenInterface, AccountInterface } from "../../common/interfaces.sol"; -import { Events } from "./events.sol"; -import { DydxFlashInterface } from "./interface.sol"; - -abstract contract FlashLoanResolver is DSMath, Basic, Events { - address internal constant dydxAddr = address(0); // check9898 - change to dydx flash contract address - - /** - * @dev Borrow Flashloan and Cast spells. - * @param token Token Address. - * @param tokenAmt Token Amount. - * @param data targets & data for cast. - */ - function borrowAndCast( - address token, - uint tokenAmt, - bytes memory data - ) public payable returns (string memory _eventName, bytes memory _eventParam) { - AccountInterface(address(this)).enable(dydxAddr); - - address _token = token == ethAddr ? wethAddr : token; - - DydxFlashInterface(dydxAddr).initiateFlashLoan(_token, tokenAmt, data); - - AccountInterface(address(this)).disable(dydxAddr); - - _eventName = "LogDydxFlashLoan(address,uint256)"; - _eventParam = abi.encode(token, tokenAmt); - } -} - -contract ConnectV2DydxFlashLoan is FlashLoanResolver { - string public constant name = "dydx-flashloan-v1"; -} diff --git a/contracts/connectors/gelato/main.sol b/contracts/connectors/gelato/main.sol index 3ed7c4f0..aebc48a2 100644 --- a/contracts/connectors/gelato/main.sol +++ b/contracts/connectors/gelato/main.sol @@ -163,5 +163,5 @@ abstract contract GelatoResolver is DSMath, Basic, Events { } contract ConnectV2Gelato is GelatoResolver { - string public name = "Gelato-v1.0"; + string public name = "Gelato-v1"; } diff --git a/contracts/connectors/instapool/main.sol b/contracts/connectors/instapool/main.sol index 2b4d921e..9f0504bc 100644 --- a/contracts/connectors/instapool/main.sol +++ b/contracts/connectors/instapool/main.sol @@ -273,5 +273,5 @@ contract LiquidityAccessMulti is LiquidityAccess { } contract ConnectV2InstaPool is LiquidityAccessMulti { - string public name = "InstaPool-v2.1"; + string public name = "InstaPool-v2"; } diff --git a/contracts/connectors/kyber/main.sol b/contracts/connectors/kyber/main.sol index 0d6b5b88..eb90ac80 100644 --- a/contracts/connectors/kyber/main.sol +++ b/contracts/connectors/kyber/main.sol @@ -52,5 +52,5 @@ abstract contract KyberResolver is Helpers, Events { } contract ConnectV2Kyber is KyberResolver { - string public name = "Kyber-v2.1"; + string public name = "Kyber-v2"; } \ No newline at end of file diff --git a/contracts/connectors/makerdao/main.sol b/contracts/connectors/makerdao/main.sol index 5f88c6be..394a6462 100644 --- a/contracts/connectors/makerdao/main.sol +++ b/contracts/connectors/makerdao/main.sol @@ -484,5 +484,5 @@ abstract contract MakerResolver is Helpers, Events { } contract ConnectV2Maker is MakerResolver { - string public constant name = "MakerDao-v1.4"; + string public constant name = "MakerDao-v1"; } diff --git a/contracts/connectors/oasis/main.sol b/contracts/connectors/oasis/main.sol index cd2905ce..311bdc08 100644 --- a/contracts/connectors/oasis/main.sol +++ b/contracts/connectors/oasis/main.sol @@ -118,5 +118,5 @@ contract OasisResolver is DSMath, Basic, Events { } contract ConnectV2Oasis is OasisResolver { - string public name = "Oasis-v1.1"; + string public name = "Oasis-v1"; } diff --git a/scripts/deploy.js b/scripts/deploy.js index 1e721c31..bdcce559 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -4,39 +4,24 @@ const { ethers } = hre; const deployConnector = require("./deployConnector"); async function main() { + const connectors = [ + 'ConnectV2OneInch', + 'ConnectV2AaveV1', + 'ConnectV2AaveV2', + 'ConnectV2Auth', + 'ConnectV2Basic', + 'ConnectV2COMP', + 'ConnectV2Compound', + 'ConnectV2Dydx', + 'ConnectV2Fee', + 'ConnectV2Gelato', + 'ConnectV2Maker', + 'ConnectV2UniswapV2' + ] - const accounts = await hre.ethers.getSigners() - const wallet = accounts[0] - - const connectMapping = { - '1inch': 'ConnectV2OneInch', - 'aaveV1': 'ConnectV2AaveV1', - // 'aaveV2': 'ConnectV2AaveV2', - // 'auth': 'ConnectV2Auth', - // 'basic': 'ConnectV2Basic', - // 'comp': 'ConnectV2COMP', - // 'compound': 'ConnectV2Compound', - // 'dydx': 'ConnectV2Dydx', - // 'fee': 'ConnectV2Fee', - // 'gelato': 'ConnectV2Gelato', - // 'maker': 'ConnectV2Maker', - // 'uniswap': 'ConnectV2UniswapV2' + for (const connector of connectors) { + await deployConnector(connector) } - - const addressMapping = {} - - for (const key in connectMapping) { - addressMapping[key] = await deployConnector(connectMapping[key]) - } - - // const connectorsAbi = [ - // "function addConnectors(string[] _connectorNames, address[] _connectors)" - // ] - - // // Replace the address with correct v2 connectors registry address - // const connectorsContract = new ethers.Contract("0x84b457c6D31025d56449D5A01F0c34bF78636f67", connectorsAbi, wallet) - - // await connectorsContract.addConnectors(Object.keys(addressMapping), Object.values(addressMapping)) } main()