Skip to content

Commit

Permalink
add revenuecoin staking (#235)
Browse files Browse the repository at this point in the history
Signed-off-by: fkrevenue <fk@revenuecapital.io>
  • Loading branch information
fkrevenue authored Jul 2, 2024
1 parent 56520ef commit 71f27d4
Show file tree
Hide file tree
Showing 3 changed files with 897 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/adapters/revenue.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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 {Revenue__factory} from '../types/factories/Revenue__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 RevenueCoinStakingContractAdapter extends BaseStakingContractAdapter {
/**
* The contract address
*/
contractAddress = '0xd5a5874c9328d955440cb26aed57bce3fb998c0f';
chainId: number = 56;
/**
* Assets that can be staked to this contract
*/
supportedAssets: StakingAsset[] = [
{
asset: 'ERC20:0xbcbdecf8e76A5C32Dba69De16985882ace1678c6',
},
];

async getStakedTokenBalance(owner: string): Promise<BigNumber> {
const contract = Revenue__factory.connect(
this.contractAddress,
this.provider,
);
const balance = BigNumber.from(0);
for (let i = 0; i < 3; i++) {
const amount = await contract.userInfo(i, owner);
balance.add(amount.amount);
}
return balance;
}
}
4 changes: 3 additions & 1 deletion src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
ReNFTPolygonSylvesterV1StakingContractAdapter,
} from './adapters/renft.adapter.js';
import {ReplicantXStakingContractAdapter} from './adapters/replicantx-staking.adapter.js';
import {RevenueCoinStakingContractAdapter} from './adapters/revenue.adapter.js';
import {RirisuStakingContractAdapter} from './adapters/ririsu.adapter.js';
import {RivalBearsStakingContractAdapter} from './adapters/rival-bears-staking.adapter.js';
import {RoboStakingContractAdapter} from './adapters/robo.adapter.js';
Expand Down Expand Up @@ -144,6 +145,7 @@ export class StakingContractsComponent implements Component {
RailgunBinanceGovernanceAdapter,
RailgunEthereumGovernanceAdapter,
RailgunPolygonGovernanceAdapter,
RevenueCoinStakingContractAdapter,
];
constructor() {}
constructor() { }
}
Loading

0 comments on commit 71f27d4

Please sign in to comment.