Skip to main content

contracts/handlers/lagoon-vault-handler

Classes

LagoonVaultHandler

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

Constructors

new LagoonVaultHandler()

new LagoonVaultHandler(chain, walletClient, publicClient): LagoonVaultHandler

Create the handler for processing Lagoon vault.

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

LagoonVaultHandler

Source

lib/contracts/handlers/lagoon-vault-handler.ts:30

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

approve()

approve(spender, amount): Promise<`0x${string}`>

Approve a spender to spend the token.

Parameters
ParameterTypeDescription
spender`0x${string}`The spender of the token.
amountbigintThe amount to approve.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:63

claimSharesAndRequestRedeem()

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

Claim shares and request a redeem of an amount of the shares (tacpufETH) so the receiver gets the assets (pufETH).

Parameters
ParameterTypeDescription
sharesbigintThe amount of shares (tacpufETH) to claim.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:389

claimSharesOnBehalf()

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

Claim shares on behalf of multiple controllers.

Parameters
ParameterTypeDescription
controllers`0x${string}`[]The controllers to claim shares on behalf of.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:402

claimableDepositRequest()

claimableDepositRequest(requestId, controller): Promise<bigint>

Get the claimable deposit request for the request id and controller.

Parameters
ParameterTypeDescription
requestIdbigintThe request id. Use 0 as wild card.
controller`0x${string}`The controller. Usually the depositor or user who initiated the deposit.
Returns

Promise<bigint>

The claimable deposit request.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:360

claimableRedeemRequest()

claimableRedeemRequest(requestId, controller): Promise<bigint>

Get the claimable redeem request for the request id and controller.

Parameters
ParameterTypeDescription
requestIdbigintThe request id. Use 0 as wild card.
controller`0x${string}`The controller. Usually the redeemer or user who initiated the redeem.
Returns

Promise<bigint>

The claimable redeem request.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:375

convertToAssets()

convertToAssets(shares, requestId?): Promise<never>

Convert an amount of the shares (tacpufETH) to the assets (pufETH).

Parameters
ParameterTypeDescription
sharesbigintThe amount of shares (tacpufETH) to convert.
requestId?bigintAn optional request id for the conversion.
Returns

Promise<never>

The amount of assets (pufETH).

Source

lib/contracts/handlers/lagoon-vault-handler.ts:329

convertToShares()

convertToShares(assets, requestId?): Promise<never>

Convert an amount of the assets (pufETH) to the shares (tacpufETH).

Parameters
ParameterTypeDescription
assetsbigintThe amount of assets (pufETH) to convert.
requestId?bigintAn optional request id for the conversion.
Returns

Promise<never>

The amount of shares (tacpufETH).

Source

lib/contracts/handlers/lagoon-vault-handler.ts:344

deposit()

deposit(amount, receiver, controller?): Promise<`0x${string}`>

Deposit an amount of the assets (pufETH) to the vault to get shares (tacpufETH).

Parameters
ParameterTypeDescription
amountbigintThe amount to deposit.
receiver`0x${string}`The receiver of the tacpufETH.
controller?`0x${string}`The optional controller of the deposit. Set to the receiver if not sure.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:129

getAllowance()

getAllowance(owner, spender): Promise<bigint>

Get the allowance of the owner for the spender.

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

Promise<bigint>

The allowance.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:77

getBalance()

getBalance(address): Promise<bigint>

Get the balance for the address.

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

Promise<bigint>

The balance.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:87

getContract()

getContract(): object

Get the contract.

Returns

object

The viem contract.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:43

getTotalSupply()

getTotalSupply(): Promise<bigint>

Get the total supply of the token.

Returns

Promise<bigint>

The total supply.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:96

isTotalAssetsValid()

isTotalAssetsValid(): Promise<boolean>

Check if the total assets are valid. Used for checking if synchronous deposit is possible.

Returns

Promise<boolean>

True if the total assets are valid, false otherwise.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:106

pendingDepositRequest()

pendingDepositRequest(requestId, controller): Promise<bigint>

Get the pending deposit request for the request id and controller.

Parameters
ParameterTypeDescription
requestIdbigintThe request id. Use 0 as wild card.
controller`0x${string}`The controller. Usually the depositor or user who initiated the deposit.
Returns

Promise<bigint>

The pending deposit request.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:199

pendingRedeemRequest()

pendingRedeemRequest(requestId, controller): Promise<bigint>

Get the pending redeem request for the request id and controller.

Parameters
ParameterTypeDescription
requestIdbigintThe request id. Use 0 as wild card.
controller`0x${string}`The controller. Usually the redeemer or user who initiated the redeem.
Returns

Promise<bigint>

The pending redeem request.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:280

previewDeposit()

previewDeposit(amount): Promise<bigint>

Provides a preview of the number of shares that would be minted for a given deposit amount, after fees.

Parameters
ParameterTypeDescription
amountbigintThe amount to deposit.
Returns

Promise<bigint>

The preview.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:294

previewRedeem()

previewRedeem(shares): Promise<bigint>

Provides a preview of the amount of assets (pufETH) that would be redeemed for the given shares (tacpufETH), after withdrawal fees. Subtracts the withdrawal fee from the share amount to determine the net shares for asset conversion.

Parameters
ParameterTypeDescription
sharesbigintThe amount of shares (tacpufETH) to redeem.
Returns

Promise<bigint>

The preview.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:318

previewWithdraw()

previewWithdraw(assets): Promise<bigint>

Provides a preview of the number of shares (tacpufETH) that would be burned for the given amount of assets (pufETH).

Parameters
ParameterTypeDescription
assetsbigintThe amount of assets (pufETH) to withdraw.
Returns

Promise<bigint>

The preview.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:305

redeem()

redeem(shares, receiver, controller): Promise<`0x${string}`>

Redeem an amount of the shares (tacpufETH) so the receiver gets the assets (pufETH).

Parameters
ParameterTypeDefault valueDescription
sharesbigintundefinedThe amount of shares (tacpufETH) to redeem.
receiver`0x${string}`undefinedThe receiver of the assets.
controller`0x${string}`receiverThe controller of the withdrawal. Falls back to the receiver if not provided.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:237

requestDeposit()

requestDeposit(amount, receiver, controller): Promise<`0x${string}`>

Request an asynchronous deposit of an amount of the assets (pufETH) to the vault to get shares (tacpufETH). This should be used if isTotalAssetsValid is false.

Parameters
ParameterTypeDefault valueDescription
amountbigintundefinedThe amount to deposit.
receiver`0x${string}`undefinedThe receiver of the tacpufETH.
controller`0x${string}`receiverThe optional controller of the deposit. Falls back to the receiver if not provided.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:176

requestRedeem()

requestRedeem(shares, receiver, controller): Promise<`0x${string}`>

Request an asynchronous redeem of an amount of the shares (tacpufETH) so the receiver gets the assets (pufETH).

Parameters
ParameterTypeDefault valueDescription
sharesbigintundefinedThe amount of shares (tacpufETH) to redeem.
receiver`0x${string}`undefinedThe receiver of the assets.
controller`0x${string}`receiverThe controller of the redemption. Falls back to the receiver if not provided.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:258

symbol()

symbol(): Promise<string>

Get the symbol of the token. (tacpufETH)

Returns

Promise<string>

The symbol.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:115

syncDeposit()

syncDeposit(amount, receiver, referral): Promise<`0x${string}`>

Synchronously deposit an amount of the assets (pufETH) to the vault to get shares (tacpufETH). This is only possible if isTotalAssetsValid is true.

Parameters
ParameterTypeDefault valueDescription
amountbigintundefinedThe amount to deposit.
receiver`0x${string}`undefinedThe receiver of the tacpufETH.
referral`0x${string}`receiverThe referral of the deposit. Falls back to the receiver if not provided.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:154

withdraw()

withdraw(assets, receiver, controller): Promise<`0x${string}`>

Withdraw an amount of the shares (pufETH) so the receiver gets the assets (pufETH).

Parameters
ParameterTypeDefault valueDescription
assetsbigintundefinedThe amount of assets (pufETH) to withdraw.
receiver`0x${string}`undefinedThe receiver of the assets.
controller`0x${string}`receiverThe controller of the withdrawal. Falls back to the receiver if not provided.
Returns

Promise<`0x${string}`>

The transaction.

Source

lib/contracts/handlers/lagoon-vault-handler.ts:216