Convex

Convex

Account #69
Account 70 / 14299
FieldValueNotes
Account KeynullEd25519 public key (null for actors)
Balance
            0.000000000
Convex coin balance
Account Fields
FieldValueDescription
:sequence0Number of transactions executed by this account to date.
:keynilEd25519 public key of this account. If nil, account cannot execute external transactions (e.g. an actor).
:balance
            0.000000000
CVM balance of account. This is used for transaction fees and may be freely transferred.
:allowance0Memory allowance credit on the CVM. If positive, the account may allocated up to this amount of memory before incurring fees for additional memory.
:holdings0 value(s)Storage for holdings data referenced by other accounts.
:controller#6Account 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!
:environment18 value(s)Symbols defined in this account. Typically used to store data or executable code.
:metadata18 value(s)Metadata attached to symbols defined in this account.
:parentnilParent account. This defines fallback values for symbols not defined in this account.
Environment (18)

The Environment contains symbols defined in this account. These may be referenced like: #45/symbol-name

SymbolValueDescription
receive-asset(fn [path quantity _] (let [box-id (int *scope*) ] (#65/accept *caller* %0 %1) (cond (not (contains-key? #69/boxes %2)) (fail :STATE "Target box does not exist") (not (contains-key? (get #69/ownership *caller*) %2)) (fail :TRUST (str "Box " %2 " not owned"))) (def boxes (assoc #69/boxes %2 (#65/quantity-add (get #69/boxes %2) (vector %0 %1))))))nil
create(fn [] (let [id #69/counter owner *caller* owned-boxes (cond (get #69/ownership %1) *result* #{}) ] (def ownership (assoc #69/ownership %1 (conj %2 %0))) (def boxes (assoc #69/boxes %0 {})) (def counter (inc #69/counter)) (vector #69 %0)))nil
quantity-addunionnil
asset-lib#65nil
balance(fn [owner] (cond (get #69/ownership %0) *result* #{}))nil
direct-transfer(fn [receiver quantity data] (#69/-direct-transfer *caller* %0 %1))nil
quantity-subset?subset?nil
-direct-transfer(fn [sender receiver quantity] (let [q (#69/-qc %2) receiver (address %1) sender-balance (get #69/ownership %0 #{}) _ (cond (subset? %3 %5) *result* (fail :FUNDS "Cannot transfer box(es) not owned by sender.")) receiver-balance (get #69/ownership %4 #{}) new-sender-balance (difference %5 %3) new-receiver-balance (union %6 %3) ] (def ownership (assoc #69/ownership %0 %7 %4 %8)) %3))nil
ownership{}nil
offer(fn [receiver quantity] (let [q (#69/-qc %1) caller-offers (get #69/offers *caller* {}) ] (def offers (assoc #69/offers *caller* (assoc %3 %0 %2)))))nil
boxes{}"Map of `box id` -> `asset quantity`."
offers{}"Map of `owner` -> (Map of `recipient address` -> `set of box ids`."
burn(fn [set-box-ids] (let [owned-boxes (#69/ownership *caller*) ] (cond (subset? %0 %1) nil (fail :TRUST "Burning boxes requires ownership")) (let [s# %0 n# (count %2) ] (loop [a [] i 0 ] (cond (< %5 %3) (recur (conj %4 (let [id (nth %2 %5) ] (let [contents (#69/boxes %6) ] (cond (empty? %7) (def boxes (dissoc #69/boxes %6)) (fail :STATE (str "Trying to delete non-empty box: " %6)))))) (inc %5)) %4))) (def ownership (assoc #69/ownership *caller* (difference %1 %0))) nil))nil
-qc(fn [q] (cond (set? %0) %0 (int? %0) (hash-set %0) (nil? %0) #{} (fail :ARGUMENT "Invalid box quantity")))"Checks a box quantity."
counter0"Count of boxes created, used for creating box ids."
quantity-subdifferencenil
remove(fn [asset] (let [id *scope* current-asset (get #69/boxes %1) ] (cond (#65/quantity-contains? %2 %0) nil (fail "Box does not contain quantity of asset specified for removal")) (cond (contains-key? (#69/ownership *caller*) %1) nil (fail :TRUST (str "Box not owned: " %1))) (def boxes (assoc #69/boxes %1 (#65/quantity-sub %2 %0))) (#65/transfer *caller* %0)))nil
accept(fn [sender quantity] (let [q (#69/-qc %1) sender (address %0) sender-offers (get #69/offers %3 {}) offer (get-in #69/offers (vector %3 *caller*) #{}) _ (cond (subset? %2 %5) *result* (fail :STATE "Insufficent offer of box(es)")) receiver-balance (get #69/ownership *caller* #{}) new-offer (difference %5 %2) ] (def offers (assoc #69/offers %3 (assoc %4 *caller* %7))) (#69/-direct-transfer %3 *caller* %2)))nil
Holdings (Empty)

Holdings track token balances and other indexed values by address.

AddressValue