@collabland/staking-contracts
Version:
Staking contracts supported by Collab.Land
43 lines (39 loc) • 1.26 kB
text/typescript
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 {StartNft__factory} from '../types/factories/StartNft__factory.js';
(
{
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 StartStakingContractAdapter extends BaseStakingContractAdapter {
/**
* The contract address
*/
contractAddress = '0xB4A3C079ACBD57668bF5292C13878F9225678381';
/**
* Assets that can be staked to this contract
*/
supportedAssets: StakingAsset[] = [
{
asset: 'ERC721:0x31b4C124E8e021402A2b89F8EC1AF54F68Fd256D',
},
];
/**
* Get staked token ids for the given owner
* @param owner - Owner address
* @returns
*/
getStakedTokenIds(owner: string): Promise<BigNumber[]> {
const contract = StartNft__factory.connect(
this.contractAddress,
this.provider,
);
return contract.getAllStakedERC721(owner);
}
}