@collabland/staking-contracts
Version:
Staking contracts supported by Collab.Land
54 lines • 2.19 kB
JavaScript
import { __decorate } from "tslib";
import { BindingScope, extensionFor, injectable } from '@loopback/core';
import { BigNumber } from 'ethers';
import { STAKING_ADAPTERS_EXTENSION_POINT } from '../keys.js';
import { BaseStakingContractAdapter } from '../staking.js';
// Use the full path to import instead of `../types`
import { DwebUniV2Staking__factory } from '../types/factories/DwebUniV2Staking__factory.js';
class BaseDwebUniV2StakingContractAdapter extends BaseStakingContractAdapter {
constructor() {
super(...arguments);
this.supportedAssets = [];
}
/**
* Get staked token balance for the given owner
* @param owner - Owner address
* @returns
*/
async getStakedTokenBalance(owner) {
const contract = DwebUniV2Staking__factory.connect(this.contractAddress, this.provider);
try {
return (await contract.getStakeDetails(owner)).initialDeposit;
}
catch (err) {
return BigNumber.from(0);
}
}
}
let DwebUniV2EthereumStakingContractAdapter = class DwebUniV2EthereumStakingContractAdapter extends BaseDwebUniV2StakingContractAdapter {
constructor() {
super(...arguments);
this.contractAddress = '0x594E33aC3B56E9c0109deeBe03EEA2e39fE1A852';
this.chainId = 1;
}
};
DwebUniV2EthereumStakingContractAdapter = __decorate([
injectable({
scope: BindingScope.SINGLETON,
}, extensionFor(STAKING_ADAPTERS_EXTENSION_POINT))
], DwebUniV2EthereumStakingContractAdapter);
export { DwebUniV2EthereumStakingContractAdapter };
let DwebUniV2PolygonStakingContractAdapter = class DwebUniV2PolygonStakingContractAdapter extends BaseDwebUniV2StakingContractAdapter {
constructor() {
super(...arguments);
this.contractAddress = '0x5DB2dE06eD6797E180cD432Ff0BeC6332a34C18E';
this.chainId = 137;
}
};
DwebUniV2PolygonStakingContractAdapter = __decorate([
injectable({
scope: BindingScope.SINGLETON,
}, extensionFor(STAKING_ADAPTERS_EXTENSION_POINT))
], DwebUniV2PolygonStakingContractAdapter);
export { DwebUniV2PolygonStakingContractAdapter };
//# sourceMappingURL=dweb-uni-v2-staking.adapter.js.map