This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrated sushiswap-bentobox to studio (#685)
- Loading branch information
Showing
19 changed files
with
3,441 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/apps/sushiswap-bentobox/arbitrum/sushiswap-bentobox.balance-fetcher.ts
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,34 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { Register } from '~app-toolkit/decorators'; | ||
import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present'; | ||
import { BalanceFetcher } from '~balance/balance-fetcher.interface'; | ||
import { Network } from '~types/network.interface'; | ||
|
||
import { SushiSwapBentoBoxContractPositionBalanceHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-balance-helper'; | ||
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition'; | ||
|
||
const network = Network.ARBITRUM_MAINNET; | ||
|
||
@Register.BalanceFetcher(SUSHISWAP_BENTOBOX_DEFINITION.id, network) | ||
export class ArbitrumSushiSwapBentoBoxBalanceFetcher implements BalanceFetcher { | ||
constructor( | ||
@Inject(SushiSwapBentoBoxContractPositionBalanceHelper) | ||
private readonly balanceHelper: SushiSwapBentoBoxContractPositionBalanceHelper, | ||
) {} | ||
|
||
async getBalances(address: string) { | ||
const balances = await this.balanceHelper.getBalances({ | ||
address, | ||
network, | ||
bentoBoxAddress: '0x74c764d41b77dbbb4fe771dab1939b00b146894a', | ||
}); | ||
|
||
return presentBalanceFetcherResponse([ | ||
{ | ||
label: 'SushiSwap BentoBox', | ||
assets: balances, | ||
}, | ||
]); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/apps/sushiswap-bentobox/arbitrum/sushiswap-bentobox.vault.contract-position-fetcher.ts
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,29 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { Register } from '~app-toolkit/decorators'; | ||
import { PositionFetcher } from '~position/position-fetcher.interface'; | ||
import { ContractPosition } from '~position/position.interface'; | ||
import { Network } from '~types/network.interface'; | ||
|
||
import { SushiSwapBentoBoxContractPositionHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-helper'; | ||
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition'; | ||
|
||
const appId = SUSHISWAP_BENTOBOX_DEFINITION.id; | ||
const groupId = SUSHISWAP_BENTOBOX_DEFINITION.groups.vault.id; | ||
const network = Network.ARBITRUM_MAINNET; | ||
|
||
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) | ||
export class ArbitrumSushiSwapBentoBoxContractPositionFetcher implements PositionFetcher<ContractPosition> { | ||
constructor( | ||
@Inject(SushiSwapBentoBoxContractPositionHelper) | ||
private readonly positionHelper: SushiSwapBentoBoxContractPositionHelper, | ||
) {} | ||
|
||
async getPositions() { | ||
return this.positionHelper.getPositions({ | ||
bentoBoxAddress: '0x74c764d41b77dbbb4fe771dab1939b00b146894a', | ||
network, | ||
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-bentobox', | ||
}); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/apps/sushiswap-bentobox/binance-smart-chain/sushiswap-bentobox.balance-fetcher.ts
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,34 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { Register } from '~app-toolkit/decorators'; | ||
import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present'; | ||
import { BalanceFetcher } from '~balance/balance-fetcher.interface'; | ||
import { Network } from '~types/network.interface'; | ||
|
||
import { SushiSwapBentoBoxContractPositionBalanceHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-balance-helper'; | ||
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition'; | ||
|
||
const network = Network.BINANCE_SMART_CHAIN_MAINNET; | ||
|
||
@Register.BalanceFetcher(SUSHISWAP_BENTOBOX_DEFINITION.id, network) | ||
export class BscSushiSwapBentoBoxBalanceFetcher implements BalanceFetcher { | ||
constructor( | ||
@Inject(SushiSwapBentoBoxContractPositionBalanceHelper) | ||
private readonly balanceHelper: SushiSwapBentoBoxContractPositionBalanceHelper, | ||
) {} | ||
|
||
async getBalances(address: string) { | ||
const balances = await this.balanceHelper.getBalances({ | ||
address, | ||
network, | ||
bentoBoxAddress: '0xf5bce5077908a1b7370b9ae04adc565ebd643966', | ||
}); | ||
|
||
return presentBalanceFetcherResponse([ | ||
{ | ||
label: 'SushiSwap BentoBox', | ||
assets: balances, | ||
}, | ||
]); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...hiswap-bentobox/binance-smart-chain/sushiswap-bentobox.vault.contract-position-fetcher.ts
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,29 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { Register } from '~app-toolkit/decorators'; | ||
import { PositionFetcher } from '~position/position-fetcher.interface'; | ||
import { ContractPosition } from '~position/position.interface'; | ||
import { Network } from '~types/network.interface'; | ||
|
||
import { SushiSwapBentoBoxContractPositionHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-helper'; | ||
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition'; | ||
|
||
const appId = SUSHISWAP_BENTOBOX_DEFINITION.id; | ||
const groupId = SUSHISWAP_BENTOBOX_DEFINITION.groups.vault.id; | ||
const network = Network.BINANCE_SMART_CHAIN_MAINNET; | ||
|
||
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) | ||
export class BscSushiSwapBentoBoxContractPositionFetcher implements PositionFetcher<ContractPosition> { | ||
constructor( | ||
@Inject(SushiSwapBentoBoxContractPositionHelper) | ||
private readonly positionHelper: SushiSwapBentoBoxContractPositionHelper, | ||
) {} | ||
|
||
async getPositions() { | ||
return this.positionHelper.getPositions({ | ||
bentoBoxAddress: '0xf5bce5077908a1b7370b9ae04adc565ebd643966', | ||
network, | ||
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/sushiswap/bsc-bentobox', | ||
}); | ||
} | ||
} |
Oops, something went wrong.