Cross-Contract Calls

To engage in Cross-Contract Calls, you must "Generate Proof" and, if preferred, make use of "Relayers."

Cross-Contract Calls serve as the primary means for Kalium to interact with external DeFi protocols and smart contracts. This versatile approach enables the chaining of numerous ordered contract calls, all executed against a private balance. These cross-contract interactions transpire within the overarching Kalium Relay Adapt contract, facilitating the execution of multiple serial calls within a single block.

Here's how it operates:

  1. First, an unshield operation is initiated, temporarily relocating tokens into the Relay Adapt contract from the private balance.

  2. Next, a multi-call process manages a multitude of contract calls involving the balance.

  3. Lastly, the results are shielded back into the user's private balance, all seamlessly unfolding within a single block and transaction.

As an illustration, the Kalium Wallet incorporates the 0x API to facilitate private swaps. This process encompasses two consecutive cross-contract calls. Initially, the exact swap token amount is approved for expenditure. Subsequently, the 0x token swap takes place. The contract spend approval serves as a safeguard during each swap transaction, guaranteeing that the swap amount is consistently approved within the execution block. In the event of a contract call failure, the entire call will revert.

Last updated