From bdca9bfe0deecac275e77e4c9be6c876b5027f2b Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 6 Nov 2024 02:52:30 -0600 Subject: [PATCH] fix: reopen radiant ethereum & base, remove arbitrum & bnb configs (#84) Co-authored-by: Bob Lu --- .changeset/violet-emus-yell.md | 5 ++++ src/logics/radiant-v2/configs.ts | 14 --------- src/logics/radiant-v2/logic.borrow.test.ts | 12 ++++---- src/logics/radiant-v2/logic.deposit.test.ts | 30 +++++++++---------- .../radiant-v2/logic.flash-loan.test.ts | 8 ++--- src/logics/radiant-v2/logic.repay.test.ts | 18 +++++------ src/logics/radiant-v2/logic.withdraw.test.ts | 30 +++++++++---------- src/logics/radiant-v2/service.test.ts | 24 +++++++-------- .../utility/logic.flash-loan-aggregator.ts | 2 ++ test/logics/radiant-v2/borrow.test.ts | 2 +- test/logics/radiant-v2/deposit.test.ts | 2 +- test/logics/radiant-v2/flash-loan.test.ts | 2 +- test/logics/radiant-v2/repay.test.ts | 2 +- test/logics/radiant-v2/withdraw.test.ts | 2 +- 14 files changed, 73 insertions(+), 80 deletions(-) create mode 100644 .changeset/violet-emus-yell.md diff --git a/.changeset/violet-emus-yell.md b/.changeset/violet-emus-yell.md new file mode 100644 index 00000000..38eac914 --- /dev/null +++ b/.changeset/violet-emus-yell.md @@ -0,0 +1,5 @@ +--- +'@protocolink/logics': patch +--- + +reopen radiant ethereum & base, remove arbitrum & bnb configs diff --git a/src/logics/radiant-v2/configs.ts b/src/logics/radiant-v2/configs.ts index f9aeebae..a5fa49e6 100644 --- a/src/logics/radiant-v2/configs.ts +++ b/src/logics/radiant-v2/configs.ts @@ -17,13 +17,6 @@ export const configs: Config[] = [ RadiantV2FlashLoanCallback: '0x6bfCE075A1c4F0fD4067A401dA8f159354e1a916', }, }, - { - chainId: common.ChainId.bnb, - contract: { - ProtocolDataProvider: '0x2f9D57E97C3DFED8676e605BC504a48E0c5917E9', - RadiantV2FlashLoanCallback: '0x6bfCE075A1c4F0fD4067A401dA8f159354e1a916', - }, - }, { chainId: common.ChainId.base, contract: { @@ -31,13 +24,6 @@ export const configs: Config[] = [ RadiantV2FlashLoanCallback: '0x6bfCE075A1c4F0fD4067A401dA8f159354e1a916', }, }, - { - chainId: common.ChainId.arbitrum, - contract: { - ProtocolDataProvider: '0x596B0cc4c5094507C50b579a662FE7e7b094A2cC', - RadiantV2FlashLoanCallback: '0x6bfCE075A1c4F0fD4067A401dA8f159354e1a916', - }, - }, ]; export const [supportedChainIds, configMap] = configs.reduce( diff --git a/src/logics/radiant-v2/logic.borrow.test.ts b/src/logics/radiant-v2/logic.borrow.test.ts index a6932b89..fd2149f9 100644 --- a/src/logics/radiant-v2/logic.borrow.test.ts +++ b/src/logics/radiant-v2/logic.borrow.test.ts @@ -3,13 +3,13 @@ import { InterestRateMode } from './types'; import { LendingPool__factory } from './contracts'; import { LogicTestCase } from 'test/types'; import { Service } from './service'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { constants, utils } from 'ethers'; import * as core from '@protocolink/core'; import { expect } from 'chai'; +import { mainnetTokens } from './tokens'; -describe.skip('RadiantV2 BorrowLogic', () => { +describe('RadiantV2 BorrowLogic', () => { context('Test getTokenList', async () => { BorrowLogic.supportedChainIds.forEach((chainId) => { it(`network: ${common.toNetworkId(chainId)}`, async () => { @@ -21,7 +21,7 @@ describe.skip('RadiantV2 BorrowLogic', () => { }); context('Test build', () => { - const chainId = common.ChainId.arbitrum; + const chainId = common.ChainId.mainnet; const logic = new BorrowLogic(chainId); let lendingPoolAddress: string; const iface = LendingPool__factory.createInterface(); @@ -35,19 +35,19 @@ describe.skip('RadiantV2 BorrowLogic', () => { const testCases: LogicTestCase[] = [ { fields: { - output: new common.TokenAmount(arbitrumTokens.ETH, '1'), + output: new common.TokenAmount(mainnetTokens.ETH, '1'), interestRateMode: InterestRateMode.variable, }, }, { fields: { - output: new common.TokenAmount(arbitrumTokens.WETH, '1'), + output: new common.TokenAmount(mainnetTokens.WETH, '1'), interestRateMode: InterestRateMode.variable, }, }, { fields: { - output: new common.TokenAmount(arbitrumTokens.USDC, '1'), + output: new common.TokenAmount(mainnetTokens.USDC, '1'), interestRateMode: InterestRateMode.variable, }, }, diff --git a/src/logics/radiant-v2/logic.deposit.test.ts b/src/logics/radiant-v2/logic.deposit.test.ts index 58ecdc99..75310c10 100644 --- a/src/logics/radiant-v2/logic.deposit.test.ts +++ b/src/logics/radiant-v2/logic.deposit.test.ts @@ -2,13 +2,13 @@ import { DepositLogic, DepositLogicFields } from './logic.deposit'; import { LendingPool__factory } from './contracts'; import { LogicTestCase } from 'test/types'; import { Service } from './service'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { constants, utils } from 'ethers'; import * as core from '@protocolink/core'; import { expect } from 'chai'; +import { mainnetTokens } from './tokens'; -describe.skip('RadiantV2 DepositLogic', () => { +describe('RadiantV2 DepositLogic', () => { context('Test getTokenList', async () => { DepositLogic.supportedChainIds.forEach((chainId) => { it(`network: ${common.toNetworkId(chainId)}`, async () => { @@ -20,7 +20,7 @@ describe.skip('RadiantV2 DepositLogic', () => { }); context('Test build', () => { - const chainId = common.ChainId.arbitrum; + const chainId = common.ChainId.mainnet; const logic = new DepositLogic(chainId); let lendingPoolAddress: string; const iface = LendingPool__factory.createInterface(); @@ -34,40 +34,40 @@ describe.skip('RadiantV2 DepositLogic', () => { const testCases: LogicTestCase[] = [ { fields: { - input: new common.TokenAmount(arbitrumTokens.ETH, '1'), - output: new common.TokenAmount(arbitrumTokens.rWETH, '1'), + input: new common.TokenAmount(mainnetTokens.ETH, '1'), + output: new common.TokenAmount(mainnetTokens.rWETH, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.WETH, '1'), - output: new common.TokenAmount(arbitrumTokens.rWETH, '1'), + input: new common.TokenAmount(mainnetTokens.WETH, '1'), + output: new common.TokenAmount(mainnetTokens.rWETH, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.USDC, '1'), - output: new common.TokenAmount(arbitrumTokens.rUSDC, '1'), + input: new common.TokenAmount(mainnetTokens.USDC, '1'), + output: new common.TokenAmount(mainnetTokens.rUSDC, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.ETH, '1'), - output: new common.TokenAmount(arbitrumTokens.rWETH, '1'), + input: new common.TokenAmount(mainnetTokens.ETH, '1'), + output: new common.TokenAmount(mainnetTokens.rWETH, '1'), balanceBps: 5000, }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.WETH, '1'), - output: new common.TokenAmount(arbitrumTokens.rWETH, '1'), + input: new common.TokenAmount(mainnetTokens.WETH, '1'), + output: new common.TokenAmount(mainnetTokens.rWETH, '1'), balanceBps: 5000, }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.USDC, '1'), - output: new common.TokenAmount(arbitrumTokens.rUSDC, '1'), + input: new common.TokenAmount(mainnetTokens.USDC, '1'), + output: new common.TokenAmount(mainnetTokens.rUSDC, '1'), balanceBps: 5000, }, }, diff --git a/src/logics/radiant-v2/logic.flash-loan.test.ts b/src/logics/radiant-v2/logic.flash-loan.test.ts index 5ecc6291..2d54d152 100644 --- a/src/logics/radiant-v2/logic.flash-loan.test.ts +++ b/src/logics/radiant-v2/logic.flash-loan.test.ts @@ -2,13 +2,13 @@ import { FlashLoanLogic, FlashLoanLogicFields } from './logic.flash-loan'; import { LendingPool__factory } from './contracts'; import { LogicTestCase } from 'test/types'; import { Service } from './service'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { constants, utils } from 'ethers'; import { expect } from 'chai'; import { getContractAddress } from './configs'; +import { mainnetTokens } from './tokens'; -describe.skip('RadiantV2 FlashLoanLogic', () => { +describe('RadiantV2 FlashLoanLogic', () => { context('Test getTokenList', async () => { FlashLoanLogic.supportedChainIds.forEach((chainId) => { it(`network: ${common.toNetworkId(chainId)}`, async () => { @@ -20,7 +20,7 @@ describe.skip('RadiantV2 FlashLoanLogic', () => { }); context('Test build', () => { - const chainId = common.ChainId.arbitrum; + const chainId = common.ChainId.mainnet; const logic = new FlashLoanLogic(chainId); let lendingPoolAddress: string; const iface = LendingPool__factory.createInterface(); @@ -33,7 +33,7 @@ describe.skip('RadiantV2 FlashLoanLogic', () => { const testCases: LogicTestCase[] = [ { fields: { - loans: new common.TokenAmounts([arbitrumTokens.WETH, '1'], [arbitrumTokens.USDC, '1']), + loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']), params: '0x', }, }, diff --git a/src/logics/radiant-v2/logic.repay.test.ts b/src/logics/radiant-v2/logic.repay.test.ts index ea5cfb45..489db9a8 100644 --- a/src/logics/radiant-v2/logic.repay.test.ts +++ b/src/logics/radiant-v2/logic.repay.test.ts @@ -3,13 +3,13 @@ import { LendingPool__factory } from './contracts'; import { LogicTestCase } from 'test/types'; import { RepayLogic, RepayLogicFields } from './logic.repay'; import { Service } from './service'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { constants, utils } from 'ethers'; import * as core from '@protocolink/core'; import { expect } from 'chai'; +import { mainnetTokens } from './tokens'; -describe.skip('RadiantV2 RepayLogic', () => { +describe('RadiantV2 RepayLogic', () => { context('Test getTokenList', async () => { RepayLogic.supportedChainIds.forEach((chainId) => { it(`network: ${common.toNetworkId(chainId)}`, async () => { @@ -21,7 +21,7 @@ describe.skip('RadiantV2 RepayLogic', () => { }); context('Test build', () => { - const chainId = common.ChainId.arbitrum; + const chainId = common.ChainId.mainnet; const logic = new RepayLogic(chainId); let lendingPoolAddress: string; const iface = LendingPool__factory.createInterface(); @@ -34,28 +34,28 @@ describe.skip('RadiantV2 RepayLogic', () => { const testCases: LogicTestCase[] = [ { fields: { - input: new common.TokenAmount(arbitrumTokens.ETH, '1'), + input: new common.TokenAmount(mainnetTokens.ETH, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.WETH, '1'), + input: new common.TokenAmount(mainnetTokens.WETH, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.USDC, '1'), + input: new common.TokenAmount(mainnetTokens.USDC, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.ETH, '1'), + input: new common.TokenAmount(mainnetTokens.ETH, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', balanceBps: 5000, @@ -63,7 +63,7 @@ describe.skip('RadiantV2 RepayLogic', () => { }, { fields: { - input: new common.TokenAmount(arbitrumTokens.WETH, '1'), + input: new common.TokenAmount(mainnetTokens.WETH, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', balanceBps: 5000, @@ -71,7 +71,7 @@ describe.skip('RadiantV2 RepayLogic', () => { }, { fields: { - input: new common.TokenAmount(arbitrumTokens.USDC, '1'), + input: new common.TokenAmount(mainnetTokens.USDC, '1'), interestRateMode: InterestRateMode.variable, borrower: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa', balanceBps: 5000, diff --git a/src/logics/radiant-v2/logic.withdraw.test.ts b/src/logics/radiant-v2/logic.withdraw.test.ts index c4939c0c..5efa4a6c 100644 --- a/src/logics/radiant-v2/logic.withdraw.test.ts +++ b/src/logics/radiant-v2/logic.withdraw.test.ts @@ -2,13 +2,13 @@ import { LendingPool__factory } from './contracts'; import { LogicTestCase } from 'test/types'; import { Service } from './service'; import { WithdrawLogic, WithdrawLogicFields } from './logic.withdraw'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { constants, utils } from 'ethers'; import * as core from '@protocolink/core'; import { expect } from 'chai'; +import { mainnetTokens } from './tokens'; -describe.skip('RadiantV2 WithdrawLogic', () => { +describe('RadiantV2 WithdrawLogic', () => { context('Test getTokenList', async () => { WithdrawLogic.supportedChainIds.forEach((chainId) => { it(`network: ${common.toNetworkId(chainId)}`, async () => { @@ -20,7 +20,7 @@ describe.skip('RadiantV2 WithdrawLogic', () => { }); context('Test build', () => { - const chainId = common.ChainId.arbitrum; + const chainId = common.ChainId.mainnet; const logic = new WithdrawLogic(chainId); let lendingPoolAddress: string; const iface = LendingPool__factory.createInterface(); @@ -34,40 +34,40 @@ describe.skip('RadiantV2 WithdrawLogic', () => { const testCases: LogicTestCase[] = [ { fields: { - input: new common.TokenAmount(arbitrumTokens.rWETH, '1'), - output: new common.TokenAmount(arbitrumTokens.ETH, '1'), + input: new common.TokenAmount(mainnetTokens.rWETH, '1'), + output: new common.TokenAmount(mainnetTokens.ETH, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.rWETH, '1'), - output: new common.TokenAmount(arbitrumTokens.WETH, '1'), + input: new common.TokenAmount(mainnetTokens.rWETH, '1'), + output: new common.TokenAmount(mainnetTokens.WETH, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.rUSDC, '1'), - output: new common.TokenAmount(arbitrumTokens.USDC, '1'), + input: new common.TokenAmount(mainnetTokens.rUSDC, '1'), + output: new common.TokenAmount(mainnetTokens.USDC, '1'), }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.rWETH, '1'), - output: new common.TokenAmount(arbitrumTokens.ETH, '1'), + input: new common.TokenAmount(mainnetTokens.rWETH, '1'), + output: new common.TokenAmount(mainnetTokens.ETH, '1'), balanceBps: 5000, }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.rWETH, '1'), - output: new common.TokenAmount(arbitrumTokens.WETH, '1'), + input: new common.TokenAmount(mainnetTokens.rWETH, '1'), + output: new common.TokenAmount(mainnetTokens.WETH, '1'), balanceBps: 5000, }, }, { fields: { - input: new common.TokenAmount(arbitrumTokens.rUSDC, '1'), - output: new common.TokenAmount(arbitrumTokens.USDC, '1'), + input: new common.TokenAmount(mainnetTokens.rUSDC, '1'), + output: new common.TokenAmount(mainnetTokens.USDC, '1'), balanceBps: 5000, }, }, diff --git a/src/logics/radiant-v2/service.test.ts b/src/logics/radiant-v2/service.test.ts index 3466c597..030c4ebd 100644 --- a/src/logics/radiant-v2/service.test.ts +++ b/src/logics/radiant-v2/service.test.ts @@ -1,11 +1,11 @@ import { Service } from './service'; -import { arbitrumTokens } from './tokens'; import * as common from '@protocolink/common'; import { expect } from 'chai'; +import { mainnetTokens } from './tokens'; import omit from 'lodash/omit'; -describe.skip('RadiantV2 Service', () => { - const chainIds = [common.ChainId.arbitrum]; +describe('RadiantV2 Service', () => { + const chainIds = [common.ChainId.mainnet]; context('Test getReserveTokens', () => { chainIds.forEach((chainId) => { @@ -42,11 +42,11 @@ describe.skip('RadiantV2 Service', () => { }); context('Test toRToken', () => { - const service = new Service(common.ChainId.arbitrum); + const service = new Service(common.ChainId.mainnet); const testCases = [ - { asset: arbitrumTokens.WETH, expected: arbitrumTokens.rWETH }, - { asset: arbitrumTokens.USDC, expected: arbitrumTokens.rUSDCn }, + { asset: mainnetTokens.WETH, expected: mainnetTokens.rWETH }, + { asset: mainnetTokens.USDC, expected: mainnetTokens.rUSDC }, ]; testCases.forEach(({ asset, expected }) => { @@ -60,11 +60,11 @@ describe.skip('RadiantV2 Service', () => { }); context('Test toAsset', () => { - const service = new Service(common.ChainId.arbitrum); + const service = new Service(common.ChainId.mainnet); const testCases = [ - { rToken: arbitrumTokens.rWETH, expected: arbitrumTokens.WETH }, - { rToken: arbitrumTokens.rUSDCn, expected: arbitrumTokens.USDC }, + { rToken: mainnetTokens.rWETH, expected: mainnetTokens.WETH }, + { rToken: mainnetTokens.rUSDC, expected: mainnetTokens.USDC }, ]; testCases.forEach(({ rToken, expected }) => { @@ -78,11 +78,11 @@ describe.skip('RadiantV2 Service', () => { }); context('Test getFlashLoanConfiguration', () => { - const service = new Service(common.ChainId.arbitrum); + const service = new Service(common.ChainId.mainnet); const testCases = [ - { assets: [arbitrumTokens.WETH, arbitrumTokens.USDC] }, - { assets: [arbitrumTokens.WBTC, arbitrumTokens.USDT] }, + { assets: [mainnetTokens.WETH, mainnetTokens.USDC] }, + { assets: [mainnetTokens.WBTC, mainnetTokens.USDT] }, ]; testCases.forEach(({ assets }, i) => { diff --git a/src/logics/utility/logic.flash-loan-aggregator.ts b/src/logics/utility/logic.flash-loan-aggregator.ts index 7a2b1ee1..b7129c85 100644 --- a/src/logics/utility/logic.flash-loan-aggregator.ts +++ b/src/logics/utility/logic.flash-loan-aggregator.ts @@ -5,6 +5,7 @@ import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import invariant from 'tiny-invariant'; import * as morphoblue from '../morphoblue'; +import * as radiantv2 from '../radiant-v2'; import * as spark from '../spark'; export const supportedFlashLoanLogics = [ @@ -12,6 +13,7 @@ export const supportedFlashLoanLogics = [ aavev3.FlashLoanLogic, balancerv2.FlashLoanLogic, morphoblue.FlashLoanLogic, + radiantv2.FlashLoanLogic, spark.FlashLoanLogic, ]; diff --git a/test/logics/radiant-v2/borrow.test.ts b/test/logics/radiant-v2/borrow.test.ts index 8db31ae0..98f54f71 100644 --- a/test/logics/radiant-v2/borrow.test.ts +++ b/test/logics/radiant-v2/borrow.test.ts @@ -7,7 +7,7 @@ import * as helpers from './helpers'; import hre from 'hardhat'; import * as radiantv2 from 'src/logics/radiant-v2'; -describe.skip('mainnet-pb: Test RadiantV2 Borrow Logic', () => { +describe('mainnet-pb: Test RadiantV2 Borrow Logic', () => { let chainId: number; let users: SignerWithAddress[]; diff --git a/test/logics/radiant-v2/deposit.test.ts b/test/logics/radiant-v2/deposit.test.ts index dfa14eab..c70bba0b 100644 --- a/test/logics/radiant-v2/deposit.test.ts +++ b/test/logics/radiant-v2/deposit.test.ts @@ -7,7 +7,7 @@ import hre from 'hardhat'; import * as radiantv2 from 'src/logics/radiant-v2'; import * as utils from 'test/utils'; -describe.skip('mainnet-pb: Test RadiantV2 Deposit Logic', () => { +describe('mainnet-pb: Test RadiantV2 Deposit Logic', () => { let chainId: number; let user: SignerWithAddress; diff --git a/test/logics/radiant-v2/flash-loan.test.ts b/test/logics/radiant-v2/flash-loan.test.ts index e36aced5..4a08f8a4 100644 --- a/test/logics/radiant-v2/flash-loan.test.ts +++ b/test/logics/radiant-v2/flash-loan.test.ts @@ -8,7 +8,7 @@ import * as radiantv2 from 'src/logics/radiant-v2'; import * as utility from 'src/logics/utility'; import * as utils from 'test/utils'; -describe.skip('mainnet-pb: Test RadiantV2 FlashLoan Logic', () => { +describe('mainnet-pb: Test RadiantV2 FlashLoan Logic', () => { let chainId: number; let user: SignerWithAddress; diff --git a/test/logics/radiant-v2/repay.test.ts b/test/logics/radiant-v2/repay.test.ts index ccd9c292..81a7f89f 100644 --- a/test/logics/radiant-v2/repay.test.ts +++ b/test/logics/radiant-v2/repay.test.ts @@ -8,7 +8,7 @@ import hre from 'hardhat'; import * as radiantv2 from 'src/logics/radiant-v2'; import * as utils from 'test/utils'; -describe.skip('mainnet-pb: Test RadiantV2 Repay Logic', () => { +describe('mainnet-pb: Test RadiantV2 Repay Logic', () => { let chainId: number; let users: SignerWithAddress[]; diff --git a/test/logics/radiant-v2/withdraw.test.ts b/test/logics/radiant-v2/withdraw.test.ts index 8f1bfb81..f522f975 100644 --- a/test/logics/radiant-v2/withdraw.test.ts +++ b/test/logics/radiant-v2/withdraw.test.ts @@ -8,7 +8,7 @@ import hre from 'hardhat'; import * as radiantv2 from 'src/logics/radiant-v2'; import * as utils from 'test/utils'; -describe.skip('mainnet-pb: Test RadiantV2 Withdraw Logic', () => { +describe('mainnet-pb: Test RadiantV2 Withdraw Logic', () => { let chainId: number; let user: SignerWithAddress;