Skip to main content

contracts/handlers/distributor-handler

Classes

DistributorHandler

Defined in: lib/contracts/handlers/distributor-handler.ts:33

Handler for the Merkle Distributor contract, for claiming rewards, e.g. mtwCARROT.

Constructors

Constructor

new DistributorHandler(chain, walletClient, publicClient): DistributorHandler

Defined in: lib/contracts/handlers/distributor-handler.ts:44

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

DistributorHandler

Methods

claim()

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

Defined in: lib/contracts/handlers/distributor-handler.ts:76

Claim tokens for multiple users.

Parameters
ParameterTypeDescription
account`0x${string}`The account making the claim.
paramsClaimParamsThe claim parameters.
Returns

Promise<`0x${string}`>

A promise that resolves to the transaction hash.

claimed()

claimed(user, token): Promise<ClaimInfo>

Defined in: lib/contracts/handlers/distributor-handler.ts:93

Get claim information for a user and token.

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

Promise<ClaimInfo>

The claim information.

core()

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

Defined in: lib/contracts/handlers/distributor-handler.ts:108

Get the core contract address.

Returns

Promise<`0x${string}`>

The core contract address.

disputeAmount()

disputeAmount(): Promise<bigint>

Defined in: lib/contracts/handlers/distributor-handler.ts:117

Get the dispute amount.

Returns

Promise<bigint>

The dispute amount.

disputePeriod()

disputePeriod(): Promise<number>

Defined in: lib/contracts/handlers/distributor-handler.ts:126

Get the dispute period.

Returns

Promise<number>

The dispute period in seconds.

disputer()

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

Defined in: lib/contracts/handlers/distributor-handler.ts:158

Get the current disputer address.

Returns

Promise<`0x${string}`>

The disputer address.

disputeToken()

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

Defined in: lib/contracts/handlers/distributor-handler.ts:135

Get the dispute token address.

Returns

Promise<`0x${string}`>

The dispute token address.

disputeTree()

disputeTree(account, reason): Promise<`0x${string}`>

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

Dispute the current tree.

Parameters
ParameterTypeDescription
account`0x${string}`The account disputing the tree.
reasonstringThe reason for the dispute.
Returns

Promise<`0x${string}`>

A promise that resolves to the transaction hash.

endOfDisputePeriod()

endOfDisputePeriod(): Promise<number>

Defined in: lib/contracts/handlers/distributor-handler.ts:167

Get the end of the dispute period.

Returns

Promise<number>

The timestamp when the dispute period ends.

getContract()

getContract(): object

Defined in: lib/contracts/handlers/distributor-handler.ts:57

Get the contract.

Returns

object

The viem contract.

getMerkleRoot()

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

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

Get the current merkle root.

Returns

Promise<`0x${string}`>

The current merkle root.

lastTree()

lastTree(): Promise<MerkleTree>

Defined in: lib/contracts/handlers/distributor-handler.ts:185

Get the last tree information.

Returns

Promise<MerkleTree>

The last tree information.

onlyOperatorCanClaim()

onlyOperatorCanClaim(user): Promise<bigint>

Defined in: lib/contracts/handlers/distributor-handler.ts:199

Check if only operators can claim for a user.

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

Promise<bigint>

Whether only operators can claim for the user.

toggleOnlyOperatorCanClaim()

toggleOnlyOperatorCanClaim(account, user): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/distributor-handler.ts:210

Toggle whether only operators can claim for a user.

Parameters
ParameterTypeDescription
account`0x${string}`The account toggling the setting.
user`0x${string}`The user address to toggle for.
Returns

Promise<`0x${string}`>

A promise that resolves to the transaction hash.

toggleOperator()

toggleOperator(account, user, operator): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/distributor-handler.ts:225

Toggle an operator for a user.

Parameters
ParameterTypeDescription
account`0x${string}`The account toggling the operator.
user`0x${string}`The user address.
operator`0x${string}`The operator address to toggle.
Returns

Promise<`0x${string}`>

A promise that resolves to the transaction hash.

toggleTrusted()

toggleTrusted(account, eoa): Promise<`0x${string}`>

Defined in: lib/contracts/handlers/distributor-handler.ts:239

Toggle whether an address is trusted.

Parameters
ParameterTypeDescription
account`0x${string}`The account toggling the trusted status.
eoa`0x${string}`The address to toggle trust for.
Returns

Promise<`0x${string}`>

A promise that resolves to the transaction hash.

tree()

tree(): Promise<MerkleTree>

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

Get the current tree information.

Returns

Promise<MerkleTree>

The current tree information.

Interfaces

ClaimInfo

Defined in: lib/contracts/handlers/distributor-handler.ts:17

Properties

PropertyTypeDefined in
amountbigintlib/contracts/handlers/distributor-handler.ts:18
merkleRoot`0x${string}`lib/contracts/handlers/distributor-handler.ts:20
timestampbigintlib/contracts/handlers/distributor-handler.ts:19

ClaimParams

Defined in: lib/contracts/handlers/distributor-handler.ts:23

Properties

PropertyTypeDefined in
amountsbigint[]lib/contracts/handlers/distributor-handler.ts:26
proofs`0x${string}`[][]lib/contracts/handlers/distributor-handler.ts:27
tokens`0x${string}`[]lib/contracts/handlers/distributor-handler.ts:25
users`0x${string}`[]lib/contracts/handlers/distributor-handler.ts:24

MerkleTree

Defined in: lib/contracts/handlers/distributor-handler.ts:12

Properties

PropertyTypeDefined in
ipfsHash`0x${string}`lib/contracts/handlers/distributor-handler.ts:14
merkleRoot`0x${string}`lib/contracts/handlers/distributor-handler.ts:13