Skip to main content

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

OperationDescription
Contract callsExecute any smart contract function
Multi-call batchingBundle multiple contract calls into one transaction
ERC-20 approve/transferFromToken allowance workflows
Trustline creationNetwork-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:

  1. Approve — allow the DEX contract to spend your tokens
  2. 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
note

Detailed contract interaction parameters, ABI encoding helpers, and multi-call batching examples are being finalized. Contact your account manager for current capabilities.

See Also