Skip to content

Commit

Permalink
Merge pull request #3886 from Koniverse/koni/dev/issue-332-chainlist
Browse files Browse the repository at this point in the history
[Bifrost] Add referral code for Bifrost Liquid Staking (vDOT, vMANTA)
  • Loading branch information
saltict authored Jan 2, 2025
2 parents 84d752c + 6cbbdd7 commit 48bce9d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ export const ST_LIQUID_TOKEN_ABI: Record<string, any> = require('./abis/st_liqui

export const MANTA_VALIDATOR_POINTS_PER_BLOCK = 20;
export const MANTA_MIN_DELEGATION = 500;

export const CHANNEL_ID = 7;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
import { _getAssetDecimals, _getTokenOnChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
import { CHANNEL_ID } from '@subwallet/extension-base/services/earning-service/constants';
import { BaseYieldStepDetail, HandleYieldStepData, LiquidYieldPoolInfo, OptimalYieldPath, SubmitYieldJoinData, TransactionData, YieldStepType } from '@subwallet/extension-base/types';

import BifrostLiquidStakingPoolHandler from './bifrost';
Expand Down Expand Up @@ -143,7 +144,7 @@ export default class BifrostMantaLiquidStakingPoolHandler extends BifrostLiquidS
const substrateApi = await this.substrateApi.isReady;
const inputTokenSlug = this.inputAsset;
const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
const extrinsic = substrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), data.amount, undefined, undefined);
const extrinsic = substrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), data.amount, undefined, CHANNEL_ID);

return {
txChain: this.chain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/K
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
import { _STAKING_ERA_LENGTH_MAP } from '@subwallet/extension-base/services/chain-service/constants';
import { _getAssetDecimals, _getTokenOnChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
import { fakeAddress } from '@subwallet/extension-base/services/earning-service/constants';
import { CHANNEL_ID, fakeAddress } from '@subwallet/extension-base/services/earning-service/constants';
import { BaseYieldStepDetail, EarningStatus, HandleYieldStepData, LiquidYieldPoolInfo, LiquidYieldPositionInfo, OptimalYieldPath, OptimalYieldPathParams, RuntimeDispatchInfo, SubmitYieldJoinData, TokenBalanceRaw, TransactionData, UnstakingInfo, UnstakingStatus, YieldPoolMethodInfo, YieldPositionInfo, YieldStepType, YieldTokenBaseInfo } from '@subwallet/extension-base/types';
import { reformatAddress } from '@subwallet/extension-base/utils';
import BigNumber from 'bignumber.js';
Expand Down Expand Up @@ -337,7 +337,7 @@ export default class BifrostLiquidStakingPoolHandler extends BaseLiquidStakingPo
const defaultFeeTokenSlug = this.feeAssets[0];

if (new BN(params.amount).gt(BN_ZERO)) {
const _mintFeeInfo = await poolOriginSubstrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), params.amount, undefined, undefined).paymentInfo(fakeAddress);
const _mintFeeInfo = await poolOriginSubstrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), params.amount, undefined, CHANNEL_ID).paymentInfo(fakeAddress);
const mintFeeInfo = _mintFeeInfo.toPrimitive() as unknown as RuntimeDispatchInfo;

return {
Expand All @@ -356,7 +356,7 @@ export default class BifrostLiquidStakingPoolHandler extends BaseLiquidStakingPo
const substrateApi = await this.substrateApi.isReady;
const inputTokenSlug = this.inputAsset;
const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
const extrinsic = substrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), data.amount, undefined, undefined);
const extrinsic = substrateApi.api.tx.vtokenMinting.mint(_getTokenOnChainInfo(inputTokenInfo), data.amount, undefined, CHANNEL_ID);

return {
txChain: this.chain,
Expand Down

1 comment on commit 48bce9d

@saltict
Copy link
Author

@saltict saltict commented on 48bce9d Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.