decimals | (fn [] 2) | nil |
total-supply | (fn [] #130/supply) | nil |
quantity-add | (fn [a b] (let [a (cond %0 (int %0) 0) b (cond %1 (int %1) 0) ] (+ %2 %3))) | nil |
balance | (fn [addr] (cond (get-holding %0) *result* 0)) | nil |
direct-transfer | (fn [addr amount data] (let [addr (address %0) amount (#130/-qc %1) bal (cond (get-holding *caller*) *result* 0) tbal (cond (get-holding %3) *result* 0) ] nil (cond (< %4 0) (fail :ARGUMENT "negative transfer")) (cond (> %4 %5) (fail :FUNDS "insufficent token balance")) (cond (= *caller* %3) (do (log "TR" *caller* %3 %4 %5 %5 %2) (return %4)) nil) (let [nsb (- %5 %4) nrb (+ %6 %4) ] (log "TR" *caller* %3 %4 %7 %8 %2) (set-holding *caller* %7) (set-holding %3 %8)))) | nil |
quantity-subset? | (fn [a b] (<= (cond %0 (int %0) 0) (cond %1 (int %1) 0))) | nil |
offer | (fn [receiver quantity] (let [receiver (address %0) quantity (#130/-qc %1) ] (cond (<= %3 0) (cond (lookup-meta *address* offers) (def offers (#8/dissoc-in #130/offers (vector *caller* %2))) (fail :UNDECLARED offers)) (cond (lookup-meta *address* offers) (def offers (assoc-in #130/offers (vector *caller* %2) %3)) (fail :UNDECLARED offers))) %3)) | nil |
supply | 787402 | nil |
check-transfer | (fn [_sender _receiver _quantity] nil) | nil |
offers | {#132 {},#11 {}} | nil |
get-offer | (fn [sender receiver] (get-in #130/offers (vector %0 %1) 0)) | nil |
-qc | (fn [q] (cond (int? %0) %0 (nil? %0) 0 (fail :ARGUMENT "Invalid quantity"))) | nil |
quantity-sub | (fn [a b] (let [a (cond %0 (int %0) 0) b (cond %1 (int %1) 0) ] (cond (> %2 %3) (- %2 %3) 0))) | nil |
accept | (fn [sender quantity] (let [sender (address %0) quantity (#130/-qc %1) om (get #130/offers %2) sendbal (cond (get-holding %2) *result* 0) offer (get %4 *caller* 0) ] (cond (< %3 0) (fail "Can't accept a negative quantity of fungible tokens.") (< %6 %3) (fail :STATE "Offer is insufficient") (< %5 %3) (fail :FUNDS "Sender token balance is insufficient") (let [new-offer (- %6 %3) ] (def offers (assoc #130/offers %2 (cond (> %7 0) (assoc %4 *caller* %7) (dissoc %4 *caller*)))) (set-holding %2 (- %5 %3)) (set-holding *caller* (+ (cond (get-holding *caller*) *result* 0) %3)) %3)))) | nil |