mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Test for a larger position
This commit is contained in:
parent
1fe6ef75c4
commit
2ab7323d8b
|
@ -136,7 +136,6 @@ contract MigrateResolver is LiquidityResolver {
|
|||
}
|
||||
|
||||
(uint[] memory stableBorrows, uint[] memory variableBorrows, uint[] memory totalBorrows) = _PaybackCalculate(aave, _data, sourceDsa);
|
||||
|
||||
_PaybackStable(_data.borrowTokens.length, aave, _data.borrowTokens, stableBorrows, sourceDsa);
|
||||
_PaybackVariable(_data.borrowTokens.length, aave, _data.borrowTokens, variableBorrows, sourceDsa);
|
||||
|
||||
|
|
|
@ -23,20 +23,20 @@ module.exports = {
|
|||
forkNetwork: "1"
|
||||
},
|
||||
networks: {
|
||||
// hardhat: { // mainnet forking
|
||||
// forking: {
|
||||
// url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
// blockNumber: 12240294,
|
||||
// },
|
||||
// blockGasLimit: 12000000,
|
||||
// },
|
||||
hardhat: { // matic forking
|
||||
hardhat: { // mainnet forking
|
||||
forking: {
|
||||
url: `https://cold-red-river.matic.quiknode.pro/${QUIKNODE_ID}/`,
|
||||
blockNumber: 13317966,
|
||||
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
blockNumber: 12240294,
|
||||
},
|
||||
blockGasLimit: 12000000,
|
||||
},
|
||||
// hardhat: { // matic forking
|
||||
// forking: {
|
||||
// url: `https://cold-red-river.matic.quiknode.pro/${QUIKNODE_ID}/`,
|
||||
// blockNumber: 13317966,
|
||||
// },
|
||||
// blockGasLimit: 12000000,
|
||||
// },
|
||||
kovan: {
|
||||
url: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
accounts: [`0x${PRIVATE_KEY}`]
|
||||
|
|
|
@ -28,10 +28,11 @@ describe("Migrator", function() {
|
|||
const weth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
|
||||
|
||||
const aweth = '0x030ba81f1c18d280636f32af80b9aad02cf0854e'
|
||||
const aaave = '0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B'
|
||||
|
||||
const maxValue = '115792089237316195423570985008687907853269984665640564039457584007913129639935'
|
||||
|
||||
const supportedTokens = [usdc, usdt, dai, wbtc, aave, eth, weth]
|
||||
const supportedTokens = [usdc, usdt, dai, wbtc, aave, weth]
|
||||
|
||||
before(async function() {
|
||||
masterAddress = "0xb1DC62EC38E6E3857a887210C38418E4A17Da5B2"
|
||||
|
@ -170,4 +171,56 @@ describe("Migrator", function() {
|
|||
|
||||
// console.log(receipt)
|
||||
})
|
||||
|
||||
it("test migrate 2", async function() {
|
||||
const sourceAddr = '0x6126f2a1bd956630f810d5ea351c5a4d65cb5033'
|
||||
|
||||
const rawData = {
|
||||
targetDsa: sourceAddr,
|
||||
supplyTokens: [weth, aave],
|
||||
borrowTokens: [usdc, usdt, dai],
|
||||
supplyAmts: [ethers.utils.parseEther('100'), ethers.utils.parseEther('80')],
|
||||
variableBorrowAmts: [0, 0, ethers.utils.parseUnits('20000', 18)],
|
||||
stableBorrowAmts: [ethers.utils.parseUnits('20000', 6), ethers.utils.parseUnits('20000', 6), ethers.utils.parseUnits('20000', 18)]
|
||||
}
|
||||
|
||||
await hre.network.provider.request({
|
||||
method: "hardhat_impersonateAccount",
|
||||
params: [ sourceAddr ]
|
||||
})
|
||||
const signer = ethers.provider.getSigner(sourceAddr)
|
||||
|
||||
const awethContract = new ethers.Contract(aweth, erc20Abi, signer)
|
||||
await awethContract.approve(migrator.address, maxValue)
|
||||
const aaaveContract = new ethers.Contract(aaave, erc20Abi, signer)
|
||||
await aaaveContract.approve(migrator.address, maxValue)
|
||||
|
||||
const tx = await migrator.connect(signer).migrateWithFlash(rawData, ethers.utils.parseEther('150'))
|
||||
const receipt = await tx.wait()
|
||||
})
|
||||
|
||||
it("test migrate 3", async function() {
|
||||
const sourceAddr = '0x37e5df37885a6d0b43bee9ec2997b1e0037fb490'
|
||||
|
||||
const rawData = {
|
||||
targetDsa: sourceAddr,
|
||||
supplyTokens: [weth],
|
||||
borrowTokens: [usdc, usdt],
|
||||
supplyAmts: [ethers.utils.parseEther('1000')],
|
||||
variableBorrowAmts: [ethers.utils.parseUnits('20000', 6), ethers.utils.parseUnits('40000', 6)],
|
||||
stableBorrowAmts: [ethers.utils.parseUnits('40000', 6), 0]
|
||||
}
|
||||
|
||||
await hre.network.provider.request({
|
||||
method: "hardhat_impersonateAccount",
|
||||
params: [ sourceAddr ]
|
||||
})
|
||||
const signer = ethers.provider.getSigner(sourceAddr)
|
||||
|
||||
const awethContract = new ethers.Contract(aweth, erc20Abi, signer)
|
||||
await awethContract.approve(migrator.address, maxValue)
|
||||
|
||||
const tx = await migrator.connect(signer).migrateWithFlash(rawData, ethers.utils.parseEther('1200'))
|
||||
const receipt = await tx.wait()
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user