mirror of
https://github.com/Instadapp/dsa-connectors-2.0.git
synced 2024-07-29 21:57:39 +00:00
feat: wip
This commit is contained in:
parent
49e73b0601
commit
9354b585c7
|
@ -19,7 +19,7 @@ abstract contract Helpers is Stores, Basic {
|
|||
using SharesMathLib for uint256;
|
||||
|
||||
IMorpho public constant MORPHO_BLUE =
|
||||
IMorpho(0x777777c9898D384F785Ee44Acfe945efDFf5f3E0); // TODO: Update
|
||||
IMorpho(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);
|
||||
|
||||
uint256 internal constant MARKET_PARAMS_BYTES_LENGTH = 5 * 32;
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ConnectorsInterface",
|
||||
"sourceName": "contracts/v2/accounts/Implementation_m1.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "connectorNames",
|
||||
"type": "string[]"
|
||||
}
|
||||
],
|
||||
"name": "isConnectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
40
deployements/mainnet/Implementation_m1.sol/Constants.json
Normal file
40
deployements/mainnet/Implementation_m1.sol/Constants.json
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "Constants",
|
||||
"sourceName": "contracts/v2/accounts/Implementation_m1.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_instaIndex",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_connectors",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorsM1",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x60c060405234801561001057600080fd5b50604051610259380380610259833981810160405281019061003291906100bc565b8073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250505050610141565b6000815190506100b68161012a565b92915050565b600080604083850312156100cf57600080fd5b60006100dd858286016100a7565b92505060206100ee858286016100a7565b9150509250929050565b60006101038261010a565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b610133816100f8565b811461013e57600080fd5b50565b60805160601c60a05160601c60f761016260003980604952505060f76000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80636254a08f14602d575b600080fd5b60336047565b604051603e91906078565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6072816091565b82525050565b6000602082019050608b6000830184606b565b92915050565b6000609a8260a1565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea2646970667358221220699279b70fa8da43ab7a9539e71580df4db8693687d48ed183b46ebe8dd7ae4064736f6c63430007000033",
|
||||
"deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80636254a08f14602d575b600080fd5b60336047565b604051603e91906078565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6072816091565b82525050565b6000602082019050608b6000830184606b565b92915050565b6000609a8260a1565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea2646970667358221220699279b70fa8da43ab7a9539e71580df4db8693687d48ed183b46ebe8dd7ae4064736f6c63430007000033",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/AccountInterface.dbg.json
Normal file
4
deployements/mainnet/index.sol/AccountInterface.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
66
deployements/mainnet/index.sol/AccountInterface.json
Normal file
66
deployements/mainnet/index.sol/AccountInterface.json
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "AccountInterface",
|
||||
"sourceName": "contracts/registry/index.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_targets",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes[]",
|
||||
"name": "_datas",
|
||||
"type": "bytes[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_origin",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "cast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32[]",
|
||||
"name": "responses",
|
||||
"type": "bytes32[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "enable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
4
deployements/mainnet/index.sol/AddressIndex.dbg.json
Normal file
4
deployements/mainnet/index.sol/AddressIndex.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
238
deployements/mainnet/index.sol/AddressIndex.json
Normal file
238
deployements/mainnet/index.sol/AddressIndex.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/CloneFactory.dbg.json
Normal file
4
deployements/mainnet/index.sol/CloneFactory.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
262
deployements/mainnet/index.sol/CloneFactory.json
Normal file
262
deployements/mainnet/index.sol/CloneFactory.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/InstaIndex.dbg.json
Normal file
4
deployements/mainnet/index.sol/InstaIndex.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
389
deployements/mainnet/index.sol/InstaIndex.json
Normal file
389
deployements/mainnet/index.sol/InstaIndex.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/ListInterface.dbg.json
Normal file
4
deployements/mainnet/index.sol/ListInterface.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
24
deployements/mainnet/index.sol/ListInterface.json
Normal file
24
deployements/mainnet/index.sol/ListInterface.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ListInterface",
|
||||
"sourceName": "contracts/registry/index.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "init",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
// import "@nomiclabs/hardhat-ethers";
|
||||
// import "@nomiclabs/hardhat-etherscan";
|
||||
import "@nomicfoundation/hardhat-toolbox";
|
||||
import "@nomiclabs/hardhat-web3";
|
||||
|
||||
import "@typechain/hardhat";
|
||||
import { resolve } from "path";
|
||||
|
|
4083
package-lock.json
generated
4083
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,8 @@
|
|||
"ts-node": "^10.9.2",
|
||||
"web3": "^1.10.3",
|
||||
"ethers": "^5.4.7",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.3"
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.3",
|
||||
"ethereum-waffle": "^4.0.10",
|
||||
"@nomiclabs/hardhat-waffle": "^2.0.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ import hre from "hardhat";
|
|||
import type { Signer, Contract } from "ethers";
|
||||
import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON";
|
||||
|
||||
const { ethers, waffle } = hre;
|
||||
const { deployContract } = waffle;
|
||||
const { ethers } = hre;
|
||||
import {deployContract} from 'ethereum-waffle';
|
||||
// const { deployContract } = waffle;
|
||||
|
||||
interface DeployInterface {
|
||||
connectorName: string;
|
||||
|
|
|
@ -188,6 +188,7 @@ describe("Morpho-Blue", function () {
|
|||
.cast(...encodeSpells(spells), wallet1.getAddress());
|
||||
|
||||
await tx.wait();
|
||||
// console.log('weth balance after borrowing1: ', await token_weth.connect(masterSigner).balanceOf(dsaWallet0.address))
|
||||
expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
|
||||
parseUnits('105', 18))
|
||||
);
|
||||
|
@ -202,6 +203,7 @@ describe("Morpho-Blue", function () {
|
|||
[ETH,WSTETH,oracle1,irm,lltv1],
|
||||
"5000000000000000000",
|
||||
dsaWallet0.address,
|
||||
dsaWallet0.address,
|
||||
"0",
|
||||
"0"
|
||||
], // 5 ETH
|
||||
|
@ -269,14 +271,16 @@ describe("Morpho-Blue", function () {
|
|||
);
|
||||
})
|
||||
|
||||
// TODO: Update below function
|
||||
it("Should repay 2 ETH shares on behalf", async function () {
|
||||
console.log('ethers balance before Repay shares on behalf: ', await ethers.provider.getBalance(dsaWallet0.address))
|
||||
const spells = [
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "repayOnBehalfShares",
|
||||
args: [
|
||||
[ETH,WSTETH,oracle1,irm,lltv1],
|
||||
"2000000000000000000",
|
||||
"10000000000000000000",
|
||||
dsaWallet0.address,
|
||||
"0",
|
||||
"0"
|
||||
|
@ -289,11 +293,14 @@ describe("Morpho-Blue", function () {
|
|||
.cast(...encodeSpells(spells), wallet1.getAddress());
|
||||
|
||||
await tx.wait();
|
||||
|
||||
console.log('ethers balance after: ', await ethers.provider.getBalance(dsaWallet0.address))
|
||||
expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
|
||||
parseUnits('106', 18))
|
||||
);
|
||||
})
|
||||
|
||||
// TODO: Update below function
|
||||
it("Should repay max ETH", async function () {
|
||||
const spells = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user