Examples · learn/18-approval · 237 of 339
task-2.solution
tin run examples/learn/18-approval/task-2.solution.tin/// Move money. Cannot be undone.
guarded fn wire(to: string, cents: int): string => "sent {cents} to {to}"
fn payInvoice(id: int): string => wire("vendor-{id}", 100)
/// Pay an invoice by id.
guarded tool fn pay(id: int): string => payInvoice(id) // now a person approves every payment
agent Clerk { model: "mock", tools: [pay] }
fn main() {
print(Clerk("pay 7"))
}