Documentation Index
Fetch the complete documentation index at: https://cobo.com/products/agentic-wallet/manual/llms.txt
Use this file to discover all available pages before exploring further.
What is a smart contract
A smart contract is a program deployed on a blockchain at a specific address. Like a wallet address, a contract address is a 42-character hex string on EVM chains — but unlike a wallet, it has no private key and cannot initiate transactions on its own. It only executes when called by an external account or another contract. When you send a transaction to a contract address with encoded function data, the contract executes that function. The execution is deterministic — every node on the network reaches the same result. Once executed, the result is permanent. Contracts are the building blocks of all of DeFi: Uniswap’s swap logic lives in contracts, Aave’s lending pool is a contract, and every ERC-20 token is a contract.Read functions vs. write functions
| Type | Gas required | Changes state | Examples |
|---|---|---|---|
| Read (view/pure) | No | No | balanceOf(), getReserves() |
| Write | Yes | Yes | transfer(), swap(), deposit(), approve() |
What is an ABI
An ABI (Application Binary Interface) is a description of a contract’s functions — their names, parameter types, and return types. Think of it as the contract’s instruction manual: it tells your code how to talk to the contract. Without the ABI, you would need to manually encode raw bytes to call a contract. With the ABI, libraries likeeth_abi (Python) and viem (TypeScript) handle all the encoding for you.
ABIs are publicly available for most major protocols on block explorers like Etherscan (look for the “Contract” tab on any verified contract).
How contract calls work
EVM chains
To call a function on a smart contract, you send a transaction containing calldata — a hex-encoded byte string that specifies which function to call and what arguments to pass. Calldata is structured as:- A 4-byte function selector — derived from the function’s name and parameter types
- Encoded arguments — each parameter encoded according to its type
eth_abi (Python) and viem (TypeScript) handle this encoding for you. You rarely need to encode manually.
Solana
On Solana, what EVM calls “smart contracts” are called programs. The interaction model is different: instead of calldata, you send a list of instructions, each specifying the program to invoke, an account list of all accounts the program can read or modify, and the instruction data. A key difference from EVM: Solana programs are stateless. All state is stored in separate accounts, not inside the program itself. This is why every Solana transaction must explicitly list the accounts it will touch.The ERC-20 approval pattern
Unlike native ETH, ERC-20 tokens can only be moved by the token owner — or by a contract the owner has explicitly authorized. DeFi protocols cannot pull tokens from your wallet until you callapprove on the token contract first.
This means most DeFi interactions are a two-step process:
- Approve — call
approveon the token contract to authorize the DeFi protocol to spend up to a certain amount of your tokens. - Interact — call the DeFi protocol function (swap, deposit, repay, etc.).
Events
Contracts emit events when significant state changes occur. Events are stored in the transaction receipt and can be monitored by off-chain services. Common examples:| Event | Contract | Fired when |
|---|---|---|
Transfer | Any ERC-20 | Tokens move between addresses |
Swap | Uniswap | A trade is executed |
Supply | Aave | A user deposits collateral |
Approval | Any ERC-20 | A spend allowance is set or updated |
Finding contract addresses and ABIs
- Block explorers: Search for the protocol name on Etherscan, Basescan, or Polygonscan. Verified contracts show their full ABI and source code.
- Protocol documentation: Uniswap, Aave, Curve, and other major protocols publish official deployment address lists in their documentation.