mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Improvements
This commit is contained in:
parent
155a8d6e0e
commit
7a9fc83a5f
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
contract Events {
|
||||
event LogDydxFlashLoan(address indexed token, uint256 tokenAmt);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
interface DydxFlashInterface {
|
||||
function initiateFlashLoan(address _token, uint256 _amount, bytes calldata data) external;
|
||||
}
|
|
@ -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";
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -273,5 +273,5 @@ contract LiquidityAccessMulti is LiquidityAccess {
|
|||
}
|
||||
|
||||
contract ConnectV2InstaPool is LiquidityAccessMulti {
|
||||
string public name = "InstaPool-v2.1";
|
||||
string public name = "InstaPool-v2";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user