Staking Close

The key owner ends key staking.

Contract function

stakingClose

Contract address

0x9b727dcaC7b331f95786D3b01fA79191Ab527DA3

Parameters

ratio: pool staking ratio
duration: time staking
locked: is pool staking locked

Sample code

  public stakingClose = async (
    params: ICloseStaking
  ): Promise<ethers.ContractTransaction> => {
    try {
      await this.getBTCApprove({
        spender_address: ALPHA_KEY_FACTORY_ADDRESS,
        token_amount: 1,
        need_approve: true,
      });
      await this.estimateTCGasFee({ type: ETypes.buy });
      const afk = this.contract.getAlphaKeysFactoryContract();
      const tx = await afk
        .connect(this.wallet)
        .stakingClose(params.ratio, params.duration, params.isLock);
      await tx.wait();
      await delay(1000);
      await this.tradeAPI.scanTrxAlpha({ tx_hash: tx.hash });
      return tx;
    } catch (error) {
      console.log('stakingClose error', error);
      throw error;
    }
  };

Last updated