Guides

Earn with Morpho

Let your users earn on USDC in a Morpho vault, with Execute.

Your user sends USDC to an executable address, which deposits it into Steakhouse Prime USDC, a Morpho vault on Base, and the vault’s shares go to your user’s wallet. They never connect their wallet to your app, and never approve anything.

  1. Get an API key

    Create one in the dashboard, and keep it on your server. From a web page, use a client ID instead.

  2. The contracts

    Everything happens on Base. The intent calls these contracts, and nothing else:

    ContractAddressWhy
    USDC0x8335…2913The token your user deposits.
    Steakhouse Prime USDC0xbeef…73C9A Morpho vault curated by Steakhouse Financial: an ERC-4626 vault that lends USDC across Morpho markets.
  3. The intent

    The token is USDC, and the amount is in its base units: USDC has 6 decimals, so 100 USDC is "100000000". Once the address holds exactly the amount, it makes these calls, as itself, in one transaction:

    1approve(address spender, uint256 amount)on USDC

    An ERC-4626 deposit pulls its assets with transferFrom, so the address first allows the vault to take exactly the amount, and no more.

    ArgumentValueWhy
    spender0xbeef…73C9The vault, which takes the USDC in the next call.
    amount$AMOUNTExactly the deposit, so nothing is left approved afterwards.

    2deposit(uint256 assets, address receiver)on Steakhouse Prime USDC

    The ERC-4626 deposit: the vault takes the USDC and mints its shares to receiver.

    ArgumentValueWhy
    assets$AMOUNTAll of the USDC.
    receiver$WALLETYour user’s wallet: the shares are theirs.

    recovery is $WALLET: your user’s wallet, so if the deposit can’t happen, their USDC goes straight back to them.

  4. Create the address

    Post the intent to Create an address. The expiry is 5 minutes away and the salt is random, so every run gives a new address:

    Request
    AMOUNT=100000000   # the deposit in base units: 100 USDC
    WALLET=0x…         # your user’s wallet
    
    curl https://api.execute.cash/v1/address/create \
      -H "Authorization: Bearer $EXECUTE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "amount": "'$AMOUNT'",
        "calls": [
          {
            "target": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "function": "approve(address spender, uint256 amount)",
            "args": ["0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9", "'$AMOUNT'"]
          },
          {
            "target": "0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9",
            "function": "deposit(uint256 assets, address receiver)",
            "args": ["'$AMOUNT'", "'$WALLET'"]
          }
        ],
        "expirationTimestamp": '$(( $(date +%s) + 300 ))',
        "recovery": "'$WALLET'",
        "salt": "0x'$(openssl rand -hex 32)'",
        "chainId": 8453
      }'

    The response’s address is the executable address. Check it as the quickstart shows before you show it to anyone.

  5. Show it to your user

    Show the address with the exact amount, the token and the chain, in words, and a way to copy each. Beside them, a QR code of an EIP-681 payment request lets your user’s wallet fill in the chain, the token and the amount by itself:

    Payment request
    // address and intent, from the create response
    const request = `ethereum:${intent.token}@${intent.chainId}/transfer?address=${address}&uint256=${intent.amount}`;

    uint256 is in the token’s base units, like the intent’s amount. Say under the code what it fills in, and offer a plain code of the address alone for wallets that can’t read a request; your user then picks the token and chain and enters the amount themselves. The address’s page, execute.cash/address/<address>, shows your user what paying it will do.

    Your user pays with an ordinary transfer, from any wallet or exchange. They connect nothing and approve nothing.

  6. Track it

    Poll the address’s status, or get webhooks. Once it’s settled, your user’s wallet holds Steakhouse Prime USDC shares. They grow in value as the vault earns, and redeem for USDC at any time, from any app that supports Morpho.