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

feat: migrated sushiswap-bentobox to studio #685

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
},
]);
}
}
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',
});
}
}
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,
},
]);
}
}
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',
});
}
}
Loading