Skip to main content

1-Click Vault Activation with Account Abstraction

Overview

CreatorVault uses ERC-4337 Account Abstraction to batch all activation steps into ONE transaction, powered by Coinbase Smart Wallet.


How It Works

Traditional Flow (6 separate transactions ❌)

User → Approve AKITA → Wait...
User → Deposit AKITA → Wait...
User → Approve shares → Wait...
User → Wrap shares → Wait...
User → Approve wsTokens → Wait...
User → Launch auction → Wait...

AA Flow (1 transaction ✅)

User → Launch Auction (1-Click) → Done!

Smart Wallet batches:
1. approve(AKITA, vault, amount)
2. deposit(amount, user)
3. approve(shares, wrapper, amount)
4. wrap(amount)
5. approve(wsAKITA, cca, auctionAmount)
6. launchAuctionSimple(auctionAmount, requiredRaise)

Implementation

Frontend (ActivateAkita.tsx)

// Encode all calls
const calls = [
{ to: AKITA.token, data: encodeFunctionData({ abi: erc20Abi, functionName: 'approve', ... }) },
{ to: AKITA.vault, data: encodeFunctionData({ abi: VAULT_ABI, functionName: 'deposit', ... }) },
{ to: AKITA.vault, data: encodeFunctionData({ abi: erc20Abi, functionName: 'approve', ... }) },
{ to: AKITA.wrapper, data: encodeFunctionData({ abi: WRAPPER_ABI, functionName: 'wrap', ... }) },
{ to: AKITA.shareOFT, data: encodeFunctionData({ abi: erc20Abi, functionName: 'approve', ... }) },
{ to: AKITA.ccaStrategy, data: encodeFunctionData({ abi: CCA_ABI, functionName: 'launchAuctionSimple', ... }) },
]

// Send as single batched transaction
sendTransaction({
to: address,
data: '0x',
value: 0n,
calls, // Smart wallet executes all calls atomically
})

Smart Contract Fallback (VaultActivationBatcher.sol)

For users without smart wallets (MetaMask, Rainbow, etc.), we provide a helper contract:

contract VaultActivationBatcher {
function batchActivate(
address creatorToken,
address vault,
address wrapper,
address ccaStrategy,
uint256 depositAmount,
uint8 auctionPercent,
uint128 requiredRaise
) external returns (address auction) {
// Pulls tokens, deposits, wraps, launches auction
// Returns remaining wsTokens to user
}
}

Usage:

// 1. User approves batcher to spend AKITA
approve(AKITA, batcher, amount)

// 2. User calls batchActivate
batchActivate(AKITA, vault, wrapper, cca, amount, 50, minRaise)

User Experience

With Coinbase Smart Wallet ⚡

1. Click "Launch Auction (1-Click)"
2. Confirm ONCE in wallet
3. Done! ✅

Benefits:

  • ✅ Single confirmation
  • ✅ Potentially gasless (sponsored)
  • ✅ Instant execution
  • ✅ No intermediate failures

With EOA (MetaMask, etc.) 🐢

1. Click "Launch Auction (1-Click)"
2. App switches to VaultActivationBatcher
3. Approve batcher (if needed)
4. Call batchActivate
5. Done! ✅

Benefits:

  • ✅ Still 2 transactions (vs 6)
  • ✅ Atomic execution (all or nothing)
  • ✅ No intermediate token approvals

Why This Matters

For Users:

  • Speed: 1 click vs 6 confirmations
  • Simplicity: No complex multi-step flow
  • Safety: Atomic execution (no partial failures)
  • Cost: Potentially gasless with smart wallets

For Creators:

  • Lower friction: More likely to activate vaults
  • Better UX: Feels like Web2, powered by Web3
  • Professional: Enterprise-grade dApp experience

Technical Details

Smart Wallet Detection

const isSmartWallet = connector?.id === 'coinbaseWalletSDK'

Call Encoding

encodeFunctionData({
abi: erc20Abi,
functionName: 'approve',
args: [spender, amount],
})

Batch Execution

sendTransaction({
to: address, // Smart wallet address
data: '0x',
value: 0n,
calls: [...], // Array of { to, data, value }
})

Fallback Pattern

// If smart wallet batch fails, use helper contract
batcher.batchActivate(...)

Deployment

Frontend

  • ✅ Already deployed on Vercel
  • ✅ Smart wallet detection automatic
  • ✅ Falls back to VaultActivationBatcher for EOAs

Contracts

  • ✅ VaultActivationBatcher.sol created
  • ⏳ TODO: Deploy to Base mainnet
  • ⏳ TODO: Update CONTRACTS config with batcher address

Next Steps

To Enable Full 1-Click:

  1. Deploy VaultActivationBatcher

    cd contracts
    forge create VaultActivationBatcher --rpc-url base --private-key $PRIVATE_KEY
  2. Update Frontend Config

    // frontend/src/config/contracts.ts
    export const CONTRACTS = {
    ...
    batcher: '0x...', // Add deployed batcher address
    }
  3. Update ActivateAkita.tsx

    // Add fallback for non-smart-wallet users
    if (!isSmartWallet) {
    // Use VaultActivationBatcher instead
    writeContract({
    address: CONTRACTS.batcher,
    abi: BATCHER_ABI,
    functionName: 'batchActivate',
    args: [...],
    })
    }

Testing

Smart Wallet Flow

  1. Connect with Coinbase Smart Wallet
  2. Go to /activate-akita
  3. Click "Launch Auction (1-Click)"
  4. Should see 1 confirmation popup
  5. All 6 steps execute in one tx

EOA Flow (Current)

  1. Connect with MetaMask
  2. Go to /activate-akita
  3. Click "Launch Auction (1-Click)"
  4. See warning about multi-step process
  5. Execute via sendTransaction (will fail on EOA)
  6. TODO: Fallback to VaultActivationBatcher

Security Considerations

Smart Wallet Batching

  • ✅ Atomic execution (all or nothing)
  • ✅ User controls all approvals
  • ✅ No intermediate token custody
  • ✅ Revert-safe (gas refunded on failure)

VaultActivationBatcher

  • ✅ No token custody (pull pattern)
  • ✅ User must approve first
  • ✅ ReentrancyGuard on batchActivate
  • ✅ Returns excess tokens immediately
  • ⚠️ User trusts batcher contract code

Gas Comparison

Traditional (6 txs)

Approve:  ~45k gas
Deposit: ~80k gas
Approve: ~45k gas
Wrap: ~60k gas
Approve: ~45k gas
Launch: ~200k gas
-----------------------
TOTAL: ~475k gas (~$15 at 20 gwei)

AA Batched (1 tx)

Batch:    ~450k gas (~$14 at 20 gwei)
+ Potentially sponsored (FREE!)

Batcher (2 txs)

Approve:  ~45k gas
Batch: ~400k gas
-----------------------
TOTAL: ~445k gas (~$14 at 20 gwei)

Savings: 6% gas + 83% fewer clicks!


Resources


Summary

Smart Wallet Users: 1-click, potentially gasless, instant ⏳ EOA Users: 2 clicks via VaultActivationBatcher (after deployment) 🚀 Result: Professional dApp experience with minimal friction