Skip to content

Commit

Permalink
feat: Dogface staking adapter
Browse files Browse the repository at this point in the history
Signed-off-by: Pramodya De Alwis <[email protected]>
  • Loading branch information
p-dealwis authored and raymondfeng committed Dec 19, 2022
1 parent 03ccb6a commit c2ca5fa
Show file tree
Hide file tree
Showing 3 changed files with 16,995 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ typings/
*.tsbuildinfo

src/types

.idea/
33 changes: 33 additions & 0 deletions src/adapters/dogface.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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';
import {BaseStakingContractAdapter, StakingAsset} from '../staking';
import {DogfaceStaking__factory} from '../types';

@injectable(
{
scope: BindingScope.SINGLETON,
},
extensionFor(STAKING_ADAPTERS_EXTENSION_POINT),
)
export class DogfaceStakingContractAdapter extends BaseStakingContractAdapter {
contractAddress = '0x8297c2E7f6485d765d603d3B3F4eb245A156bdB6';
supportedAssets: StakingAsset[] = [
{
asset: 'ERC721:0xBFcB983a6C3E392CbDdECa228854c51fBc29220a',
},
];

async getStakedTokenBalance(owner: string): Promise<BigNumber> {
const contract = DogfaceStaking__factory.connect(
this.contractAddress,
this.provider,
);
return (await contract.getStakeData(owner)).stakedCounts;
}
}
Loading

0 comments on commit c2ca5fa

Please sign in to comment.