feat: auto-alex-v3 (rebase) (#782)

* fix: typo of auto-alxex-v3

* fix: fianlize-redeem

* working

* clean up

* working

* feat: auto-alex-v3-rebase

* revert auto-alex-v2 to prod

---------

Co-authored-by: Kyle Fang <zhigang1992@gmail.com>
This commit is contained in:
fiftyeightandeight
2024-04-05 00:43:17 +09:00
committed by GitHub
parent 697bfd34c5
commit d45481ed85
5 changed files with 300 additions and 222 deletions

View File

@@ -1429,6 +1429,12 @@ epoch = 2.4
path = "contracts/auto-token/auto-alex-v3.clar"
depends_on = [ "trait-sip-010", "trait-ownable" ]
[contracts.auto-alex-v3-wrapped]
path = "contracts/auto-token/auto-alex-v3-wrapped.clar"
depends_on = [ "trait-sip-010", "trait-ownable" ]
[contracts.auto-alex-v3-registry]
path = "contracts/auto-token/auto-alex-v3-registry.clar"
depends_on = [ ]

View File

@@ -91,18 +91,14 @@
;; @desc get the intrinsic value of auto-alex-v3
;; @desc intrinsic = next capital base of the vault / total supply of auto-alex-v3
(define-read-only (get-intrinsic)
(ok (div-down (try! (get-next-base)) (unwrap-panic (contract-call? .auto-alex-v3 get-total-supply-fixed)))))
(contract-call? .auto-alex-v3 get-shares-to-tokens ONE_8))
;; @dev need to save the historical ratio.
(define-read-only (get-shares-to-tokens (dx uint))
(let (
(total-supply (unwrap-panic (contract-call? .auto-alex-v3 get-total-supply-fixed))))
(ok (if (is-eq u0 total-supply) dx (div-down (mul-down (try! (get-next-base)) dx) total-supply)))))
(contract-call? .auto-alex-v3 get-shares-to-tokens dx))
(define-read-only (get-tokens-to-shares (dx uint))
(let (
(total-supply (unwrap-panic (contract-call? .auto-alex-v3 get-total-supply-fixed))))
(ok (if (is-eq u0 total-supply) dx (div-down (mul-down total-supply dx) (try! (get-next-base)))))))
(contract-call? .auto-alex-v3 get-tokens-to-shares dx))
;; governance calls
@@ -129,16 +125,22 @@
;; public functions
;;
(define-public (rebase)
(let (
(current-cycle (unwrap! (get-reward-cycle block-height) ERR-STAKING-NOT-AVAILABLE))
(start-cycle (get-start-cycle))
(check-start-cycle (asserts! (<= start-cycle current-cycle) ERR-NOT-ACTIVATED)))
(and (> current-cycle start-cycle) (not (is-cycle-staked (- current-cycle u1))) (try! (claim-and-stake (- current-cycle u1))))
(as-contract (try! (contract-call? .auto-alex-v3 set-reserve (try! (get-next-base)))))
(ok current-cycle)))
;; @desc add to position
;; @desc transfers dx to vault, stake them for 32 cycles and mints auto-alex-v3, the number of which is determined as % of total supply / next base
;; @param dx the number of $ALEX in 8-digit fixed point notation
(define-public (add-to-position (dx uint))
(let (
(current-cycle (unwrap! (get-reward-cycle block-height) ERR-STAKING-NOT-AVAILABLE))
(start-cycle (get-start-cycle))
(check-start-cycle (asserts! (<= start-cycle current-cycle) ERR-NOT-ACTIVATED))
(check-claim-and-stake (and (> current-cycle start-cycle) (not (is-cycle-staked (- current-cycle u1))) (try! (claim-and-stake (- current-cycle u1)))))
(new-supply (try! (get-tokens-to-shares dx)))
(current-cycle (try! (rebase)))
(new-supply (get-tokens-to-shares dx))
(sender tx-sender))
(asserts! (> dx u0) ERR-INVALID-LIQUIDITY)
(asserts! (not (is-create-paused)) ERR-PAUSED)
@@ -148,19 +150,16 @@
(try! (fold stake-tokens-iter REWARD-CYCLE-INDEXES (ok { current-cycle: current-cycle, remaining: dx })))
;; mint pool token and send to tx-sender
(as-contract (try! (contract-call? .auto-alex-v3 mint-fixed new-supply sender)))
(as-contract (try! (contract-call? .auto-alex-v3 mint-fixed new-supply sender)))
(print { notification: "position-added", payload: { new-supply: new-supply } })
(ok true)))
(rebase)))
(define-public (upgrade (dx uint))
(let (
(current-cycle (unwrap! (get-reward-cycle block-height) ERR-STAKING-NOT-AVAILABLE))
(start-cycle (get-start-cycle))
(let (
(end-cycle-v2 (contract-call? .auto-alex-v2 get-end-cycle))
(check-start-cycle (asserts! (<= start-cycle current-cycle) ERR-NOT-ACTIVATED))
(check-claim-and-stake (and (> current-cycle start-cycle) (not (is-cycle-staked (- current-cycle u1))) (try! (claim-and-stake (- current-cycle u1)))))
(current-cycle (try! (rebase)))
(intrinsic-dx (mul-down dx (try! (contract-call? .auto-alex-v2 get-intrinsic))))
(new-supply (try! (get-tokens-to-shares intrinsic-dx)))
(new-supply (get-tokens-to-shares intrinsic-dx))
(sender tx-sender))
(asserts! (> intrinsic-dx u0) ERR-INVALID-LIQUIDITY)
(asserts! (not (is-create-paused)) ERR-PAUSED)
@@ -173,7 +172,7 @@
;; mint pool token and send to tx-sender
(as-contract (try! (contract-call? .auto-alex-v3 mint-fixed new-supply sender)))
(print { notification: "upgrade-position-added", payload: { new-supply: new-supply } })
(ok true)))
(rebase)))
;; claims alex for the reward-cycles and mint auto-alex-v3
(define-public (claim-and-mint (reward-cycles (list 200 uint)))
@@ -197,10 +196,11 @@
(redeeming (mul-down previous-shares-to-tokens (get-redeem-shares-per-cycle-or-default reward-cycle))))
(asserts! (> current-cycle reward-cycle) ERR-REWARD-CYCLE-NOT-COMPLETED)
(as-contract (try! (contract-call? .auto-alex-v3-registry set-staked-cycle reward-cycle true)))
(as-contract (try! (contract-call? .auto-alex-v3-registry set-staked-cycle-shares-to-tokens reward-cycle (try! (get-shares-to-tokens ONE_8)))))
(as-contract (try! (contract-call? .auto-alex-v3-registry set-staked-cycle-shares-to-tokens reward-cycle (get-shares-to-tokens ONE_8))))
(try! (fold stake-tokens-iter REWARD-CYCLE-INDEXES (ok { current-cycle: current-cycle, remaining: (- tokens redeeming) })))
(print { notification: "claim-and-stake", payload: { redeeming: redeeming }})
(as-contract (contract-call? .auto-alex-v3-registry set-redeem-tokens-per-cycle reward-cycle redeeming))))
(as-contract (try! (contract-call? .auto-alex-v3-registry set-redeem-tokens-per-cycle reward-cycle redeeming)))
(ok true)))
(define-public (request-redeem (amount uint))
(let (
@@ -218,6 +218,7 @@
(request-details (try! (get-redeem-request-or-fail request-id)))
(redeem-cycle (get redeem-cycle request-details))
(check-claim-and-stake (and (not (is-cycle-staked redeem-cycle)) (try! (claim-and-stake redeem-cycle))))
(current-cycle (try! (rebase)))
(redeem-tokens (div-down (mul-down (get shares request-details) (get-redeem-tokens-per-cycle-or-default redeem-cycle)) (get-redeem-shares-per-cycle-or-default redeem-cycle)))
(updated-request-details (merge request-details { status: (get-finalized) })))
(asserts! (not (is-redeem-paused)) ERR-PAUSED)
@@ -226,7 +227,8 @@
(as-contract (try! (contract-call? .auto-alex-v3 transfer-token .age000-governance-token redeem-tokens (get requested-by request-details))))
(as-contract (try! (contract-call? .auto-alex-v3 burn-fixed (get shares request-details) .auto-alex-v3)))
(print { notification: "finalize-redeem", payload: updated-request-details })
(as-contract (contract-call? .auto-alex-v3-registry set-redeem-request request-id updated-request-details))))
(as-contract (try! (contract-call? .auto-alex-v3-registry set-redeem-request request-id updated-request-details)))
(rebase)))
(define-public (revoke-redeem (request-id uint))
(let (
@@ -260,7 +262,7 @@
ok-value
(let (
(reward-cycle (+ (get current-cycle ok-value) cycles-to-stake))
(redeeming (try! (get-shares-to-tokens (get-redeem-shares-per-cycle-or-default reward-cycle))))
(redeeming (get-shares-to-tokens (get-redeem-shares-per-cycle-or-default reward-cycle)))
(returning (get to-return (get-staker-at-cycle reward-cycle)))
(staking (if (is-eq cycles-to-stake u32)
(get remaining ok-value)

View File

@@ -0,0 +1,123 @@
(define-fungible-token auto-alex-v3-wrapped)
(define-constant ERR-NOT-AUTHORIZED (err u1000))
(define-constant ONE_8 u100000000)
(define-data-var contract-owner principal tx-sender)
(define-map approved-contracts principal bool)
(define-data-var token-name (string-ascii 32) "Wrapped Auto ALEX v3")
(define-data-var token-symbol (string-ascii 10) "watALEXv3")
(define-data-var token-uri (optional (string-utf8 256)) (some u"https://cdn.alexlab.co/metadata/auto-alex-v3-wrapped.json"))
(define-data-var token-decimals uint u8)
;; governance functions
(define-public (set-contract-owner (owner principal))
(begin
(try! (check-is-owner))
(ok (var-set contract-owner owner))))
(define-public (set-approved-contract (owner principal) (approved bool))
(begin
(try! (check-is-owner))
(ok (map-set approved-contracts owner approved))))
(define-public (set-name (new-name (string-ascii 32)))
(begin
(try! (check-is-owner))
(ok (var-set token-name new-name))))
(define-public (set-symbol (new-symbol (string-ascii 10)))
(begin
(try! (check-is-owner))
(ok (var-set token-symbol new-symbol))))
(define-public (set-decimals (new-decimals uint))
(begin
(try! (check-is-owner))
(ok (var-set token-decimals new-decimals))))
(define-public (set-token-uri (new-uri (optional (string-utf8 256))))
(begin
(try! (check-is-owner))
(ok (var-set token-uri new-uri))))
;; public functions
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 2048))))
(begin
(asserts! (or (is-eq tx-sender sender) (is-eq contract-caller sender)) ERR-NOT-AUTHORIZED)
(try! (ft-transfer? auto-alex-v3-wrapped amount sender recipient))
(print { type: "transfer", amount: amount, sender: sender, recipient: recipient, memo: memo })
(ok true)))
(define-public (transfer-fixed (amount uint) (sender principal) (recipient principal) (memo (optional (buff 2048))))
(transfer amount sender recipient memo))
(define-public (mint (amount uint) (recipient principal))
(begin
(asserts! (or (is-eq tx-sender recipient) (is-eq contract-caller recipient)) ERR-NOT-AUTHORIZED)
(try! (ft-mint? auto-alex-v3-wrapped (get-tokens-to-shares amount) recipient))
(contract-call? .auto-alex-v3 transfer amount recipient (as-contract tx-sender) none)))
(define-public (mint-fixed (amount uint) (recipient principal))
(mint amount recipient))
(define-public (burn (amount uint) (sender principal))
(begin
(asserts! (or (is-eq tx-sender sender) (is-eq contract-caller sender)) ERR-NOT-AUTHORIZED)
(as-contract (try! (contract-call? .auto-alex-v3 transfer (get-shares-to-tokens amount) tx-sender sender none)))
(ft-burn? auto-alex-v3-wrapped amount sender)))
(define-public (burn-fixed (amount uint) (sender principal))
(burn amount sender))
;; read-only functions
(define-read-only (get-contract-owner)
(var-get contract-owner))
(define-read-only (get-name)
(ok (var-get token-name)))
(define-read-only (get-symbol)
(ok (var-get token-symbol)))
(define-read-only (get-token-uri)
(ok (var-get token-uri)))
(define-read-only (get-decimals)
(ok (var-get token-decimals)))
(define-read-only (get-balance (who principal))
(ok (ft-get-balance auto-alex-v3-wrapped who)))
(define-read-only (get-total-supply)
(ok (ft-get-supply auto-alex-v3-wrapped)))
(define-read-only (get-share (who principal))
(ok (get-shares-to-tokens (unwrap-panic (get-balance who)))))
(define-read-only (get-total-shares)
(contract-call? .auto-alex-v3 get-balance (as-contract tx-sender)))
(define-read-only (get-tokens-to-shares (amount uint))
(if (is-eq (get-total-supply) (ok u0))
amount
(/ (* amount (unwrap-panic (get-total-supply))) (unwrap-panic (get-total-shares)))))
(define-read-only (get-shares-to-tokens (shares uint))
(if (is-eq (get-total-supply) (ok u0))
shares
(/ (* shares (unwrap-panic (get-total-shares))) (unwrap-panic (get-total-supply)))))
;; private functions
(define-private (check-is-owner)
(ok (asserts! (is-eq tx-sender (var-get contract-owner)) ERR-NOT-AUTHORIZED)))
(define-private (check-is-approved)
(ok (asserts! (default-to false (map-get? approved-contracts tx-sender)) ERR-NOT-AUTHORIZED)))

View File

@@ -1,229 +1,176 @@
(define-fungible-token auto-alex-v3)
(define-constant ERR-NOT-AUTHORIZED (err u1000))
(define-constant ERR-INVALID-AMOUNT (err u1001))
(define-constant ONE_8 u100000000)
;; -- token implementation
(define-fungible-token auto-alex-v3)
(define-data-var contract-owner principal tx-sender)
(define-data-var token-name (string-ascii 32) "Auto ALEX")
(define-data-var token-symbol (string-ascii 32) "auto-alex-v3")
(define-data-var token-uri (optional (string-utf8 256)) (some u"https://cdn.alexlab.co/metadata/token-auto-alex-v3.json"))
(define-map approved-contracts principal bool)
(define-data-var token-name (string-ascii 32) "Auto ALEX v3")
(define-data-var token-symbol (string-ascii 10) "atALEXv3")
(define-data-var token-uri (optional (string-utf8 256)) (some u"https://cdn.alexlab.co/metadata/auto-alex-v3.json"))
(define-data-var token-decimals uint u8)
(define-map approved-contracts principal bool)
(define-data-var reserve uint u0)
;; read-only calls
(define-read-only (get-contract-owner)
(ok (var-get contract-owner))
)
(define-read-only (get-name)
(ok (var-get token-name))
)
(define-read-only (get-symbol)
(ok (var-get token-symbol))
)
(define-read-only (get-decimals)
(ok (var-get token-decimals))
)
(define-read-only (get-balance (who principal))
(ok (ft-get-balance auto-alex-v3 who))
)
(define-read-only (get-total-supply)
(ok (ft-get-supply auto-alex-v3))
)
(define-read-only (get-token-uri)
(ok (var-get token-uri))
)
;; @desc fixed-to-decimals
;; @params amount
;; @returns uint
(define-read-only (fixed-to-decimals (amount uint))
(/ (* amount (pow-decimals)) ONE_8)
)
;; @desc get-total-supply-fixed
;; @params token-id
;; @returns (response uint)
(define-read-only (get-total-supply-fixed)
(ok (decimals-to-fixed (unwrap-panic (get-total-supply))))
)
;; @desc get-balance-fixed
;; @params token-id
;; @params who
;; @returns (response uint)
(define-read-only (get-balance-fixed (account principal))
(ok (decimals-to-fixed (unwrap-panic (get-balance account))))
)
;; governance calls
;; governance functions
(define-public (set-contract-owner (owner principal))
(begin
(try! (check-is-owner))
(ok (var-set contract-owner owner))
)
)
(define-public (set-name (new-name (string-ascii 32)))
(begin
(try! (check-is-owner))
(ok (var-set token-name new-name))
)
)
(define-public (set-symbol (new-symbol (string-ascii 10)))
(begin
(try! (check-is-owner))
(ok (var-set token-symbol new-symbol))
)
)
(define-public (set-decimals (new-decimals uint))
(begin
(try! (check-is-owner))
(ok (var-set token-decimals new-decimals))
)
)
(define-public (set-token-uri (new-uri (optional (string-utf8 256))))
(begin
(try! (check-is-owner))
(ok (var-set token-uri new-uri))
)
)
(define-public (add-approved-contract (new-approved-contract principal))
(begin
(try! (check-is-owner))
(ok (map-set approved-contracts new-approved-contract true))
)
)
(ok (var-set contract-owner owner))))
(define-public (set-approved-contract (owner principal) (approved bool))
(begin
(try! (check-is-owner))
(ok (map-set approved-contracts owner approved))
)
)
(ok (map-set approved-contracts owner approved))))
;; priviliged calls
(define-public (set-name (new-name (string-ascii 32)))
(begin
(try! (check-is-owner))
(ok (var-set token-name new-name))))
(define-public (set-symbol (new-symbol (string-ascii 10)))
(begin
(try! (check-is-owner))
(ok (var-set token-symbol new-symbol))))
(define-public (set-decimals (new-decimals uint))
(begin
(try! (check-is-owner))
(ok (var-set token-decimals new-decimals))))
(define-public (set-token-uri (new-uri (optional (string-utf8 256))))
(begin
(try! (check-is-owner))
(ok (var-set token-uri new-uri))))
;; privileged calls
(define-public (set-reserve (new-reserve uint))
(begin
(asserts! (or (is-ok (check-is-approved)) (is-ok (check-is-owner))) ERR-NOT-AUTHORIZED)
(var-set reserve new-reserve)
(print {notification: "rebase", payload: {reserve: (var-get reserve), total-shares: (ft-get-supply auto-alex-v3)}})
(ok true)))
(define-public (add-reserve (increment uint))
(set-reserve (+ (var-get reserve) increment)))
(define-public (remove-reserve (decrement uint))
(begin
(asserts! (<= decrement (var-get reserve)) ERR-INVALID-AMOUNT)
(set-reserve (- (var-get reserve) decrement))))
;; @desc mint
;; @restricted ContractOwner/Approved Contract
;; @params token-id
;; @params amount
;; @params recipient
;; @returns (response bool)
(define-public (mint (amount uint) (recipient principal))
(begin
(asserts! (or (is-ok (check-is-approved)) (is-ok (check-is-owner))) ERR-NOT-AUTHORIZED)
(ft-mint? auto-alex-v3 amount recipient)
)
)
(ft-mint? auto-alex-v3 (get-tokens-to-shares amount) recipient)))
(define-public (mint-fixed (amount uint) (recipient principal))
(mint amount recipient))
;; @desc burn
;; @restricted ContractOwner/Approved Contract
;; @params token-id
;; @params amount
;; @params sender
;; @returns (response bool)
(define-public (burn (amount uint) (sender principal))
(begin
(asserts! (or (is-ok (check-is-approved)) (is-ok (check-is-owner))) ERR-NOT-AUTHORIZED)
(ft-burn? auto-alex-v3 amount sender)
)
)
;; @desc mint-fixed
;; @params token-id
;; @params amount
;; @params recipient
;; @returns (response bool)
(define-public (mint-fixed (amount uint) (recipient principal))
(mint (fixed-to-decimals amount) recipient)
)
;; @desc burn-fixed
;; @params token-id
;; @params amount
;; @params sender
;; @returns (response bool)
(ft-burn? auto-alex-v3 (get-tokens-to-shares amount) sender)))
(define-public (burn-fixed (amount uint) (sender principal))
(burn (fixed-to-decimals amount) sender)
)
(burn amount sender))
(define-public (mint-fixed-many (recipients (list 200 {amount: uint, recipient: principal})))
(begin
(asserts! (or (is-ok (check-is-approved)) (is-ok (check-is-owner))) ERR-NOT-AUTHORIZED)
(ok (map mint-fixed-many-iter recipients))
)
)
(define-public (burn-many (senders (list 200 {amount: uint, sender: principal})))
(fold check-err (map burn-many-iter senders) (ok true)))
(define-public (burn-fixed-many (senders (list 200 {amount: uint, sender: principal})))
(burn-many senders))
;; read-only functions
(define-read-only (get-contract-owner)
(var-get contract-owner))
(define-read-only (get-name)
(ok (var-get token-name)))
(define-read-only (get-symbol)
(ok (var-get token-symbol)))
(define-read-only (get-token-uri)
(ok (var-get token-uri)))
(define-read-only (get-decimals)
(ok (var-get token-decimals)))
(define-read-only (get-balance (who principal))
(ok (get-shares-to-tokens (unwrap-panic (get-share who)))))
(define-read-only (get-balance-fixed (who principal))
(get-balance who))
(define-read-only (get-total-supply)
(get-reserve))
(define-read-only (get-total-supply-fixed)
(get-total-supply))
(define-read-only (get-share (who principal))
(ok (ft-get-balance auto-alex-v3 who)))
(define-read-only (get-share-fixed (who principal))
(get-share who))
(define-read-only (get-total-shares)
(ok (ft-get-supply auto-alex-v3)))
(define-read-only (get-total-shares-fixed)
(get-total-shares))
(define-read-only (get-reserve)
(ok (var-get reserve)))
(define-read-only (get-reserve-fixed)
(get-reserve))
(define-read-only (get-tokens-to-shares (amount uint))
(if (is-eq (get-reserve) (ok u0))
amount
(/ (* amount (unwrap-panic (get-total-shares))) (unwrap-panic (get-reserve)))))
(define-read-only (get-shares-to-tokens (shares uint))
(if (is-eq (get-total-shares) (ok u0))
shares
(/ (* shares (unwrap-panic (get-reserve))) (unwrap-panic (get-total-shares)))))
;; public calls
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
(begin
(asserts! (is-eq sender tx-sender) ERR-NOT-AUTHORIZED)
(try! (ft-transfer? auto-alex-v3 amount sender recipient))
(match memo to-print (print to-print) 0x)
(ok true)
)
)
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 2048))))
(let (
(shares (get-tokens-to-shares amount)))
(asserts! (or (is-eq tx-sender sender) (is-eq contract-caller sender)) ERR-NOT-AUTHORIZED)
(try! (ft-transfer? auto-alex-v3 shares sender recipient))
(match memo to-print (print to-print) 0x)
(print { notification: "transfer", payload: { amount: amount, shares: shares, sender: sender, recipient: recipient } })
(ok true)))
;; @desc transfer-fixed
;; @params token-id
;; @params amount
;; @params sender
;; @params recipient
;; @returns (response bool)
(define-public (transfer-fixed (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
(transfer (fixed-to-decimals amount) sender recipient memo)
)
(define-public (transfer-fixed (amount uint) (sender principal) (recipient principal) (memo (optional (buff 2048))))
(transfer amount sender recipient memo))
;; private calls
;; private functions
(define-private (mint-fixed-many-iter (item {amount: uint, recipient: principal}))
(mint-fixed (get amount item) (get recipient item))
)
(define-private (burn-many-iter (item {amount: uint, sender: principal}))
(burn (get amount item) (get sender item)))
(define-private (check-err (result (response bool uint)) (prior (response bool uint)))
(match prior ok-value result err-value (err err-value)))
(define-private (check-is-owner)
(ok (asserts! (is-eq tx-sender (var-get contract-owner)) ERR-NOT-AUTHORIZED))
)
(ok (asserts! (is-eq tx-sender (var-get contract-owner)) ERR-NOT-AUTHORIZED)))
(define-private (check-is-approved)
(ok (asserts! (default-to false (map-get? approved-contracts tx-sender)) ERR-NOT-AUTHORIZED))
)
;; @desc decimals-to-fixed
;; @params amount
;; @returns uint
(define-private (decimals-to-fixed (amount uint))
(/ (* amount ONE_8) (pow-decimals))
)
;; @desc pow-decimals
;; @returns uint
(define-private (pow-decimals)
(pow u10 (unwrap-panic (get-decimals)))
)
(define-private (mul-down (a uint) (b uint))
(/ (* a b) ONE_8))
(define-private (div-down (a uint) (b uint))
(if (is-eq a u0) u0 (/ (* a ONE_8) b)))
(ok (asserts! (default-to false (map-get? approved-contracts tx-sender)) ERR-NOT-AUTHORIZED)))
;; staking related fuctions

View File

@@ -21,20 +21,20 @@
;; an optional URI that represents metadata of this token
(get-token-uri () (response (optional (string-utf8 256)) uint))
;; helper functions for 8-digit fixed notation
(transfer-fixed (uint principal principal (optional (buff 34))) (response bool uint))
(get-balance-fixed (principal) (response uint uint))
(get-total-supply-fixed () (response uint uint))
(mint (uint principal) (response bool uint))
(burn (uint principal) (response bool uint))
(mint-fixed (uint principal) (response bool uint))
(burn-fixed (uint principal) (response bool uint))
(get-reserve () (response uint uint))
(get-share (principal) (response uint uint))
(get-total-shares () (response uint uint))
(get-share-fixed (principal) (response uint uint))
(get-total-shares-fixed () (response uint uint))
;; helper functions for 8-digit fixed notation
(transfer-fixed (uint principal principal (optional (buff 34))) (response bool uint))
(get-balance-fixed (principal) (response uint uint))
(get-total-supply-fixed () (response uint uint))
(mint-fixed (uint principal) (response bool uint))
(burn-fixed (uint principal) (response bool uint))
(get-share-fixed (principal) (response uint uint))
(get-total-shares-fixed () (response uint uint))
)
)