@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
47 lines (46 loc) • 2.15 kB
TypeScript
/**
* Rolly deposit via VaultDepositor.
*
* Deposit flow wraps Rolly's `depositToken()` call inside the VaultDepositor
* proxy so it composes with EXACT_INPUT quoting:
* 1. approve(token, VAULT_DEPOSITOR[arbitrum], MAX)
* 2. VAULT_DEPOSITOR[arbitrum].deposit(token, ROLLY_VAULT,
* depositToken(recipient, AMOUNT_PLACEHOLDER), 0)
* VaultDepositor pulls the msg.sender's full token balance (USDT0 by default)
* at exec time and substitutes AMOUNT_PLACEHOLDER with the actual amount
* before calling Rolly.depositToken, so the arrival amount doesn't need to be
* known at quote time.
*/
import { type Address } from 'viem';
import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
/** Rolly rollup deposit contract on Arbitrum (UUPS proxy). */
export declare const ROLLY_VAULT_ADDRESS: `0x${string}`;
/** Arbitrum USDT0 — Rolly's source deposit token. */
export declare const ARBITRUM_USDT0: `0x${string}`;
/** VaultDepositor on Arbitrum — same address used by other VaultDepositor flows. */
export declare const VAULT_DEPOSITOR_ARBITRUM: `0x${string}`;
/** Sentinel value the VaultDepositor replaces with the actual deposit amount at exec time. */
export declare const AMOUNT_PLACEHOLDER = 115792089237316195423570985008687907853269984665640564039457584007912570601199n;
export interface RollyDepositActionsConfig {
/** Address credited on the Rolly rollup (typically the connected wallet). */
recipientAddress: Address | undefined;
/** Token being deposited. Defaults to USDT0. */
tokenAddress?: Address;
/** Rolly vault contract the deposit is forwarded to. Defaults to ROLLY_VAULT_ADDRESS. */
vaultAddress?: Address;
}
/**
* Builds the `generateActionsParams` callback for a Rolly deposit routed
* through VaultDepositor.
*
* Usage:
* ```ts
* const checkoutConfig: FunkitCheckoutConfig = {
* // ...
* generateActionsParams: createRollyDepositActions({
* recipientAddress: walletAddress,
* }),
* }
* ```
*/
export declare function createRollyDepositActions(config: RollyDepositActionsConfig): () => Promise<FunkitCheckoutActionParams[]>;