Clarity theorytheory 0/50 · 0%
Traits · hard

39. Dynamic Contract Interaction

Passing contracts as arguments.

By using traits as argument types, a contract can interact with any other contract that satisfies the trait interface, enabling decentralized exchanges and aggregators.

clarity
(define-public (swap (token <nft-trait>))
  (contract-call! token transfer ...))

Check your understanding

  1. 1. How do you pass a contract as a parameter?