Clarity theorytheory 0/50 · 0%
Context · medium

23. Contract Identity: as-contract

Executing as the contract principal.

The `as-contract` function changes the `tx-sender` to the current contract's principal for the duration of the expression. This is essential for the contract to sign for its own assets.

clarity
(as-contract (stx-transfer? u100 (as-contract tx-sender) 'SP3FG...))

Check your understanding

  1. 1. What does as-contract change?