sophia/test/contracts/spend_test.aes
Gaith Hallak 99364222ea Add functions as fields before inferring
Unbound untyped fields before binding typed ones

Fix failing tests

Make complex_types contract non-compatible with aevm

Reduce code duplication

Undo changes to test.aes

Remove special handling of __constructor__ field

Resolve field constraint by arity of contract function

Update CHANGELOG

Update CHANGELOG.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

Split bind_field function

Add a comment about rebinding
2022-10-23 14:10:25 +03:00

24 lines
558 B
Plaintext

contract SpendTest =
stateful entrypoint spend(to, amount) =
let total = Contract.balance
Chain.spend(to, amount)
total - amount
stateful entrypoint withdraw(amount) : int =
spend(Call.caller, amount)
stateful entrypoint withdraw_from(account, amount) =
account.withdraw(amount)
withdraw(amount)
stateful entrypoint spend_from(from, to, amount) =
from.withdraw(amount)
Chain.spend(to, amount)
Chain.balance(to)
entrypoint get_balance() = Contract.balance
entrypoint get_balance_of(a) = Chain.balance(a)