26 lines
783 B
TypeScript
26 lines
783 B
TypeScript
import BigNumber from 'bignumber.js'
|
|
import { DEFAULT_GAS_LIMIT, DEFAULT_TOKEN_DECIMAL } from 'config'
|
|
|
|
const options = {
|
|
gasLimit: DEFAULT_GAS_LIMIT,
|
|
}
|
|
|
|
export const stakeBoard = async (masterChefContract, pid, amount) => {
|
|
const value = new BigNumber(amount).times(DEFAULT_TOKEN_DECIMAL).toString()
|
|
const tx = await masterChefContract.deposit(value, options)
|
|
const receipt = await tx.wait()
|
|
return receipt.status
|
|
}
|
|
|
|
export const unstakeBoard = async (masterChefContract) => {
|
|
const tx = await masterChefContract.withdrawHCC(options)
|
|
const receipt = await tx.wait()
|
|
return receipt.status
|
|
}
|
|
|
|
export const harvestBoard = async (masterChefContract) => {
|
|
const tx = await masterChefContract.harvest(options)
|
|
const receipt = await tx.wait()
|
|
return receipt.status
|
|
}
|