AgentSkillsCN

cairo-contract-interactions

当请求涉及在 Cairo 中定义或公开合约函数时,讲解 Starknet 合约的入口点(外部函数、视图函数、构造函数、L1 处理器)以及 ABI 配置。

SKILL.md
--- frontmatter
name: cairo-contract-interactions
description: Explain how to call another Starknet contract using dispatcher patterns and interfaces; use when a request involves cross-contract calls, dispatchers, or contract_call_syscall.

Cairo Contract Interactions

Overview

Guide contract to contract calls using interfaces, dispatchers, and low-level syscalls.

Quick Use

  • Read references/contract-interactions.md before answering.
  • Prefer generated dispatchers over raw syscalls.
  • Mention safe dispatchers for error handling.

Response Checklist

  • Define an interface trait for the target contract.
  • Use a ContractDispatcher with a contract address.
  • Use SafeDispatcher when return errors must be handled explicitly.
  • Use contract_call_syscall only for low-level control.

Example Requests

  • "How do I call another contract from Cairo?"
  • "What is the difference between safe and unsafe dispatchers?"
  • "How do I use contract_call_syscall directly?"