Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add block checking code #39

Merged
merged 1 commit into from
Jul 19, 2021
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
17 changes: 17 additions & 0 deletions packages/miningpool/contracts/sypool.clar
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
(define-constant ERR_COULD_NOT_VERIFY_SECRET u9)
(define-constant ERR_COULD_NOT_GET_TX_OUTS u10)
(define-constant ERR_COULD_NOT_GET_TX_SENDER u11)
(define-constant FIRST_CYCLE u697450)

(define-constant FEE_PRINCIPLE 'SP343J7DNE122AVCSC4HEK4MF871PW470ZSXJ5K66)
(define-constant POOL_BTC_ADDRESS 0x123456)
Expand Down Expand Up @@ -104,6 +105,22 @@

;; private functions

(define-private (check-block (phase uint))
(if (is-eq phase u1)
(if (is-eq (mod (- block-height FIRST_CYCLE) u2100) u0)
true
false
)
(if (is-eq phase u2)
(if (is-eq (mod (- block-height (+ FIRST_CYCLE u150)) u2100) u0)
true
false
)
false ;; isn't phase 1 or 2
)
)
)

(define-private (scriptpubkey-to-p2pkh (scriptPubKey (buff 128)))
(hash160 (sha256 scriptPubKey)))

Expand Down