Smart Contract Interactions
Beyond simple asset transfers, Carabaas supports arbitrary smart contract execution on supported networks. All contract interactions go through the same MPC signing and approval pipeline.
Supported Operations
| Operation | Description |
|---|---|
| Contract calls | Execute any smart contract function |
| Multi-call batching | Bundle multiple contract calls into one transaction |
| ERC-20 approve/transferFrom | Token allowance workflows |
| Trustline creation | Network-specific asset opt-in (Stellar, Ripple) |
Creating Contract Transactions
Contract interactions use the standard transaction creation endpoint with additional parameters in the options field:
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"vaultId": "kR7mNpX2wQvL9sYhBjD4eT",
"addressId": "gMP71sR5sNUnGdKFTsNzp6",
"destination": "0xContractAddress...",
"network": "ethereum-mainnet",
"asset": "c1",
"amount": "0",
"options": {
"gasLimit": 150000,
"data": "0x..."
}
}' \
https://api.carabaas.com/api/v1/transactions
Transaction Simulation
Always simulate contract interactions before executing:
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vaultId": "kR7mNpX2wQvL9sYhBjD4eT",
"destination": "0xContractAddress...",
"network": "ethereum-mainnet",
"asset": "c1",
"amount": "0",
"options": {
"gasLimit": 150000,
"data": "0x..."
}
}' \
https://api.carabaas.com/api/v1/transactions/simulate
The simulation returns estimated gas costs and balance changes without broadcasting.
Decoded Transaction Details
After a contract transaction is created, retrieve the decoded call data:
curl -H "Authorization: Bearer $TOKEN" \
https://api.carabaas.com/api/v1/transactions/{txId}/decoded
This returns human-readable details of the contract function call, parameters, and expected effects.
Common Contract Patterns
Token Approval + Swap
A typical DeFi swap requires two transactions:
- Approve — allow the DEX contract to spend your tokens
- Swap — execute the swap function on the DEX contract
Use the Setup Allowance Flow for step 1, then create a contract call for step 2.
Multi-Step Workflows
For complex workflows involving multiple contract calls, use the transaction flows API:
curl -H "Authorization: Bearer $TOKEN" \
https://api.carabaas.com/api/v1/transactions/flows/{flowId}
Security Considerations
- Simulate before executing — always use the simulation endpoint to preview contract interactions
- Review decoded data — verify the contract function and parameters match your intent
- Dedicated vaults — use separate vaults for contract interactions with appropriate approval policies
- Quorum approval — ensure high-value contract interactions require multi-party approval
Detailed contract interaction parameters, ABI encoding helpers, and multi-call batching examples are being finalized. Contact your account manager for current capabilities.