Skip to main content

contracts/handlers/carrot-staking-handler

Classes

CarrotStakingHandler

Handler for the CarrotStaker contract.

Constructors

new CarrotStakingHandler()

new CarrotStakingHandler(chain, walletClient, publicClient): CarrotStakingHandler

Create the handler for the CarrotStaker contract exposing methods to interact with the contract.

Parameters
ParameterTypeDescription
chainChainChain to use for the client.
walletClientobjectThe wallet client to use for wallet interactions.
publicClientobjectThe public client to use for public interactions.
Returns

CarrotStakingHandler

Source

lib/contracts/handlers/carrot-staking-handler.ts:28

Properties

PropertyModifierTypeDescription
chainprivateChainChain to use for the client.
publicClientprivateobjectThe public client to use for public interactions.
viemChainprivateChain-
walletClientprivateobjectThe wallet client to use for wallet interactions.

Methods

allowance()

allowance(owner, spender): Promise<bigint>

Get the allowance for the spender to spend the owner's tokens.

Parameters
ParameterTypeDescription
owner`0x${string}`The owner of the tokens.
spender`0x${string}`The spender of the tokens.
Returns

Promise<bigint>

The allowance of the owner for the spender.

Source

lib/contracts/handlers/carrot-staking-handler.ts:61

balanceOf()

balanceOf(address): Promise<bigint>

Get the balance of the address.

Parameters
ParameterTypeDescription
address`0x${string}`The address to get the balance of.
Returns

Promise<bigint>

The balance of the address.

Source

lib/contracts/handlers/carrot-staking-handler.ts:71

decimals()

decimals(): Promise<number>

Get the number of decimals of the token.

Returns

Promise<number>

The number of decimals of the token.

Source

lib/contracts/handlers/carrot-staking-handler.ts:80

getContract()

getContract(): object

Get the contract. This is a method because the typings are complex and lost when trying to make it a member.

Returns

object

The viem contract.

Source

lib/contracts/handlers/carrot-staking-handler.ts:42

isUnstakingAllowed()

isUnstakingAllowed(): Promise<boolean>

Get whether unstaking is allowed.

Returns

Promise<boolean>

Whether unstaking is allowed.

Source

lib/contracts/handlers/carrot-staking-handler.ts:89

stake()

stake(account, amount): Promise<`0x${string}`>

Stake CARROT tokens.

Parameters
ParameterTypeDescription
account`0x${string}`The account to stake CARROT tokens from.
amountbigintThe amount of CARROT tokens to stake.
Returns

Promise<`0x${string}`>

The transaction hash.

Source

lib/contracts/handlers/carrot-staking-handler.ts:109

totalSupply()

totalSupply(): Promise<bigint>

Get the total supply of the token.

Returns

Promise<bigint>

The total supply of the token.

Source

lib/contracts/handlers/carrot-staking-handler.ts:98

unstake()

unstake(account, amount, recipient): Promise<`0x${string}`>

Unstake CARROT tokens.

Parameters
ParameterTypeDescription
account`0x${string}`The account to unstake CARROT tokens from.
amountbigintThe amount of CARROT tokens to unstake.
recipient`0x${string}`The recipient of the unstaked tokens.
Returns

Promise<`0x${string}`>

The transaction hash.

Source

lib/contracts/handlers/carrot-staking-handler.ts:124