UNPKG

@collabland/staking-contracts

Version:
48 lines (43 loc) 1.46 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'; // Use the full path to import instead of `../types` import {SpitYard__factory} from '../types/factories/SpitYard__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 SpitYardContractAdapter extends BaseStakingContractAdapter { /** * The contract address */ contractAddress = '0xf96143461584e61a39f01A0a345f56Bb255A15FA'; /** * Assets that can be staked to this contract */ supportedAssets: StakingAsset[] = [ { asset: 'ERC721:0x7f997A13a155BEd03ce2989b2c98634a241543fa', }, ]; /** * Get staked token ids for the given owner * @param owner - Owner address * @returns */ getStakedTokenIds(owner: string): Promise<BigNumber[]> { const contract = SpitYard__factory.connect( this.contractAddress, this.provider, ); return contract.getUserStake(owner); } }