diff --git a/arb.db b/arb.db index 218dffd09..2045d0250 100644 Binary files a/arb.db and b/arb.db differ diff --git a/base.db b/base.db index 312f429c9..81c1bf894 100644 Binary files a/base.db and b/base.db differ diff --git a/ethereum.db b/ethereum.db index 35b1acfc7..44853ccde 100644 Binary files a/ethereum.db and b/ethereum.db differ diff --git a/matic.db b/matic.db index bd4ca836d..ed3bd8969 100644 Binary files a/matic.db and b/matic.db differ diff --git a/op.db b/op.db index 88faeff78..636b794a6 100644 Binary files a/op.db and b/op.db differ diff --git a/packages/adapters-library/src/adapters/balancer-v2/products/vesting/balancerV2VestingAdapter.ts b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/balancerV2VestingAdapter.ts new file mode 100644 index 000000000..1362709b5 --- /dev/null +++ b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/balancerV2VestingAdapter.ts @@ -0,0 +1,67 @@ +import { VotingEscrow } from '../../../../core/adapters/votingEscrow' +import { NotImplementedError } from '../../../../core/errors/errors' +import { + GetPositionsInput, + PositionType, + ProtocolDetails, +} from '../../../../types/adapter' +import { + FeeDistributor__factory, + VotingEscrow__factory, +} from '../../../stargate/contracts' + +export class BalancerV2VestingAdapter extends VotingEscrow { + productId = 'vesting' + + getProtocolDetails(): ProtocolDetails { + return { + protocolId: this.protocolId, + name: 'BalancerV2', + description: 'BalancerV2 defi adapter', + siteUrl: '', + iconUrl: '', + positionType: PositionType.Staked, + chainId: this.chainId, + productId: this.productId, + } + } + + addresses = { + veToken: '0xC128a9954e6c874eA3d62ce62B468bA073093F25', + underlyingToken: '0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56', + rewardToken: '0xa13a9247ea42d743238089903570127dda72fe44', + feeDistributor: '0xD3cf852898b21fc233251427c2DC93d3d604F3BB', + } + + async getRewardBalance({ + userAddress, + blockNumber, + }: GetPositionsInput): Promise { + const contract = FeeDistributor__factory.connect( + this.addresses.feeDistributor, + this.provider, + ) + + return contract.claimToken.staticCall( + userAddress, + this.addresses.rewardToken, + { blockTag: blockNumber }, + ) + } + + async getLockedDetails({ + userAddress, + blockNumber, + }: GetPositionsInput): Promise<{ amount: bigint; end: bigint }> { + const votingEscrow = VotingEscrow__factory.connect( + this.addresses.veToken, + this.provider, + ) + + const [amount, end] = await votingEscrow.locked(userAddress, { + blockTag: blockNumber, + }) + + return { amount, end } + } +} diff --git a/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.2.json b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.2.json new file mode 100644 index 000000000..768eaa946 --- /dev/null +++ b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.2.json @@ -0,0 +1,69 @@ +{ + "blockNumber": 21194060, + "latency": "Latency: 1.406 seconds", + "aggregatedValues": ["USD0.00"], + "snapshot": [ + { + "protocolId": "balancer-v2", + "name": "BalancerV2", + "description": "BalancerV2 defi adapter", + "siteUrl": "", + "iconUrl": "", + "positionType": "stake", + "chainId": 1, + "productId": "vesting", + "chainName": "ethereum", + "success": true, + "tokens": [ + { + "type": "protocol", + "balanceRaw": "1701982822546843636967n", + "address": "0xC128a9954e6c874eA3d62ce62B468bA073093F25", + "symbol": "veBAL", + "name": "Vote Escrowed Balancer BPT - Unlock time 06/11/2025", + "decimals": 18, + "tokens": [ + { + "address": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56", + "name": "Balancer 80 BAL 20 WETH", + "symbol": "B-80BAL-20WETH", + "decimals": 18, + "type": "underlying", + "balanceRaw": "1701982822546843636967n", + "balance": 1701.9828225468436, + "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56/logo.png" + }, + { + "address": "0xA13a9247ea42D743238089903570127DdA72fE44", + "name": "Balancer Aave Boosted StablePool", + "symbol": "bb-a-USD", + "decimals": 18, + "balanceRaw": "38777247945780920724n", + "type": "underlying-claimable", + "balance": 38.77724794578092, + "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA13a9247ea42D743238089903570127DdA72fE44/logo.png" + } + ], + "balance": 1701.9828225468436 + } + ] + } + ], + "rpcResponses": { + "a8ba6f41343842b48531f8605a78eaed": { + "result": "0x00000000000000000000000000000000000000000000005c43c1a79d695014e700000000000000000000000000000000000000000000000000000000690be500" + }, + "bf6836bbd7b90f8f17a9d3c202ae8672": { + "result": "0x0000000000000000000000000000000000000000000000021a24758e57848194" + }, + "c6443e715cde299579704a591e917756": { + "result": "0x000000000000000000000000000000000000000000000007000000000000091b000000000000000000000000000000000000000000000000000000468eb5f48000000000000000000000000000000000000000000000000000000000673766e100000000000000000000000000000000000000000000000000000000673766f3000000000000000000000000000000000000000000000007000000000000091b" + }, + "66d35b4400a89c2cfef0d0d7d3a4aaf0": { + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + "2b4dbedeed86ea18cd4013d4b65e9ce5": { + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } +} diff --git a/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.json b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.json new file mode 100644 index 000000000..78efd00dc --- /dev/null +++ b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/snapshots/ethereum.positions.json @@ -0,0 +1,56 @@ +{ + "blockNumber": 21194060, + "latency": "Latency: 1.553 seconds", + "aggregatedValues": ["USD0.00"], + "snapshot": [ + { + "protocolId": "balancer-v2", + "name": "BalancerV2", + "description": "BalancerV2 defi adapter", + "siteUrl": "", + "iconUrl": "", + "positionType": "stake", + "chainId": 1, + "productId": "vesting", + "chainName": "ethereum", + "success": true, + "tokens": [ + { + "type": "protocol", + "balanceRaw": "20041064328708344065n", + "address": "0xC128a9954e6c874eA3d62ce62B468bA073093F25", + "symbol": "veBAL", + "name": "Vote Escrowed Balancer BPT - Unlock time 19/06/2025", + "decimals": 18, + "tokens": [ + { + "address": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56", + "name": "Balancer 80 BAL 20 WETH", + "symbol": "B-80BAL-20WETH", + "decimals": 18, + "type": "underlying", + "balanceRaw": "20041064328708344065n", + "balance": 20.041064328708345, + "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56/logo.png" + } + ], + "balance": 20.041064328708345 + } + ] + } + ], + "rpcResponses": { + "98221183723d41ecda5fc6e317dbdf39": { + "result": "0x000000000000000000000000000000000000000000000001162029d32969c9010000000000000000000000000000000000000000000000000000000068535300" + }, + "f650ec4156b455b0389ef7ed03c3c305": { + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + "c6443e715cde299579704a591e917756": { + "result": "0x000000000000000000000000000000000000000000000007000000000000091b000000000000000000000000000000000000000000000000000000468eb5f48000000000000000000000000000000000000000000000000000000000673766e100000000000000000000000000000000000000000000000000000000673766f3000000000000000000000000000000000000000000000007000000000000091b" + }, + "66d35b4400a89c2cfef0d0d7d3a4aaf0": { + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } +} diff --git a/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/testCases.ts b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/testCases.ts new file mode 100644 index 000000000..8925341f1 --- /dev/null +++ b/packages/adapters-library/src/adapters/balancer-v2/products/vesting/tests/testCases.ts @@ -0,0 +1,25 @@ +import { Chain } from '../../../../../core/constants/chains' +import { TimePeriod } from '../../../../../core/constants/timePeriod' +import type { TestCase } from '../../../../../types/testCase' + +export const testCases: TestCase[] = [ + { + chainId: Chain.Ethereum, + method: 'positions', + input: { + userAddress: '0x278a8453ECf2f477a5Ab3Cd9b0Ea410b7B2C4182', + filterProtocolTokens: ['0xC128a9954e6c874eA3d62ce62B468bA073093F25'], + }, + blockNumber: 21194060, + }, + { + chainId: Chain.Ethereum, + method: 'positions', + key: '2', + input: { + userAddress: '0x891ca7e61d3868B9eDbF20dDd045Fc7D579E77d5', + filterProtocolTokens: ['0xC128a9954e6c874eA3d62ce62B468bA073093F25'], + }, + blockNumber: 21194060, + }, +] diff --git a/packages/adapters-library/src/adapters/compound-v3/contracts/Rewards.ts b/packages/adapters-library/src/adapters/compound-v3/contracts/Rewards.ts new file mode 100644 index 000000000..5886b18ff --- /dev/null +++ b/packages/adapters-library/src/adapters/compound-v3/contracts/Rewards.ts @@ -0,0 +1,367 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export declare namespace CometRewards { + export type RewardOwedStruct = { token: AddressLike; owed: BigNumberish }; + + export type RewardOwedStructOutput = [token: string, owed: bigint] & { + token: string; + owed: bigint; + }; +} + +export interface RewardsInterface extends Interface { + getFunction( + nameOrSignature: + | "claim" + | "claimTo" + | "getRewardOwed" + | "governor" + | "rewardConfig" + | "rewardsClaimed" + | "setRewardConfig" + | "transferGovernor" + | "withdrawToken" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "GovernorTransferred" | "RewardClaimed" + ): EventFragment; + + encodeFunctionData( + functionFragment: "claim", + values: [AddressLike, AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "claimTo", + values: [AddressLike, AddressLike, AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "getRewardOwed", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData(functionFragment: "governor", values?: undefined): string; + encodeFunctionData( + functionFragment: "rewardConfig", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "rewardsClaimed", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setRewardConfig", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "transferGovernor", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "withdrawToken", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "claimTo", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getRewardOwed", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "governor", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "rewardConfig", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "rewardsClaimed", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setRewardConfig", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferGovernor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "withdrawToken", + data: BytesLike + ): Result; +} + +export namespace GovernorTransferredEvent { + export type InputTuple = [oldGovernor: AddressLike, newGovernor: AddressLike]; + export type OutputTuple = [oldGovernor: string, newGovernor: string]; + export interface OutputObject { + oldGovernor: string; + newGovernor: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace RewardClaimedEvent { + export type InputTuple = [ + src: AddressLike, + recipient: AddressLike, + token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [ + src: string, + recipient: string, + token: string, + amount: bigint + ]; + export interface OutputObject { + src: string; + recipient: string; + token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface Rewards extends BaseContract { + connect(runner?: ContractRunner | null): Rewards; + waitForDeployment(): Promise; + + interface: RewardsInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + claim: TypedContractMethod< + [comet: AddressLike, src: AddressLike, shouldAccrue: boolean], + [void], + "nonpayable" + >; + + claimTo: TypedContractMethod< + [ + comet: AddressLike, + src: AddressLike, + to: AddressLike, + shouldAccrue: boolean + ], + [void], + "nonpayable" + >; + + getRewardOwed: TypedContractMethod< + [comet: AddressLike, account: AddressLike], + [CometRewards.RewardOwedStructOutput], + "nonpayable" + >; + + governor: TypedContractMethod<[], [string], "view">; + + rewardConfig: TypedContractMethod< + [arg0: AddressLike], + [ + [string, bigint, boolean] & { + token: string; + rescaleFactor: bigint; + shouldUpscale: boolean; + } + ], + "view" + >; + + rewardsClaimed: TypedContractMethod< + [arg0: AddressLike, arg1: AddressLike], + [bigint], + "view" + >; + + setRewardConfig: TypedContractMethod< + [comet: AddressLike, token: AddressLike], + [void], + "nonpayable" + >; + + transferGovernor: TypedContractMethod< + [newGovernor: AddressLike], + [void], + "nonpayable" + >; + + withdrawToken: TypedContractMethod< + [token: AddressLike, to: AddressLike, amount: BigNumberish], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "claim" + ): TypedContractMethod< + [comet: AddressLike, src: AddressLike, shouldAccrue: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "claimTo" + ): TypedContractMethod< + [ + comet: AddressLike, + src: AddressLike, + to: AddressLike, + shouldAccrue: boolean + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "getRewardOwed" + ): TypedContractMethod< + [comet: AddressLike, account: AddressLike], + [CometRewards.RewardOwedStructOutput], + "nonpayable" + >; + getFunction( + nameOrSignature: "governor" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "rewardConfig" + ): TypedContractMethod< + [arg0: AddressLike], + [ + [string, bigint, boolean] & { + token: string; + rescaleFactor: bigint; + shouldUpscale: boolean; + } + ], + "view" + >; + getFunction( + nameOrSignature: "rewardsClaimed" + ): TypedContractMethod< + [arg0: AddressLike, arg1: AddressLike], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "setRewardConfig" + ): TypedContractMethod< + [comet: AddressLike, token: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "transferGovernor" + ): TypedContractMethod<[newGovernor: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "withdrawToken" + ): TypedContractMethod< + [token: AddressLike, to: AddressLike, amount: BigNumberish], + [void], + "nonpayable" + >; + + getEvent( + key: "GovernorTransferred" + ): TypedContractEvent< + GovernorTransferredEvent.InputTuple, + GovernorTransferredEvent.OutputTuple, + GovernorTransferredEvent.OutputObject + >; + getEvent( + key: "RewardClaimed" + ): TypedContractEvent< + RewardClaimedEvent.InputTuple, + RewardClaimedEvent.OutputTuple, + RewardClaimedEvent.OutputObject + >; + + filters: { + "GovernorTransferred(address,address)": TypedContractEvent< + GovernorTransferredEvent.InputTuple, + GovernorTransferredEvent.OutputTuple, + GovernorTransferredEvent.OutputObject + >; + GovernorTransferred: TypedContractEvent< + GovernorTransferredEvent.InputTuple, + GovernorTransferredEvent.OutputTuple, + GovernorTransferredEvent.OutputObject + >; + + "RewardClaimed(address,address,address,uint256)": TypedContractEvent< + RewardClaimedEvent.InputTuple, + RewardClaimedEvent.OutputTuple, + RewardClaimedEvent.OutputObject + >; + RewardClaimed: TypedContractEvent< + RewardClaimedEvent.InputTuple, + RewardClaimedEvent.OutputTuple, + RewardClaimedEvent.OutputObject + >; + }; +} diff --git a/packages/adapters-library/src/adapters/compound-v3/contracts/abis/rewards.json b/packages/adapters-library/src/adapters/compound-v3/contracts/abis/rewards.json new file mode 100644 index 000000000..7282aa7a2 --- /dev/null +++ b/packages/adapters-library/src/adapters/compound-v3/contracts/abis/rewards.json @@ -0,0 +1,330 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "governor_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "AlreadyConfigured", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "InvalidUInt64", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "NotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "NotSupported", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "TransferOutFailed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "GovernorTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comet", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "bool", + "name": "shouldAccrue", + "type": "bool" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comet", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bool", + "name": "shouldAccrue", + "type": "bool" + } + ], + "name": "claimTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comet", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getRewardOwed", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "owed", + "type": "uint256" + } + ], + "internalType": "struct CometRewards.RewardOwed", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardConfig", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint64", + "name": "rescaleFactor", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "shouldUpscale", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardsClaimed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comet", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "setRewardConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "transferGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/packages/adapters-library/src/adapters/compound-v3/contracts/factories/Rewards__factory.ts b/packages/adapters-library/src/adapters/compound-v3/contracts/factories/Rewards__factory.ts new file mode 100644 index 000000000..565be8a53 --- /dev/null +++ b/packages/adapters-library/src/adapters/compound-v3/contracts/factories/Rewards__factory.ts @@ -0,0 +1,347 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { Rewards, RewardsInterface } from "../Rewards"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "governor_", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "AlreadyConfigured", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "InvalidUInt64", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "NotPermitted", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "NotSupported", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "TransferOutFailed", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldGovernor", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newGovernor", + type: "address", + }, + ], + name: "GovernorTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "src", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "RewardClaimed", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "comet", + type: "address", + }, + { + internalType: "address", + name: "src", + type: "address", + }, + { + internalType: "bool", + name: "shouldAccrue", + type: "bool", + }, + ], + name: "claim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "comet", + type: "address", + }, + { + internalType: "address", + name: "src", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "bool", + name: "shouldAccrue", + type: "bool", + }, + ], + name: "claimTo", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "comet", + type: "address", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "getRewardOwed", + outputs: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "owed", + type: "uint256", + }, + ], + internalType: "struct CometRewards.RewardOwed", + name: "", + type: "tuple", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "governor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "rewardConfig", + outputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "uint64", + name: "rescaleFactor", + type: "uint64", + }, + { + internalType: "bool", + name: "shouldUpscale", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "rewardsClaimed", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "comet", + type: "address", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "setRewardConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newGovernor", + type: "address", + }, + ], + name: "transferGovernor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class Rewards__factory { + static readonly abi = _abi; + static createInterface(): RewardsInterface { + return new Interface(_abi) as RewardsInterface; + } + static connect(address: string, runner?: ContractRunner | null): Rewards { + return new Contract(address, _abi, runner) as unknown as Rewards; + } +} diff --git a/packages/adapters-library/src/adapters/compound-v3/contracts/factories/index.ts b/packages/adapters-library/src/adapters/compound-v3/contracts/factories/index.ts index bb9ca142e..21aaaa35c 100644 --- a/packages/adapters-library/src/adapters/compound-v3/contracts/factories/index.ts +++ b/packages/adapters-library/src/adapters/compound-v3/contracts/factories/index.ts @@ -2,3 +2,4 @@ /* tslint:disable */ /* eslint-disable */ export { CompoundV3__factory } from "./CompoundV3__factory"; +export { Rewards__factory } from "./Rewards__factory"; diff --git a/packages/adapters-library/src/adapters/compound-v3/contracts/index.ts b/packages/adapters-library/src/adapters/compound-v3/contracts/index.ts index eeaa9a904..93628f335 100644 --- a/packages/adapters-library/src/adapters/compound-v3/contracts/index.ts +++ b/packages/adapters-library/src/adapters/compound-v3/contracts/index.ts @@ -2,5 +2,7 @@ /* tslint:disable */ /* eslint-disable */ export type { CompoundV3 } from "./CompoundV3"; +export type { Rewards } from "./Rewards"; export * as factories from "./factories"; export { CompoundV3__factory } from "./factories/CompoundV3__factory"; +export { Rewards__factory } from "./factories/Rewards__factory"; diff --git a/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/snapshots/ethereum.positions.json b/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/snapshots/ethereum.positions.json index e736d1fa8..8a33282d6 100644 --- a/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/snapshots/ethereum.positions.json +++ b/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/snapshots/ethereum.positions.json @@ -1,7 +1,7 @@ { - "blockNumber": 21180052, - "latency": "Latency: 1.614 seconds", - "aggregatedValues": ["USD269,387.61"], + "blockNumber": 21189685, + "latency": "Latency: 1.337 seconds", + "aggregatedValues": ["USD266,379.35"], "snapshot": [ { "protocolId": "compound-v3", @@ -28,10 +28,10 @@ "name": "USD Coin", "symbol": "USDC", "decimals": 6, - "balanceRaw": "267261033994n", + "balanceRaw": "267297957397n", "type": "underlying", - "balance": 267261.033994, - "price": 1.0079569334544718, + "balance": 267297.957397, + "price": 0.9965633582081325, "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png" } ], @@ -41,8 +41,11 @@ } ], "rpcResponses": { - "8aaa56c722124bb18d21436da8e373c8": { - "result": "0x0000000000000000000000000000000000000000000000000000003e39ffbe0a" + "0c43f9d0b645e67747b811d8ee94cfc6": { + "result": "0x1435466" + }, + "3389a837a8daa3b6035cfb65af9e3963": { + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" }, "8a4bd26f5a527e3ea0b9cb0fccf86f0d": { "result": "0x0000000000000000000000000000000000000000000000000000000000000000" @@ -50,17 +53,17 @@ "3bf15ad65b56bdd4e221719aa0af1fbd": { "result": "0x0000000000000000000000000000000000000000000000000000000000000000" }, - "3389a837a8daa3b6035cfb65af9e3963": { - "result": "0x0000000000000000000000000000000000000000000000000000000000000000" + "8aaa56c722124bb18d21436da8e373c8": { + "result": "0x0000000000000000000000000000000000000000000000000000003e3c332615" }, "dbde04d0446b38117a3cd9b3df891333": { "result": "0x0000000000000000000000000000000000000000000000000000000000000000" }, - "47eaa52ae2cfd926fd683ab71baa98ee": { - "result": "0x000000000000000000000000000000000000000000000007000000000000088f0000000000000000000000000000000000000000000000000000004c74cb6040000000000000000000000000000000000000000000000000000000006734d7a5000000000000000000000000000000000000000000000000000000006734d7bb000000000000000000000000000000000000000000000007000000000000088f" + "bcfc9bbbbed4b06a25b6575bc983be20": { + "result": "0x00000000000000000000000000000000000000000000000700000000000008f5000000000000000000000000000000000000000000000000000000473d2c6e400000000000000000000000000000000000000000000000000000000067369db30000000000000000000000000000000000000000000000000000000067369dc300000000000000000000000000000000000000000000000700000000000008f5" }, - "9d3893a9623d5f914c52288d172eff7e": { - "result": "0x000000000000000000000000000000000000000000fde76e7380ac85ec316b66" + "4038a50a7778159eae949e162a68e15d": { + "result": "0x0000000000000000000000000000000000000000010d6b33ed19bdd6fd66306d" } } } diff --git a/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/testCases.ts b/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/testCases.ts index 616fe75c1..b46b20878 100644 --- a/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/testCases.ts +++ b/packages/adapters-library/src/adapters/compound-v3/products/borrow/tests/testCases.ts @@ -12,6 +12,6 @@ export const testCases: TestCase[] = [ filterProtocolTokens: ['0xc3d688B66703497DAA19211EEdff47f25384cdc3'], }, - blockNumber: 21180052, + blockNumber: 21189685, }, ] diff --git a/packages/adapters-library/src/adapters/compound-v3/products/lending/compoundV3LendingAdapter.ts b/packages/adapters-library/src/adapters/compound-v3/products/lending/compoundV3LendingAdapter.ts index 345aee054..57c5b8b7d 100644 --- a/packages/adapters-library/src/adapters/compound-v3/products/lending/compoundV3LendingAdapter.ts +++ b/packages/adapters-library/src/adapters/compound-v3/products/lending/compoundV3LendingAdapter.ts @@ -23,6 +23,7 @@ import { ProtocolDetails, ProtocolPosition, ProtocolTokenTvl, + TokenType, Underlying, UnderlyingReward, UnwrapExchangeRate, @@ -30,7 +31,7 @@ import { } from '../../../../types/adapter' import { Erc20Metadata } from '../../../../types/erc20Metadata' import { Protocol } from '../../../protocols' -import { CompoundV3__factory } from '../../contracts' +import { CompoundV3__factory, Rewards__factory } from '../../contracts' export const addresses = { [Chain.Ethereum]: { @@ -66,6 +67,18 @@ export const addresses = { }, } +const rewardAddresses = { + [Chain.Ethereum]: '0x1B0e765F6224C21223AeA2af16c1C46E38885a40', + [Chain.Polygon]: '0x45939657d1CA34A8FA39A924B71D28Fe8431e581', + [Chain.Arbitrum]: '0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae', + [Chain.Base]: '0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1', + [Chain.Optimism]: '0x443EA0340cb75a160F31A440722dec7b5bc3C2E9', +} + +type AdditionalMetadata = { + rewardTokens: Erc20Metadata[] +} + export class CompoundV3LendingAdapter implements IProtocolAdapter { productId = 'lending' protocolId: Protocol @@ -109,8 +122,8 @@ export class CompoundV3LendingAdapter implements IProtocolAdapter { } @CacheToDb - async getProtocolTokens(): Promise { - const protocolTokens: ProtocolToken[] = [] + async getProtocolTokens(): Promise[]> { + const protocolTokens: ProtocolToken[] = [] const chainAddresses = addresses[this.chainId as keyof typeof addresses] @@ -126,12 +139,24 @@ export class CompoundV3LendingAdapter implements IProtocolAdapter { const baseTokenDetails = await this.helpers.getTokenMetadata(baseToken) - const protocolToken: ProtocolToken = { + const rewardContract = await Rewards__factory.connect( + rewardAddresses[this.chainId as keyof typeof rewardAddresses], + this.provider, + ) + + const rewardConfig = await rewardContract.rewardConfig(compoundAddress) + + const rewardToken = await this.helpers.getTokenMetadata( + rewardConfig.token, + ) + + const protocolToken = { ...baseTokenDetails, address: compoundAddress, symbol: compoundName, name: compoundName, underlyingTokens: [baseTokenDetails], + rewardTokens: [rewardToken], } protocolTokens.push(protocolToken) @@ -198,19 +223,37 @@ export class CompoundV3LendingAdapter implements IProtocolAdapter { }) } - // async getRewardPositions({ - // userAddress, - // protocolTokenAddress, - // blockNumber, - // tokenId, - // }: GetRewardPositionsInput): Promise { - // throw new NotImplementedError() - // } - - // async getRewardWithdrawals({ - // userAddress, - // protocolTokenAddress, - // }: GetEventsInput): Promise { - // throw new NotImplementedError() - // } + async getRewardPositions({ + userAddress, + protocolTokenAddress, + blockNumber, + tokenId, + }: GetRewardPositionsInput): Promise { + const rewardContract = await Rewards__factory.connect( + rewardAddresses[this.chainId as keyof typeof rewardAddresses], + this.provider, + ) + + const [rewardBalance, { rewardTokens }] = await Promise.all([ + rewardContract.getRewardOwed.staticCall( + protocolTokenAddress, + userAddress, + { blockTag: blockNumber }, + ), + this.getProtocolTokenByAddress(protocolTokenAddress), + ]) + + const rewardToken = rewardTokens[0] + if (!rewardToken) { + return [] + } + + return [ + { + balanceRaw: rewardBalance.owed, + type: TokenType.UnderlyingClaimable, + ...rewardToken, + }, + ] + } } diff --git a/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/snapshots/ethereum.positions.json b/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/snapshots/ethereum.positions.json index c4aa98830..b58e75fe8 100644 --- a/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/snapshots/ethereum.positions.json +++ b/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/snapshots/ethereum.positions.json @@ -1,7 +1,7 @@ { - "blockNumber": 21174465, - "latency": "Latency: 2.384 seconds", - "aggregatedValues": ["USD40,019.65", "USD61,620.12"], + "blockNumber": 21189685, + "latency": "Latency: 1.976 seconds", + "aggregatedValues": ["USD39,893.27", "USD61,445.85"], "snapshot": [ { "protocolId": "compound-v3", @@ -20,63 +20,97 @@ "name": "cUSDCv3", "symbol": "cUSDCv3", "decimals": 6, - "balanceRaw": "40004476410n", + "balanceRaw": "40030116705n", "type": "protocol", "tokens": [ + { + "balanceRaw": "15735000000000000n", + "type": "underlying-claimable", + "address": "0xc00e94Cb662C3520282E6f5717214004A7f26888", + "name": "Compound", + "symbol": "COMP", + "decimals": 18, + "balance": 0.015735, + "price": 45.690591916576615, + "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc00e94Cb662C3520282E6f5717214004A7f26888/logo.png" + }, { "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "name": "USD Coin", "symbol": "USDC", "decimals": 6, "type": "underlying", - "balanceRaw": "40004476410n", - "balance": 40004.47641, - "price": 1.0003792203921145, + "balanceRaw": "40030116705n", + "balance": 40030.116705, + "price": 0.9965633582081325, "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png" } ], - "balance": 40004.47641 + "balance": 40030.116705 }, { "address": "0x3Afdc9BCA9213A35503b077a6072F3D0d5AB0840", "name": "cUSDTv3", "symbol": "cUSDTv3", "decimals": 6, - "balanceRaw": "61470360302n", + "balanceRaw": "61513467419n", "type": "protocol", "tokens": [ + { + "balanceRaw": "298705000000000000n", + "type": "underlying-claimable", + "address": "0xc00e94Cb662C3520282E6f5717214004A7f26888", + "name": "Compound", + "symbol": "COMP", + "decimals": 18, + "balance": 0.298705, + "price": 45.690591916576615, + "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc00e94Cb662C3520282E6f5717214004A7f26888/logo.png" + }, { "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "name": "Tether USD", "symbol": "USDT", "decimals": 6, "type": "underlying", - "balanceRaw": "61470360302n", - "balance": 61470.360302, - "price": 1.0024362420434805, + "balanceRaw": "61513467419n", + "balance": 61513.467419, + "price": 0.9986788468005181, "iconUrl": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png" } ], - "balance": 61470.360302 + "balance": 61513.467419 } ] } ], "rpcResponses": { - "1ca2ed362ae3bc941b02ded1ce07710c": { - "result": "0x000000000000000000000000000000000000000000000000000000095073ddfa" + "0c43f9d0b645e67747b811d8ee94cfc6": { + "result": "0x1435466" + }, + "2a5671c5e549479ec7e035dad331c211": { + "result": "0x0000000000000000000000000000000000000000000000000000000951fb1b61" + }, + "c045e8f3420bf2e2c753c163e4df5272": { + "result": "0x0000000000000000000000000000000000000000000000000000000e527d061b" + }, + "54a4acb23b1ab543e70082be6cb09d4c": { + "result": "0x000000000000000000000000c00e94cb662c3520282e6f5717214004a7f268880000000000000000000000000000000000000000000000000425369d69a21000" + }, + "ca74ea9287f4b688090196c27f7d2239": { + "result": "0x000000000000000000000000c00e94cb662c3520282e6f5717214004a7f268880000000000000000000000000000000000000000000000000037e6e62d8a7000" }, - "8ce39873c01fcbbb01d801b9a0af0837": { - "result": "0x0000000000000000000000000000000000000000000000000000000e4feb42ee" + "bcfc9bbbbed4b06a25b6575bc983be20": { + "result": "0x00000000000000000000000000000000000000000000000700000000000008f5000000000000000000000000000000000000000000000000000000473d2c6e400000000000000000000000000000000000000000000000000000000067369db30000000000000000000000000000000000000000000000000000000067369dc300000000000000000000000000000000000000000000000700000000000008f5" }, - "541122ba252584e47f8ac10c7faabf4f": { - "result": "0x000000000000000000000000000000000000000000000007000000000000084a0000000000000000000000000000000000000000000000000000004c77e78477000000000000000000000000000000000000000000000000000000006733cb63000000000000000000000000000000000000000000000000000000006733cb77000000000000000000000000000000000000000000000007000000000000084a" + "aadbf0a22554dcbbd99b5ed717deda59": { + "result": "0x00000000000000000000000000000000000000000000000000350d8e5a1d5b33" }, - "4b254a68d0dbcc2c6c47e703489a553b": { - "result": "0x000000000000000000000000000000000000000000fc79271e3ac398a615b7ab" + "87a707798427480ebc15aa41bd66ce26": { + "result": "0x0000000000000000000000000000000000000000010dfd9d216f5b2758c858cd" }, - "6dc06887ac331024ac1b858f1bb9a6e6": { - "result": "0x000000000000000000000000000000000000000000fbf4862d1cd803d4027b7f" + "4038a50a7778159eae949e162a68e15d": { + "result": "0x0000000000000000000000000000000000000000010d6b33ed19bdd6fd66306d" } } } diff --git a/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/testCases.ts b/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/testCases.ts index adcd3973e..bf38fa80a 100644 --- a/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/testCases.ts +++ b/packages/adapters-library/src/adapters/compound-v3/products/lending/tests/testCases.ts @@ -16,6 +16,6 @@ export const testCases: TestCase[] = [ ], }, - blockNumber: 21174465, + blockNumber: 21189685, }, ] diff --git a/packages/adapters-library/src/adapters/integration.test.ts b/packages/adapters-library/src/adapters/integration.test.ts index 17732d4db..a6f7e3d17 100644 --- a/packages/adapters-library/src/adapters/integration.test.ts +++ b/packages/adapters-library/src/adapters/integration.test.ts @@ -24,6 +24,7 @@ import { testCases as aaveV3StableDebtTokenTestCases } from './aave-v3/products/ import { testCases as aaveV3StakingTestCases } from './aave-v3/products/staking/tests/testCases' import { testCases as aaveV3VariableDebtTokenTestCases } from './aave-v3/products/variable-debt-token/tests/testCases' import { testCases as angleProtocolSavingsTestCases } from './angle-protocol/products/savings/tests/testCases' +import { testCases as balancerV2VestingTestCases } from './balancer-v2/products/vesting/tests/testCases' import { testCases as beefyCowTokenTestCases } from './beefy/products/cow-token/tests/testCases' import { testCases as beefyMooTokenTestCases } from './beefy/products/moo-token/tests/testCases' import { testCases as beefyRcowTokenTestCases } from './beefy/products/rcow-token/tests/testCases' @@ -155,6 +156,10 @@ const allTestCases: Record> = { ['savings']: angleProtocolSavingsTestCases, }, + [Protocol.BalancerV2]: { + ['vesting']: balancerV2VestingTestCases, + }, + [Protocol.Beefy]: { ['cow-token']: beefyCowTokenTestCases, ['moo-token']: beefyMooTokenTestCases, diff --git a/packages/adapters-library/src/adapters/protocols.ts b/packages/adapters-library/src/adapters/protocols.ts index 8bf45484b..b0ad3568a 100644 --- a/packages/adapters-library/src/adapters/protocols.ts +++ b/packages/adapters-library/src/adapters/protocols.ts @@ -3,6 +3,7 @@ export const Protocol = { AaveV2: 'aave-v2', AaveV3: 'aave-v3', AngleProtocol: 'angle-protocol', + BalancerV2: 'balancer-v2', Beefy: 'beefy', CarbonDeFi: 'carbon-defi', ChimpExchange: 'chimp-exchange', diff --git a/packages/adapters-library/src/adapters/supportedProtocols.ts b/packages/adapters-library/src/adapters/supportedProtocols.ts index 38e5f9fcf..cd8d16317 100644 --- a/packages/adapters-library/src/adapters/supportedProtocols.ts +++ b/packages/adapters-library/src/adapters/supportedProtocols.ts @@ -140,6 +140,7 @@ import { AaveV2RewardsAdapter } from './aave-v2/products/rewards/aaveV2RewardsAd import { CompoundV3LendingAdapter } from './compound-v3/products/lending/compoundV3LendingAdapter' +import { BalancerV2VestingAdapter } from './balancer-v2/products/vesting/balancerV2VestingAdapter' import { CompoundV3BorrowAdapter } from './compound-v3/products/borrow/compoundV3BorrowAdapter' export const supportedProtocols: Record< @@ -223,6 +224,8 @@ export const supportedProtocols: Record< [Chain.Base]: [AngleProtocolSavingsAdapter], }, + [Protocol.BalancerV2]: { [Chain.Ethereum]: [BalancerV2VestingAdapter] }, + [Protocol.Beefy]: { [Chain.Ethereum]: [ BeefyCowTokenAdapter, diff --git a/packages/adapters-library/src/types/adapter.ts b/packages/adapters-library/src/types/adapter.ts index 63c241457..20f95c3c1 100644 --- a/packages/adapters-library/src/types/adapter.ts +++ b/packages/adapters-library/src/types/adapter.ts @@ -8,7 +8,6 @@ import type { Erc20Metadata } from './erc20Metadata' export const TokenType = { Protocol: 'protocol', - Reward: 'claimable', Underlying: 'underlying', UnderlyingClaimable: 'underlying-claimable', } as const @@ -20,7 +19,6 @@ export const UnderlyingTokenTypeMap: { | typeof TokenType.UnderlyingClaimable } = { [TokenType.UnderlyingClaimable]: TokenType.UnderlyingClaimable, - [TokenType.Reward]: TokenType.UnderlyingClaimable, [TokenType.Underlying]: TokenType.Underlying, [TokenType.Protocol]: TokenType.Underlying, } as const @@ -232,7 +230,7 @@ export type UnderlyingReward = Omit & { * User's position, includes balance of protocol token related underlying token balances */ export interface ProtocolPosition extends TokenBalanceWithUnderlyings { - type: typeof TokenType.Protocol | typeof TokenType.Reward + type: typeof TokenType.Protocol /** * Used by NFT Defi Positions, e.g. uniswapV3