Supply to a Pool

Enable a user to supply assets into a Teller ERC4626 pool.

Addresses you’ll need per pool

  • asset: ERC20 you deposit (e.g. WBTC)

  • vault: Teller Pool (ERC4626 vault mints/burns shares)

The following code example is in typescript. These smart contract integrations can be generalized to any codebase.

Minimal ABIs

// ERC20 (approve/allowance/balanceOf/decimals)
export const erc20Abi = [
  { type:'function', name:'decimals', stateMutability:'view', inputs:[], outputs:[{type:'uint8'}]},
  { type:'function', name:'balanceOf', stateMutability:'view', inputs:[{type:'address'}], outputs:[{type:'uint256'}]},
  { type:'function', name:'allowance', stateMutability:'view', inputs:[{type:'address'},{type:'address'}], outputs:[{type:'uint256'}]},
  { type:'function', name:'approve', stateMutability:'nonpayable', inputs:[{type:'address'},{type:'uint256'}], outputs:[{type:'bool'}]},
] as const;

// ERC4626 (deposit/redeem/convertToAssets/balanceOf)
export const erc4626Abi = [
  { type:'function', name:'deposit',  stateMutability:'nonpayable', inputs:[{type:'uint256','name':'assets'},{type:'address','name':'receiver'}], outputs:[{type:'uint256'}] },
  { type:'function', name:'redeem',   stateMutability:'nonpayable', inputs:[{type:'uint256','name':'shares'},{type:'address','name':'receiver'},{type:'address','name':'owner'}], outputs:[{type:'uint256'}] },
  { type:'function', name:'convertToAssets', stateMutability:'view', inputs:[{type:'uint256','name':'shares'}], outputs:[{type:'uint256'}]},
  { type:'function', name:'balanceOf', stateMutability:'view', inputs:[{type:'address'}], outputs:[{type:'uint256'}]},
] as const;

SUPPLY (approve asset → vault.deposit)

READS for UI: balances

Supplied in Teller pool (shares held, not staked)

Last updated