Skip to content

Commit

Permalink
Merge pull request #39 from syvita/check-block-func
Browse files Browse the repository at this point in the history
add block checking code
  • Loading branch information
ᴀ ꜱ ᴛ ᴇ ʀ ɪ ᴀ authored Jul 19, 2021
2 parents 43f0b0c + 3acc6ad commit 11a71e3
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 11a71e3

Please sign in to comment.