context demo.agt

type Id = opaque Int where NonNegative

agent Wallet {
  key id: Id

  store balance: Cell[Int]
  store pending: Cell[Int]

  on call topup(amount: Int) -> Effect[Int] {
    let cur = balance
    balance := cur + amount
    Effect.pure(cur + amount)
  }
}
