Calling Other Contracts
This guide shows you how to call functions in other contracts from your Aztec smart contracts.
Add the target contract as a dependency
Add the contract you want to call to your Nargo.toml dependencies:
[dependencies]
token = { git="https://github.com/AztecProtocol/aztec-packages/", tag="v3.0.0-nightly.20251231", directory="noir-projects/noir-contracts/contracts/app/token_contract" }
Then import the contract interface at the top of your contract file:
use token::Token;
Call contract functions
Use self.call() to call functions on other contracts:
self.call(Token::at(token_address).transfer(recipient, amount));
The pattern is:
- Form the call:
Contract::at(address).function_name(args) - Execute it:
self.call(...)orself.view(...)for read-only calls
Private-to-private calls
private_call
let _ = self.call(Token::at(stable_coin).burn_private(from, amount, authwit_nonce));
Source code: noir-projects/noir-contracts/contracts/app/lending_contract/src/main.nr#L250-L252
Public-to-public calls
From a public function, call other public functions directly:
self.call(Token::at(token_address).transfer_in_public(recipient, amount));
Capture return values by assigning the result:
let balance = self.view(Token::at(token_address).balance_of_public(account));
Use self.view() for read-only calls that cannot modify state.
Private-to-public calls
From a private function, enqueue public function calls for later execution:
self.enqueue(Token::at(token_address).mint_to_public(recipient, amount));
info
Public functions execute after all private execution completes. Return values are not available in the private context. Learn more about call types.