Account #140
| Field | Value | Notes |
|---|---|---|
| Account Key | null | Ed25519 public key (null for actors) |
| Balance | | Convex coin balance |
| Field | Value | Notes |
|---|---|---|
| Account Key | null | Ed25519 public key (null for actors) |
| Balance | | Convex coin balance |
| Field | Value | Description |
|---|---|---|
:sequence | 0 | Number of transactions executed by this account to date. |
:key | nil | Ed25519 public key of this account. If nil, account cannot execute external transactions (e.g. an actor). |
:balance | | CVM balance of account. This is used for transaction fees and may be freely transferred. |
:allowance | 0 | Memory allowance credit on the CVM. If positive, the account may allocated up to this amount of memory before incurring fees for additional memory. |
:holdings | 0 value(s) | Storage for holdings data referenced by other accounts. |
:controller | nil | Account controller. If set, the controller can execute code in this account (e.g. change the key). If you don't trust the controller, don't trust the account! |
:environment | 7 value(s) | Symbols defined in this account. Typically used to store data or executable code. |
:metadata | 4 value(s) | Metadata attached to symbols defined in this account. |
:parent | nil | Parent account. This defines fallback values for symbols not defined in this account. |
The Environment contains symbols defined in this account. These may be referenced like: #45/symbol-name
| Symbol | Value | Description |
|---|---|---|
tips | {"https://youtu.be/0_JYCAOKKcM" {:amount 1}} | nil |
tip! | (fn [tip] (let [recipient (:recipient %0) artifact (:artifact %0) finalized? (get-in #140/tips (vector %2 :finalized?)) ] (cond (not %2) (fail :ARGUMENT "Arg map must contain :artifact") %3 (fail :STATE "This tip has been finalized") (not (= *caller* #140/owner)) (fail :TRUST (str *caller* " not authorised to tip on behalf of " #140/owner " (in *address*: " *address* ")")) :else (let [amount (cond (get-in #140/tips (vector %2 :amount)) *result* *offer*) recipient (cond %1 *result* (:recipient (#140/tips %2))) tip (assoc %0 :amount %4) ] (cond %5 (def tips (assoc-in #140/tips (vector %2 :recipient) %5)) nil) (cond (not (> %4 0)) (fail :FUNDS "No tip offered!") (do (accept %4) (def tips (assoc-in #140/tips (vector %2 :amount) %4)) (return "Thanks for the tip!") (cond (cond %5 %2 *result*) (#140/finalize! %6) nil))))))) | nil |
collect | (fn [artifact] (let [recipient (get-in #140/tips (vector %0 :recipient)) ] (cond (((fn [sym] (get (#9/read %0) 0)) convex.trust)/trusted? %1 *caller*) (let [amount (cond (get-in #140/tips (vector %0 :amount)) *result* 0) ] (def tips (dissoc #140/tips %0)) (transfer *caller* %2)) (fail :TRUST "Not authorised to collect funds")))) | nil |
frozen? | false | nil |
finalize! | (fn [tip] (let [artifact (:artifact %0) recipient (get-in #140/tips (vector %1 :recipient)) amount (get-in #140/tips (vector %1 :amount)) finalized? (get-in #140/tips (vector %1 :finalized?)) ] (cond (not (cond %2 %3 *result*)) (fail :STATE "The recipient and the tip amount must be set") (def tips (assoc-in #140/tips (vector %1 :finalized?) true))))) | nil |
owner | #135 | nil |
upgrade | (fn [code] (cond #140/frozen? (fail :STATE "Cannot upgrad. The tipper logic has been frozen") (cond (= *caller* #140/owner) (eval %0) (fail :TRUST "Not authorised to upgrade")))) | nil |
Holdings track token balances and other indexed values by address.
| Address | Value |
|---|