Advanced Features
Last updated March 20, 2026 ยท Estimated read time: 15 minutes
1.1 Contract-to-Contract Calls
Asentum contracts can call other deployed contracts using the chain.call(address, method, args) API. Each call costs 2,500 gas plus the child contract's execution gas. Calls are synchronous within a transaction โ no callbacks, no promises.
This enables composable DeFi: a lending contract can check a price oracle, verify collateral in a token contract, and update a liquidation registry โ all in one atomic transaction.
1.2 Gas Optimization
Gas is metered by V8 instruction count, so JavaScript performance best practices directly reduce gas costs. Minimize storage writes (20,000 gas for new slots, 5,000 for updates), batch operations where possible, and use BigInt for all financial math.
The playground shows real-time gas estimates as you write code. Use asentum.estimateGas(tx) to simulate transactions before submitting.
1.3 Events and Indexing
Emit events from contracts using emit("Transfer", { from, to, amount }). Events cost 375 gas + 8 gas per byte and are indexed for efficient querying via the JSON-RPC API.
Subscribe to real-time events using @asentum/sdk WebSocket connections. Build reactive UIs that update the moment a transaction is confirmed.
1.4 Advanced Testing Patterns
Use Jest or Mocha with the Asentum test harness. The @asentum/testing package provides a local chain simulator, time manipulation (advance blocks), snapshot/revert for state isolation, and mock accounts with pre-funded balances.
Run npx @asentum/cli test to execute your test suite against a local chain instance. Tests run in parallel by default.
1.5 Contract Upgradability
Asentum supports the proxy pattern for upgradeable contracts. Deploy a proxy contract that delegates calls to an implementation contract. Upgrade by pointing the proxy to a new implementation โ state persists, logic changes.
1.6 Bridge Integration
Asentum bridges connect to Ethereum and Solana for cross-chain asset transfers. Bridge contracts lock tokens on one chain and mint wrapped equivalents on the other. A small bridge fee applies to each transfer.