Skip to content

Commit 508374d

Browse files
authored
Merge pull request #5 from Yakuhito/auctions
Wrong branch
2 parents 13d00eb + 1ddd382 commit 508374d

File tree

92 files changed

+1393
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1393
-893
lines changed

include/slots.clib

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,26 @@
2020
(list hint)
2121
)
2222
)
23+
24+
(defun spend_slot_inline (SLOT_1ST_CURRY_HASH slot_value_hash)
25+
(list
26+
SEND_MESSAGE
27+
18 ; puzzle-puzzle
28+
()
29+
(curry_hashes_inline SLOT_1ST_CURRY_HASH
30+
(sha256 1 slot_value_hash)
31+
)
32+
)
33+
)
34+
35+
(defun create_slot_inline (SLOT_1ST_CURRY_HASH slot_value_hash hint)
36+
(list
37+
CREATE_COIN
38+
(curry_hashes_inline SLOT_1ST_CURRY_HASH
39+
(sha256 1 slot_value_hash)
40+
)
41+
0
42+
(list hint)
43+
)
44+
)
2345
)

puzzles/actions/auctions/bid.clsp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
; bid.clsp by yakuhito & Rigidity
2+
3+
(mod (
4+
BID_PROGRAM ; Checks the pre-buyer's premium amount against the previous bid
5+
; CHECK PREVIOUS BID > BID HERE
6+
TIMESTAMP_PROGRAM ; Adds conditions to the output of the action
7+
; return: (new_state seconds is_relative)
8+
REFUND_PROGRAM
9+
(Ephemeral_State . (@ Current_State (Bid_Index Bid King End_State)))
10+
solution ; (new_bid new_king)
11+
)
12+
(include condition_codes.clib)
13+
14+
(defun main ((Bid_Index Bid King End_State) (new_bid new_king) (end_new_state end_seconds end_is_relative))
15+
(if (a BID_PROGRAM (list Bid_Index Bid new_bid))
16+
(list
17+
(
18+
(+ Bid_Index 1)
19+
new_bid
20+
new_king
21+
end_new_state
22+
) ; new state
23+
1 ; new ephemeral state
24+
(list
25+
(list
26+
CREATE_PUZZLE_ANNOUNCEMENT
27+
(sha256 2 (sha256 1 new_bid) (sha256 1 new_king))
28+
) ; create puzzle
29+
(list -42
30+
CREATE_COIN
31+
King
32+
(a REFUND_PROGRAM (list Bid_Index Bid))
33+
(list King)
34+
) ; refund last bid
35+
(i is_relative
36+
(i Ephemeral_State
37+
(list REMARK) ; THIS IS TERRIBLE REMOVE BEFORE PRODUCTION
38+
; else
39+
(list ASSERT_BEFORE_SECONDS_RELATIVE end_seconds)
40+
)
41+
; else
42+
(list ASSERT_BEFORE_SECONDS_ABSOLUTE end_seconds)
43+
)
44+
) ; conditions
45+
)
46+
; else
47+
(x)
48+
)
49+
)
50+
51+
(main Current_State solution (a TIMESTAMP_PROGRAM (list Bid_Index End_State)))
52+
)

puzzles/actions/auctions/bid.clsp.hex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff02ffff01ff02ff1effff04ff02ffff04ff6fffff04ff5fffff04ffff02ff0bffff04ff81afffff04ff8205efff80808080ff808080808080ffff04ffff01ffff5533ff3eff01ff02ffff03ff8b2124a25f50528fd505491dffff01ff04ffffff10ff09ffff01018080ffff04ffff0101ffff04ffff04ffff04ff0affff04ffff0bffff0102ffff0bffff0101ff1380ffff0bffff0101ff2b8080ff808080ffff04ffff04ffff0181d6ffff04ff0cffff04ff2dffff04ff8e0a48a2a72aa35f50528fd505491dffff04ffff04ff2dff8080ff808080808080ffff04ffff03ffff018b69735f72656c6174697665ffff03ffff018f457068656d6572616c5f5374617465ffff04ff16ff8080ffff04ffff019e4153534552545f4245464f52455f5345434f4e44535f52454c4154495645ffff04ff57ff80808080ffff04ff08ffff04ff57ff80808080ff80808080ff80808080ffff01ff088080ff0180ff018080
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; linear_increase.clsp by yakuhito & Rigidity
2+
3+
(mod (STEP_AMOUNT Prev_Index Prev_Bid bid)
4+
(not (> (* STEP_AMOUNT Prev_Index) (- bid Prev_Bid)))
5+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff20ffff15ffff12ff02ff0580ffff11ff17ff0b808080
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; minimum_bid.clsp by yakuhito & Rigidity
2+
3+
(mod (MINIMUM_AMOUNT INNER_PROGRAM (@ inner_solution (Prev_Index Prev_Bid bid)))
4+
(if (= Prev_Index 0)
5+
(not (> MINIMUM_AMOUNT bid))
6+
; else
7+
(a INNER_PROGRAM inner_solution)
8+
)
9+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff02ffff03ffff09ff13ff8080ffff01ff20ffff15ff02ff5b8080ffff01ff02ff05ff0b8080ff0180
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; static_increase.clsp by yakuhito & Rigidity
2+
3+
(mod (AMOUNT Prev_Index Prev_Bid bid)
4+
(not (> AMOUNT (- bid Prev_Bid)))
5+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff20ffff15ff02ffff11ff17ff0b808080

puzzles/actions/auctions/buy_now.clsp

Whitespace-only changes.

0 commit comments

Comments
 (0)