UNPKG

@collabland/staking-contracts

Version:
51 lines (45 loc) 1.54 kB
// Copyright Abridged, Inc. 2022. All Rights Reserved. // Node module: @collabland/staking-contracts // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT import {BindingScope, extensionFor, injectable} from '@loopback/core'; import {BigNumber} from 'ethers'; import {STAKING_ADAPTERS_EXTENSION_POINT} from '../keys.js'; import {BaseStakingContractAdapter, StakingAsset} from '../staking.js'; import type {Coco} from '../types/Coco.js'; // Use the full path to import instead of `../types` import {Coco__factory} from '../types/factories/Coco__factory.js'; @injectable( { scope: BindingScope.SINGLETON, // Mark the adapter as a singleton }, // Mark it as an extension to staking contracts service extensionFor(STAKING_ADAPTERS_EXTENSION_POINT), ) export class CocoStakingContractAdapter extends BaseStakingContractAdapter { private contract: Coco; /** * The contract address */ contractAddress = '0x0Df016Fb18ef4195b2CF9d8623E236272ec52e14'; /** * Assets that can be staked to this contract */ supportedAssets: StakingAsset[] = [ { asset: 'ERC721:0x1A331c89898C37300CccE1298c62aefD3dFC016c', }, ]; constructor() { super(); this.contract = Coco__factory.connect(this.contractAddress, this.provider); } /** * Get staked token ids for the given owner * @param owner - Owner address * @returns */ getStakedTokenIds(owner: string): Promise<BigNumber[]> { return this.contract.getStakes(owner); } }