-
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.
Merge branch 'master' into feature/add_lending_sdk_20231108
- Loading branch information
Showing
12 changed files
with
148 additions
and
10 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
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
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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { Logic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
export type PullTokenFields = common.Declasifying<logics.permit2.PullTokenLogicFields>; | ||
|
||
export type PullTokenLogic = Logic<PullTokenFields>; | ||
|
||
export async function getPullTokenTokenList(chainId: number): Promise<logics.permit2.PullTokenLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.permit2.PullTokenLogic.rid); | ||
} | ||
|
||
export function newPullTokenLogic(fields: PullTokenFields): PullTokenLogic { | ||
return { rid: logics.permit2.PullTokenLogic.rid, fields }; | ||
} |
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,16 @@ | ||
import { Logic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
export type BorrowFields = common.Declasifying<logics.spark.BorrowLogicFields>; | ||
|
||
export type BorrowLogic = Logic<BorrowFields>; | ||
|
||
export async function getBorrowTokenList(chainId: number): Promise<logics.spark.BorrowLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.spark.BorrowLogic.rid); | ||
} | ||
|
||
export function newBorrowLogic(fields: BorrowFields): BorrowLogic { | ||
return { rid: logics.spark.BorrowLogic.rid, fields }; | ||
} |
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,27 @@ | ||
import { FlashLoanFields, FlashLoanLogic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList, quote } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
import { v4 as uuid } from 'uuid'; | ||
|
||
export type FlashLoanParams = common.Declasifying<logics.spark.FlashLoanLogicParams>; | ||
|
||
export async function getFlashLoanTokenList(chainId: number): Promise<logics.spark.FlashLoanLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.spark.FlashLoanLogic.rid); | ||
} | ||
|
||
export async function getFlashLoanQuotation( | ||
chainId: number, | ||
params: FlashLoanParams | ||
): Promise<logics.spark.FlashLoanLogicQuotation> { | ||
return quote(chainId, logics.spark.FlashLoanLogic.rid, params); | ||
} | ||
|
||
export function newFlashLoanLogic(fields: FlashLoanFields): FlashLoanLogic { | ||
return { rid: logics.spark.FlashLoanLogic.rid, fields }; | ||
} | ||
|
||
export function newFlashLoanLogicPair(loans: FlashLoanFields['loans']): [FlashLoanLogic, FlashLoanLogic] { | ||
const id = uuid(); | ||
return [newFlashLoanLogic({ id, loans, isLoan: true }), newFlashLoanLogic({ id, loans, isLoan: false })]; | ||
} |
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,5 @@ | ||
export * from './borrow'; | ||
export * from './supply'; | ||
export * from './flash-loan'; | ||
export * from './repay'; | ||
export * from './withdraw'; |
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,22 @@ | ||
import { Logic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList, quote } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
export type RepayParams = common.Declasifying<logics.spark.RepayLogicParams>; | ||
|
||
export type RepayFields = common.Declasifying<logics.spark.RepayLogicFields>; | ||
|
||
export type RepayLogic = Logic<RepayFields>; | ||
|
||
export async function getRepayTokenList(chainId: number): Promise<logics.spark.RepayLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.spark.RepayLogic.rid); | ||
} | ||
|
||
export async function getRepayQuotation(chainId: number, params: RepayParams): Promise<logics.spark.RepayLogicFields> { | ||
return quote(chainId, logics.spark.RepayLogic.rid, params); | ||
} | ||
|
||
export function newRepayLogic(fields: RepayFields): RepayLogic { | ||
return { rid: logics.spark.RepayLogic.rid, fields }; | ||
} |
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,25 @@ | ||
import { Logic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList, quote } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
export type SupplyParams = common.Declasifying<logics.spark.SupplyLogicParams>; | ||
|
||
export type SupplyFields = common.Declasifying<logics.spark.SupplyLogicFields>; | ||
|
||
export type SupplyLogic = Logic<SupplyFields>; | ||
|
||
export async function getSupplyTokenList(chainId: number): Promise<logics.spark.SupplyLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.spark.SupplyLogic.rid); | ||
} | ||
|
||
export async function getSupplyQuotation( | ||
chainId: number, | ||
params: SupplyParams | ||
): Promise<logics.spark.SupplyLogicFields> { | ||
return quote(chainId, logics.spark.SupplyLogic.rid, params); | ||
} | ||
|
||
export function newSupplyLogic(fields: SupplyFields): SupplyLogic { | ||
return { rid: logics.spark.SupplyLogic.rid, fields }; | ||
} |
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,25 @@ | ||
import { Logic } from 'src/types'; | ||
import * as common from '@protocolink/common'; | ||
import { getProtocolTokenList, quote } from 'src/api'; | ||
import * as logics from '@protocolink/logics'; | ||
|
||
export type WithdrawParams = common.Declasifying<logics.spark.WithdrawLogicParams>; | ||
|
||
export type WithdrawFields = common.Declasifying<logics.spark.WithdrawLogicFields>; | ||
|
||
export type WithdrawLogic = Logic<WithdrawFields>; | ||
|
||
export async function getWithdrawTokenList(chainId: number): Promise<logics.spark.WithdrawLogicTokenList> { | ||
return getProtocolTokenList(chainId, logics.spark.WithdrawLogic.rid); | ||
} | ||
|
||
export async function getWithdrawQuotation( | ||
chainId: number, | ||
params: WithdrawParams | ||
): Promise<logics.spark.WithdrawLogicFields> { | ||
return quote(chainId, logics.spark.WithdrawLogic.rid, params); | ||
} | ||
|
||
export function newWithdrawLogic(fields: WithdrawFields): WithdrawLogic { | ||
return { rid: logics.spark.WithdrawLogic.rid, fields }; | ||
} |
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