-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bob Lu
committed
Sep 26, 2023
1 parent
47e43d3
commit ee4c6c4
Showing
19 changed files
with
1,456 additions
and
807 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as api from '@protocolink/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
// interface BorrowFields { | ||
// interestRateMode: logics.radiantv2.InterestRateMode; | ||
// output: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// } | ||
|
||
// interface BorrowLogic { | ||
// rid: string; | ||
// fields: BorrowFields; | ||
// } | ||
|
||
// TODO: unskip this after @protocolink/api radiant updated | ||
// (async () => { | ||
// const chainId = 42161; | ||
|
||
// const tokenList = await api.protocols.radiantv2.getBorrowTokenList(chainId); | ||
// const underlyingToken = tokenList[0]; | ||
// console.log('underlyingToken :>> ', JSON.stringify(underlyingToken, null, 2)); | ||
|
||
// const borrowLogic = await api.protocols.radiantv2.newBorrowLogic({ | ||
// interestRateMode: logics.radiantv2.InterestRateMode.variable, | ||
// output: { | ||
// token: underlyingToken, | ||
// amount: '10', | ||
// }, | ||
// }); | ||
// console.log('borrowLogic :>> ', JSON.stringify(borrowLogic, null, 2)); | ||
// })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import * as api from '@protocolink/api'; | ||
|
||
// interface DepositParams { | ||
// input: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// tokenOut: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// } | ||
|
||
// interface DepositFields { | ||
// input: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// output: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// } | ||
|
||
// interface DepositLogic { | ||
// rid: string; | ||
// fields: DepositFields; | ||
// } | ||
|
||
// TODO: unskip this after @protocolink/api radiant updated | ||
// (async () => { | ||
// const chainId = 42161; | ||
|
||
// const tokenList = await api.protocols.radiantv2.getDepositTokenList(chainId); | ||
// const underlyingToken = tokenList[0][0]; | ||
// const rToken = tokenList[0][1]; | ||
// console.log('underlyingToken :>> ', JSON.stringify(underlyingToken, null, 2)); | ||
// console.log('rToken :>> ', JSON.stringify(rToken, null, 2)); | ||
|
||
// const depositQuotation = await api.protocols.radiantv2.getDepositQuotation(chainId, { | ||
// input: { | ||
// token: underlyingToken, | ||
// amount: '10', | ||
// }, | ||
// tokenOut: rToken, | ||
// }); | ||
// console.log('depositQuotation :>> ', JSON.stringify(depositQuotation, null, 2)); | ||
|
||
// const depositLogic = await api.protocols.radiantv2.newDepositLogic(depositQuotation); | ||
// console.log('depositLogic :>> ', JSON.stringify(depositLogic, null, 2)); | ||
// })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import * as api from '@protocolink/api'; | ||
|
||
// import * as common from '@protocolink/common'; | ||
|
||
// interface FlashLoanLogicFields { | ||
// id: string; | ||
// outputs: common.TokenAmounts; | ||
// isLoan: boolean; | ||
// } | ||
|
||
// interface FlashLoanFields { | ||
// id: string; | ||
// outputs: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }[]; | ||
// isLoan: boolean; | ||
// } | ||
|
||
// interface FlashLoanLogic { | ||
// rid: string; | ||
// fields: FlashLoanFields; | ||
// } | ||
|
||
// TODO: unskip this after @protocolink/api radiant updated | ||
// (async () => { | ||
// const chainId = 42161; | ||
|
||
// const tokenList = await api.protocols.radiantv2.getFlashLoanTokenList(chainId); | ||
// const underlyingToken = tokenList[0]; | ||
// console.log('underlyingToken :>> ', JSON.stringify(underlyingToken, null, 2)); | ||
|
||
// const outputs = [ | ||
// { | ||
// token: underlyingToken, | ||
// amount: '10000', | ||
// }, | ||
// ]; | ||
|
||
// const [flashLoanLoanLogic, flashLoanRepayLogic] = api.protocols.radiantv2.newFlashLoanLogicPair(outputs); | ||
// const logics = [flashLoanLoanLogic]; | ||
// // logics.push(swapLogic) | ||
// // logics.push(supplyLogic) | ||
// // logics.push(...) | ||
// logics.push(flashLoanRepayLogic); | ||
// console.log('logics :>> ', JSON.stringify(logics, null, 2)); | ||
// })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as api from '@protocolink/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
// interface RepayParams { | ||
// tokenIn: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// borrower: string; | ||
// interestRateMode: logics.radiantv2.InterestRateMode; | ||
// } | ||
|
||
// interface RepayFields { | ||
// input: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// borrower: string; | ||
// interestRateMode: logics.radiantv2.InterestRateMode; | ||
// } | ||
|
||
// interface RepayLogic { | ||
// rid: string; | ||
// fields: RepayFields; | ||
// } | ||
|
||
// TODO: unskip this after @protocolink/api radiant updated | ||
// (async () => { | ||
// const chainId = 42161; | ||
// const account = '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa'; | ||
|
||
// const tokenList = await api.protocols.radiantv2.getRepayTokenList(chainId); | ||
// const underlyingToken = tokenList[0]; | ||
// console.log('underlyingToken :>> ', JSON.stringify(underlyingToken, null, 2)); | ||
|
||
// const repayQuotation = await api.protocols.radiantv2.getRepayQuotation(chainId, { | ||
// borrower: account, | ||
// tokenIn: underlyingToken, | ||
// interestRateMode: logics.radiantv2.InterestRateMode.variable, | ||
// }); | ||
// console.log('repayQuotation :>> ', JSON.stringify(repayQuotation, null, 2)); | ||
|
||
// const repayLogic = await api.protocols.radiantv2.newRepayLogic(repayQuotation); | ||
// console.log('repayLogic :>> ', JSON.stringify(repayLogic, null, 2)); | ||
// })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import * as api from '@protocolink/api'; | ||
|
||
// interface WithdrawParams { | ||
// input: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// tokenOut: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// } | ||
|
||
// interface WithdrawFields { | ||
// input: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// output: { | ||
// token: { | ||
// chainId: number; | ||
// address: string; | ||
// decimals: number; | ||
// symbol: string; | ||
// name: string; | ||
// }; | ||
// amount: string; | ||
// }; | ||
// } | ||
|
||
// interface WithdrawLogic { | ||
// rid: string; | ||
// fields: WithdrawFields; | ||
// } | ||
|
||
// TODO: unskip this after @protocolink/api radiant updated | ||
// (async () => { | ||
// const chainId = 42161; | ||
|
||
// const tokenList = await api.protocols.radiantv2.getWithdrawTokenList(chainId); | ||
// const rToken = tokenList[0][0]; | ||
// const underlyingToken = tokenList[0][1]; | ||
// console.log('rToken :>> ', JSON.stringify(rToken, null, 2)); | ||
// console.log('underlyingToken :>> ', JSON.stringify(underlyingToken, null, 2)); | ||
|
||
// const withdrawQuotation = await api.protocols.radiantv2.getWithdrawQuotation(chainId, { | ||
// input: { | ||
// token: rToken, | ||
// amount: '10', | ||
// }, | ||
// tokenOut: underlyingToken, | ||
// }); | ||
// console.log('withdrawQuotation :>> ', JSON.stringify(withdrawQuotation, null, 2)); | ||
|
||
// const withdrawLogic = await api.protocols.radiantv2.newWithdrawLogic(withdrawQuotation); | ||
// console.log('withdrawLogic :>> ', JSON.stringify(withdrawLogic, null, 2)); | ||
// })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.