(impl-trait 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.trait-sip-010.sip-010-trait)
(define-constant MAXSUPPLY u20000000000000000)
(define-fungible-token labubu MAXSUPPLY)
(define-data-var token-name (string-ascii 32) "labubu")
(define-data-var token-symbol (string-ascii 32) "labubu")
(define-data-var token-uri (optional (string-utf8 256)) (some u"https://gaia.hiro.so/hub/1PLBLvhUWD1qFPWoAsjpAKiit24qZcvUBj/wall.json"))
(define-data-var token-decimals uint u8)
(define-constant ERR-NOT-AUTHORIZED (err u1000))
(define-constant ERR-MINT-FAILED (err u6002))
(define-constant ERR-BURN-FAILED (err u6003))
(define-constant ERR-NOT-SUPPORTED (err u6004))
(define-constant ERR-OVER-MAX-FEE (err u6005))
(define-constant ERR-TRANSFER-FAILED (err u3000))
(define-constant ONE_8 u100000000)
(define-constant contract-creator tx-sender)
(define-read-only (get-contract-creator)
(ok contract-creator))
(define-read-only (get-base-token)
ERR-NOT-SUPPORTED)
(define-read-only (get-base-decimals)
(ok u6))
(define-read-only (get-balance (who principal))
(ok (ft-get-balance labubu who)
))
(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? labubu amount sender recipient))
(ok true)
))
(define-read-only (get-total-supply)
(ok (ft-get-supply labubu))
)
(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-token-uri)
(ok (var-get token-uri)))
(define-private (pow-decimals)
(pow u10 (unwrap-panic (get-decimals))))
(define-read-only (fixed-to-decimals (amount uint))
(/ (* amount (pow-decimals)) ONE_8))
(define-private (decimals-to-fixed (amount uint))
(/ (* amount ONE_8) (pow-decimals)))
(define-read-only (get-total-supply-fixed)
ERR-NOT-SUPPORTED)
(define-read-only (get-balance-fixed (account principal))
(ok (decimals-to-fixed (unwrap-panic (get-balance account)))))
(define-public (transfer-fixed (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
(transfer (fixed-to-decimals amount) sender recipient memo))
(define-public (mint (amount uint) (recipient principal))
ERR-MINT-FAILED)
(define-public (burn (amount uint) (sender principal))
ERR-BURN-FAILED)
(define-public (mint-fixed (amount uint) (recipient principal))
(mint (fixed-to-decimals amount) recipient))
(define-public (burn-fixed (amount uint) (sender principal))
(burn (fixed-to-decimals amount) sender))
(begin
(try! (ft-mint? labubu MAXSUPPLY contract-creator))
)