Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit b3f2d3a

Browse files
authored
feat: migrated sushiswap-bentobox to studio (#685)
1 parent ddb9818 commit b3f2d3a

19 files changed

+3441
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Inject } from '@nestjs/common';
2+
3+
import { Register } from '~app-toolkit/decorators';
4+
import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present';
5+
import { BalanceFetcher } from '~balance/balance-fetcher.interface';
6+
import { Network } from '~types/network.interface';
7+
8+
import { SushiSwapBentoBoxContractPositionBalanceHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-balance-helper';
9+
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition';
10+
11+
const network = Network.ARBITRUM_MAINNET;
12+
13+
@Register.BalanceFetcher(SUSHISWAP_BENTOBOX_DEFINITION.id, network)
14+
export class ArbitrumSushiSwapBentoBoxBalanceFetcher implements BalanceFetcher {
15+
constructor(
16+
@Inject(SushiSwapBentoBoxContractPositionBalanceHelper)
17+
private readonly balanceHelper: SushiSwapBentoBoxContractPositionBalanceHelper,
18+
) {}
19+
20+
async getBalances(address: string) {
21+
const balances = await this.balanceHelper.getBalances({
22+
address,
23+
network,
24+
bentoBoxAddress: '0x74c764d41b77dbbb4fe771dab1939b00b146894a',
25+
});
26+
27+
return presentBalanceFetcherResponse([
28+
{
29+
label: 'SushiSwap BentoBox',
30+
assets: balances,
31+
},
32+
]);
33+
}
34+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { Inject } from '@nestjs/common';
2+
3+
import { Register } from '~app-toolkit/decorators';
4+
import { PositionFetcher } from '~position/position-fetcher.interface';
5+
import { ContractPosition } from '~position/position.interface';
6+
import { Network } from '~types/network.interface';
7+
8+
import { SushiSwapBentoBoxContractPositionHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-helper';
9+
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition';
10+
11+
const appId = SUSHISWAP_BENTOBOX_DEFINITION.id;
12+
const groupId = SUSHISWAP_BENTOBOX_DEFINITION.groups.vault.id;
13+
const network = Network.ARBITRUM_MAINNET;
14+
15+
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
16+
export class ArbitrumSushiSwapBentoBoxContractPositionFetcher implements PositionFetcher<ContractPosition> {
17+
constructor(
18+
@Inject(SushiSwapBentoBoxContractPositionHelper)
19+
private readonly positionHelper: SushiSwapBentoBoxContractPositionHelper,
20+
) {}
21+
22+
async getPositions() {
23+
return this.positionHelper.getPositions({
24+
bentoBoxAddress: '0x74c764d41b77dbbb4fe771dab1939b00b146894a',
25+
network,
26+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-bentobox',
27+
});
28+
}
29+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Inject } from '@nestjs/common';
2+
3+
import { Register } from '~app-toolkit/decorators';
4+
import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present';
5+
import { BalanceFetcher } from '~balance/balance-fetcher.interface';
6+
import { Network } from '~types/network.interface';
7+
8+
import { SushiSwapBentoBoxContractPositionBalanceHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-balance-helper';
9+
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition';
10+
11+
const network = Network.BINANCE_SMART_CHAIN_MAINNET;
12+
13+
@Register.BalanceFetcher(SUSHISWAP_BENTOBOX_DEFINITION.id, network)
14+
export class BscSushiSwapBentoBoxBalanceFetcher implements BalanceFetcher {
15+
constructor(
16+
@Inject(SushiSwapBentoBoxContractPositionBalanceHelper)
17+
private readonly balanceHelper: SushiSwapBentoBoxContractPositionBalanceHelper,
18+
) {}
19+
20+
async getBalances(address: string) {
21+
const balances = await this.balanceHelper.getBalances({
22+
address,
23+
network,
24+
bentoBoxAddress: '0xf5bce5077908a1b7370b9ae04adc565ebd643966',
25+
});
26+
27+
return presentBalanceFetcherResponse([
28+
{
29+
label: 'SushiSwap BentoBox',
30+
assets: balances,
31+
},
32+
]);
33+
}
34+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { Inject } from '@nestjs/common';
2+
3+
import { Register } from '~app-toolkit/decorators';
4+
import { PositionFetcher } from '~position/position-fetcher.interface';
5+
import { ContractPosition } from '~position/position.interface';
6+
import { Network } from '~types/network.interface';
7+
8+
import { SushiSwapBentoBoxContractPositionHelper } from '../helpers/sushiswap-bentobox.vault.contract-position-helper';
9+
import { SUSHISWAP_BENTOBOX_DEFINITION } from '../sushiswap-bentobox.definition';
10+
11+
const appId = SUSHISWAP_BENTOBOX_DEFINITION.id;
12+
const groupId = SUSHISWAP_BENTOBOX_DEFINITION.groups.vault.id;
13+
const network = Network.BINANCE_SMART_CHAIN_MAINNET;
14+
15+
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
16+
export class BscSushiSwapBentoBoxContractPositionFetcher implements PositionFetcher<ContractPosition> {
17+
constructor(
18+
@Inject(SushiSwapBentoBoxContractPositionHelper)
19+
private readonly positionHelper: SushiSwapBentoBoxContractPositionHelper,
20+
) {}
21+
22+
async getPositions() {
23+
return this.positionHelper.getPositions({
24+
bentoBoxAddress: '0xf5bce5077908a1b7370b9ae04adc565ebd643966',
25+
network,
26+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/sushiswap/bsc-bentobox',
27+
});
28+
}
29+
}

0 commit comments

Comments
 (0)