Skip to main content

contracts/handlers/carrot-vesting-handler

Classes​

CarrotVestingHandler​

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:21

Handler for the CarrotVesting contract exposing methods to interact with the contract.

Constructors​

Constructor​

new CarrotVestingHandler(chain, walletClient, publicClient): CarrotVestingHandler

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:35

Create the handler for the CarrotVesting 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​

CarrotVestingHandler

Methods​

calculateClaimableAmount()​

calculateClaimableAmount(user): Promise<bigint>

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

Calculate the claimable amount for a user.

Parameters​
ParameterTypeDescription
user`0x${string}`The user address.
Returns​

Promise<bigint>

The claimable amount.

claim()​

claim(): Promise<`0x${string}`>

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

Claim vested tokens.

Returns​

Promise<`0x${string}`>

The transaction.

exchangeRate()​

exchangeRate(): Promise<bigint>

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

Get the exchange rate.

Returns​

Promise<bigint>

The exchange rate.

getCarrotAddress()​

getCarrotAddress(): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:110

Get the CARROT token address.

Returns​

Promise<`0x${string}`>

The CARROT token address.

getContract()​

getContract(): object

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:53

Get the contract.

Returns​

object

The viem contract.

getDuration()​

getDuration(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:231

Get the duration of the vesting period.

Returns​

Promise<number>

The duration of the vesting period.

getNewDuration()​

getNewDuration(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:241

Get the new duration of the vesting period. This is a new function added after contract upgrade.

Returns​

Promise<number>

The new duration of the vesting period.

getNewDuration2()​

getNewDuration2(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:271

Get the new duration of the vesting period. This is a new function added after the second contract upgrade.

Returns​

Promise<number>

The new duration of the vesting period.

getNewSteps()​

getNewSteps(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:251

Get the upgrade timestamp. This is a new function added after contract upgrade.

Returns​

Promise<number>

The upgrade timestamp.

getPufferAddress()​

getPufferAddress(): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:119

Get the PUFFER token address.

Returns​

Promise<`0x${string}`>

The PUFFER token address.

getStartTimestamp()​

getStartTimestamp(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:166

Get the start timestamp.

Returns​

Promise<number>

The start timestamp.

getSteps()​

getSteps(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:137

Get the number of vesting steps.

Returns​

Promise<number>

The number of vesting steps.

getTotalDepositedAmount()​

getTotalDepositedAmount(): Promise<bigint>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:222

Get the total deposited amount.

Returns​

Promise<bigint>

The total deposited amount.

getUpgradeTimestamp()​

getUpgradeTimestamp(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:261

Get the upgrade timestamp. This is a new function added after contract upgrade.

Returns​

Promise<number>

The upgrade timestamp.

getUpgradeTimestamp2()​

getUpgradeTimestamp2(): Promise<number>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:281

Get the upgrade timestamp. This is a new function added after the second contract upgrade.

Returns​

Promise<number>

The upgrade timestamp.

getVestings()​

getVestings(user): Promise<readonly object[]>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:157

Get vesting information for a user.

Parameters​
ParameterTypeDescription
user`0x${string}`The user address.
Returns​

Promise<readonly object[]>

The vesting information including deposited amount, claimed amount, last claimed timestamp, and deposited timestamp.

maxCarrotAmount()​

maxCarrotAmount(): Promise<bigint>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:146

Get the maximum carrot amount.

Returns​

Promise<bigint>

The maximum carrot amount.

owner()​

owner(): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:70

Get the owner of the contract.

Returns​

Promise<`0x${string}`>

The owner address.

startVesting()​

startVesting(amount, isPreapproved): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:204

Start vesting.

Parameters​
ParameterTypeDescription
amountbigintThe amount to vest.
isPreapprovedbooleanWhether the CARROT token is preapproved or should use permit.
Returns​

Promise<`0x${string}`>

The transaction.

startVestingPreapproved()​

startVestingPreapproved(amount): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:176

Start vesting for a user.

Parameters​
ParameterTypeDescription
amountbigintThe amount to vest.
Returns​

Promise<`0x${string}`>

The transaction.

startVestingWithPermit()​

startVestingWithPermit(permitData): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:189

Start vesting with permit.

Parameters​
ParameterTypeDescription
permitDataPermitDataThe permit data including deadline, amount, v, r, and s values.
Returns​

Promise<`0x${string}`>

The transaction.

totalPufferRewards()​

totalPufferRewards(): Promise<bigint>

Defined in: lib/contracts/handlers/carrot-vesting-handler.ts:128

Get the total puffer rewards.

Returns​

Promise<bigint>

The total puffer rewards.