Improvements

This commit is contained in:
Mubaris NK 2021-03-15 18:26:34 +05:30
parent 155a8d6e0e
commit 7a9fc83a5f
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561
13 changed files with 25 additions and 88 deletions

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -1,5 +0,0 @@
pragma solidity ^0.7.0;
contract Events {
event LogDydxFlashLoan(address indexed token, uint256 tokenAmt);
}

View File

@ -1,5 +0,0 @@
pragma solidity ^0.7.0;
interface DydxFlashInterface {
function initiateFlashLoan(address _token, uint256 _amount, bytes calldata data) external;
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -273,5 +273,5 @@ contract LiquidityAccessMulti is LiquidityAccess {
}
contract ConnectV2InstaPool is LiquidityAccessMulti {
string public name = "InstaPool-v2.1";
string public name = "InstaPool-v2";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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()