validation-sbtc-usdcx-v-1-bps-1

SM1FKXGNZJWSTWDWXQZJNF7B5TV5ZB235JTCXYXKD

Source Code


;; validation-sbtc-usdcx-v-1-bps-1

;; Error constants
(define-constant ERR_NO_BLOCK_INFO (err u6001))

;; Get pool data at block height
(define-read-only (get-pool (height uint))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-pool))
)

;; Get active bin ID at block height
(define-read-only (get-active-bin-id (height uint))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-active-bin-id))
)

;; Get x balance for pool at block height
(define-read-only (get-x-balance (height uint))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? 'SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token get-balance .dlmm-pool-sbtc-usdcx-v-1-bps-1))
)

;; Get y balance for pool at block height
(define-read-only (get-y-balance (height uint))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? 'SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx get-balance .dlmm-pool-sbtc-usdcx-v-1-bps-1))
)

;; Get overall balance for a user at block height
(define-read-only (get-overall-balance (height uint) (user principal))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-overall-balance user))
)

;; Get user bins at block height
(define-read-only (get-user-bins (height uint) (user principal))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-user-bins user))
)

;; Get multiple bin balances for pool at multiple block heights
(define-read-only (get-bin-balances-multi (heights (list 1001 uint)) (ids (list 1001 uint)))
	(ok (map get-bin-balances heights ids))
)

;; Get multiple balances for multiple users for pool at multiple block heights
(define-read-only (get-balance-multi (heights (list 1001 uint)) (token-ids (list 1001 uint)) (users (list 1001 principal)))
	(ok (map get-balance heights token-ids users))
)

(define-private (get-bin-balances (height uint) (id uint))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-bin-balances id))
)

(define-private (get-balance (height uint) (token-id uint) (user principal))
	(at-block (unwrap! (get-stacks-block-info? id-header-hash height) ERR_NO_BLOCK_INFO) (contract-call? .dlmm-pool-sbtc-usdcx-v-1-bps-1 get-balance token-id user))
)

Functions (10)

FunctionAccessArgs
get-poolread-onlyheight: uint
get-active-bin-idread-onlyheight: uint
get-x-balanceread-onlyheight: uint
get-y-balanceread-onlyheight: uint
get-overall-balanceread-onlyheight: uint, user: principal
get-user-binsread-onlyheight: uint, user: principal
get-bin-balances-multiread-onlyheights: (list 1001 uint
get-balance-multiread-onlyheights: (list 1001 uint
get-bin-balancesprivateheight: uint, id: uint
get-balanceprivateheight: uint, token-id: uint, user: principal