Skip to main content

contracts/handlers/carrot-staking-handler

Classes​

CarrotStakingHandler​

Defined in: lib/contracts/handlers/carrot-staking-handler.ts:15

Handler for the CarrotStaker contract.

Constructors​

Constructor​

new CarrotStakingHandler(chain, walletClient, publicClient): CarrotStakingHandler

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

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

Parameters​
ParameterTypeDescription
chainChainChain to use for the client.
walletClient{ }The wallet client to use for wallet interactions.
publicClient{ }The public client to use for public interactions.
Returns​

CarrotStakingHandler

Methods​

allowance()​

allowance(owner, spender): Promise<bigint>

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

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.

balanceOf()​

balanceOf(address): Promise<bigint>

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

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.

decimals()​

decimals(): Promise<number>

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

Get the number of decimals of the token.

Returns​

Promise<number>

The number of decimals of the token.

getContract()​

getContract(): object

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

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.

isUnstakingAllowed()​

isUnstakingAllowed(): Promise<boolean>

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

Get whether unstaking is allowed.

Returns​

Promise<boolean>

Whether unstaking is allowed.

stake()​

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

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

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.

totalSupply()​

totalSupply(): Promise<bigint>

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

Get the total supply of the token.

Returns​

Promise<bigint>

The total supply of the token.

unstake()​

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

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

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.