Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions contracts/dao/token/aibtc-pre-dex.clar
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@
(define-constant ERR-NOT-EXPIRED (err u306))
(define-constant ERR-CONTRACT-INSUFFICIENT-FUNDS (err u307))
(define-constant ERR-INVALID-SEAT-COUNT (err u308))
(define-constant ERR-SLICE-FAILED (err u309))
(define-constant ERR-TOO-LONG (err u310))
(define-constant ERR-REMOVING-HOLDER (err u311))
(define-constant ERR-DISTRIBUTION-ALREADY-SET (err u312))
(define-constant ERR-DISTRIBUTION-NOT-INITIALIZED (err u314))
Expand Down Expand Up @@ -141,15 +139,12 @@
{found: false, index: (+ (get index state) u1)})))

(define-private (remove-seat-holder)
(let ((position (find-holder-position (var-get seat-holders)))
(current-list (var-get seat-holders)))
(match position
pos (let ((before-slice (unwrap! (slice? current-list u0 pos) ERR-SLICE-FAILED))
(after-slice (unwrap! (slice? current-list (+ pos u1) (len current-list)) ERR-SLICE-FAILED))
(updated-list (unwrap! (as-max-len? (concat before-slice after-slice) u20) ERR-TOO-LONG)))
(var-set seat-holders updated-list)
(ok true))
(ok false)))) ;; If position not found, do nothing
(let ((filtered-list (filter not-matching-owner (var-get seat-holders))))
(var-set seat-holders filtered-list)
(ok true)))

(define-private (not-matching-owner (entry {owner: principal, seats: uint}))
(not (is-eq (get owner entry) (var-get target-owner))))

;; Main functions
;; Buy seats in Period 1
Expand Down Expand Up @@ -312,7 +307,14 @@
is-period-1-expired: (is-period-1-expired),
is-distribution-period: (> (var-get distribution-height) u0),
total-users: (var-get total-users),
total-seats-taken: (var-get total-seats-taken)
total-seats-taken: (var-get total-seats-taken),
deployment-height: (var-get deployment-height),
expiration-period: EXPIRATION-PERIOD,
distribution-height: (var-get distribution-height),
accelerated-vesting: (var-get accelerated-vesting),
market-open: (var-get market-open),
governance-active: (var-get governance-active),
seat-holders: (var-get seat-holders)
}))

(define-read-only (get-user-info (user principal))
Expand Down
Loading