-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: xenonlabsio <[email protected]>
- Loading branch information
1 parent
7d39c31
commit adfe306
Showing
3 changed files
with
955 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {BindingScope, extensionFor, injectable} from '@loopback/core'; | ||
import {BigNumber} from 'ethers'; | ||
import {STAKING_ADAPTERS_EXTENSION_POINT} from '../keys'; | ||
import {BaseStakingContractAdapter, StakingAsset} from '../staking'; | ||
// Use the full path to import instead of `../types` | ||
import {MeltdownChildren__factory} from '../types/factories/MeltdownChildren__factory'; | ||
|
||
@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 MeltdownContractAdapter extends BaseStakingContractAdapter { | ||
/** | ||
* The contract address | ||
*/ | ||
contractAddress = '0xC0c5670D9052D0ee524d7C932382805645Ab3479'; | ||
chainId = 137; | ||
/** | ||
* Assets that can be staked to this contract | ||
*/ | ||
supportedAssets: StakingAsset[] = [ | ||
{ | ||
asset: 'ERC721:0xc47d3EF164FB3f3C3D6cfAF259f09f6AA9aa7C03', | ||
}, | ||
]; | ||
|
||
/** | ||
* Get staked token ids for the given owner | ||
* @param owner - Owner address | ||
* @returns | ||
*/ | ||
async getStakedTokenIds(owner: string): Promise<BigNumber[]> { | ||
const contract = MeltdownChildren__factory.connect( | ||
this.contractAddress, | ||
this.provider, | ||
); | ||
const data = await contract.getStakeInfo(owner); | ||
return data._tokensStaked; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.