ethlite-contracts 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/ethlite/contracts/punk_blocks.rb +69 -109
- data/lib/ethlite/contracts/punks_v1.rb +36 -58
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6de1c37a18e18603847fb4f34cece9177d8839e561a2e68cf1e772fbe81c81
|
4
|
+
data.tar.gz: 52e07b948256fae1714ac69cf6fa3f3580638c89d41fcfdbbfe9ce84528c45d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7132e907281f9bd8efdabd16f337943339315d7406e05fc22f043a605616ea626d6886f9bad87ad089da5bfa6b6116f3d5edf163f69ec86cb957e81898fe5b96
|
7
|
+
data.tar.gz: ff12785374324d102cb92a8ae0a6c52ec2af1d15c8925aab796a07ce9c467adb5572d03d5bb369208ad8a70462387fc2387c6e28577dfe3f14370849471e7557
|
data/Rakefile
CHANGED
@@ -1,97 +1,87 @@
|
|
1
1
|
#########################
|
2
2
|
# PunkBlocks contract / (blockchain) services / function calls
|
3
|
-
# auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-
|
3
|
+
# auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-13 15:31:38 UTC
|
4
4
|
# - 8 query functions(s)
|
5
|
-
|
6
|
-
#
|
5
|
+
#
|
6
|
+
#
|
7
7
|
# - Author: tycoon.eth, thanks to @geraldb & @samwilsn on Github for inspiration!
|
8
8
|
# - Version: v0.0.2
|
9
9
|
# - Pragma: solidity ^0.8.17
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# ```
|
33
|
-
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# ███████████ █████
|
13
|
+
# ░░███░░░░░███ ░░███
|
14
|
+
# ░███ ░███ █████ ████ ████████ ░███ █████
|
15
|
+
# ░██████████ ░░███ ░███ ░░███░░███ ░███░░███
|
16
|
+
# ░███░░░░░░ ░███ ░███ ░███ ░███ ░██████░
|
17
|
+
# ░███ ░███ ░███ ░███ ░███ ░███░░███
|
18
|
+
# █████ ░░████████ ████ █████ ████ █████
|
19
|
+
# ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ░░░░ ░░░░░
|
20
|
+
#
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# ███████████ ████ █████
|
24
|
+
# ░░███░░░░░███░░███ ░░███
|
25
|
+
# ░███ ░███ ░███ ██████ ██████ ░███ █████ █████
|
26
|
+
# ░██████████ ░███ ███░░███ ███░░███ ░███░░███ ███░░
|
27
|
+
# ░███░░░░░███ ░███ ░███ ░███░███ ░░░ ░██████░ ░░█████
|
28
|
+
# ░███ ░███ ░███ ░███ ░███░███ ███ ░███░░███ ░░░░███
|
29
|
+
# ███████████ █████░░██████ ░░██████ ████ █████ ██████
|
30
|
+
# ░░░░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░░
|
31
|
+
#
|
34
32
|
# A Registry of 24x24 png images
|
35
|
-
#
|
33
|
+
#
|
36
34
|
# This contract:
|
37
|
-
#
|
35
|
+
#
|
38
36
|
# 1. Stores all the classic traits of the CryptoPunks in
|
39
37
|
# individual png files, 100% on-chain. These are then used as
|
40
38
|
# blocks to construct CryptoPunk images. Outputted as SVGs.
|
41
|
-
#
|
39
|
+
#
|
42
40
|
# 2. Any of the 10,000 "classic" CryptoPunks can be generated
|
43
41
|
# by supplying desired arguments to a function, such as
|
44
42
|
# the id of a punk, or a list of the traits.
|
45
|
-
#
|
43
|
+
#
|
46
44
|
# 3. An unlimited number of new punk images can be generated from
|
47
45
|
# the existing classic set of traits, or even from new traits!
|
48
|
-
#
|
46
|
+
#
|
49
47
|
# 4. New traits (blocks) can be added to the contract by
|
50
48
|
# registering them with the `registerBlock` function.
|
51
|
-
#
|
49
|
+
#
|
52
50
|
# Further documentation:
|
53
51
|
# https://github.com/0xTycoon/punk-blocks
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
52
|
+
#
|
53
|
+
#
|
54
|
+
#
|
57
55
|
# **Data Structures**
|
58
|
-
#
|
56
|
+
#
|
59
57
|
# Layer is in the order of rendering
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# }
|
85
|
-
# ```
|
86
|
-
#
|
87
|
-
#
|
58
|
+
#
|
59
|
+
# enum Layer {
|
60
|
+
# Base, // 0 Base is the face. Determines if m or f version will be used to render the remaining layers
|
61
|
+
# Cheeks, // 1 (Rosy Cheeks)
|
62
|
+
# Blemish, // 2 (Mole, Spots)
|
63
|
+
# Hair, // 3 (Purple Hair, Shaved Head, Pigtails, ...)
|
64
|
+
# Beard, // 4 (Big Beard, Front Beard, Goat, ...)
|
65
|
+
# Eyes, // 5 (Clown Eyes Green, Green Eye Shadow, ...)
|
66
|
+
# Eyewear, // 6 (VR, 3D Glass, Eye Mask, Regular Shades, Welding Glasses, ...)
|
67
|
+
# Nose, // 7 (Clown Nose)
|
68
|
+
# Mouth, // 8 (Hot Lipstick, Smile, Buck Teeth, ...)
|
69
|
+
# MouthProp, // 9 (Medical Mask, Cigarette, ...)
|
70
|
+
# Earring, // 10 (Earring)
|
71
|
+
# Headgear, // 11 (Beanie, Fedora, Hoodie, Police Cap, Tiara, Headband, ...)
|
72
|
+
# Neck // 12 (Choker, Silver Chain, Gold Chain)
|
73
|
+
# }
|
74
|
+
#
|
75
|
+
# struct Block {
|
76
|
+
# Layer layer; // 13 possible layers
|
77
|
+
# bytes dataMale; // male version of this attribute
|
78
|
+
# bytes dataFemale;// female version of this attribute
|
79
|
+
# }
|
80
|
+
#
|
81
|
+
#
|
88
82
|
# **Events**
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# event NewBlock(address, uint256, string)
|
92
|
-
# ```
|
93
|
-
#
|
94
|
-
#
|
83
|
+
#
|
84
|
+
# event NewBlock(address, uint256, string)
|
95
85
|
|
96
86
|
|
97
87
|
class PunkBlocks < Ethlite::Contract
|
@@ -100,73 +90,54 @@ class PunkBlocks < Ethlite::Contract
|
|
100
90
|
|
101
91
|
# storage - mapping(bytes32 => Block) public blocks
|
102
92
|
#
|
103
|
-
#
|
104
93
|
# stores punk attributes as a png
|
105
|
-
#
|
106
|
-
#
|
107
|
-
sig "blocks", inputs: ["bytes32"], outputs: ["uint8","bytes","bytes"]
|
108
94
|
def blocks(arg0)
|
109
95
|
do_call("blocks", arg0)
|
110
96
|
end
|
97
|
+
sig "blocks", inputs: ["bytes32"], outputs: ["uint8","bytes","bytes"]
|
111
98
|
|
112
99
|
# function getBlocks
|
113
100
|
#
|
114
|
-
#
|
115
|
-
# ```
|
116
101
|
# getBlocks returns a sequential list of blocks in a single call
|
117
102
|
# @param _fromID is which id to begin from
|
118
103
|
# @param _count how many items to retrieve.
|
119
104
|
# @return Block[] list of blocks, uint256 next id
|
120
|
-
# ```
|
121
|
-
#
|
122
|
-
sig "getBlocks", inputs: ["uint256","uint256"], outputs: ["(uint8,bytes,bytes)[]","uint256"]
|
123
105
|
def getBlocks(_fromID, _count)
|
124
106
|
do_call("getBlocks", _fromID, _count)
|
125
107
|
end
|
108
|
+
sig "getBlocks", inputs: ["uint256","uint256"], outputs: ["(uint8,bytes,bytes)[]","uint256"]
|
126
109
|
|
127
110
|
# storage - mapping(uint256 => bytes32) public index
|
128
111
|
#
|
129
|
-
#
|
130
112
|
# index of each block by its sequence
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
sig "index", inputs: ["uint256"], outputs: ["bytes32"]
|
135
113
|
def index(arg0)
|
136
114
|
do_call("index", arg0)
|
137
115
|
end
|
116
|
+
sig "index", inputs: ["uint256"], outputs: ["bytes32"]
|
138
117
|
|
139
118
|
# storage - uint256 public nextId
|
140
119
|
#
|
141
|
-
#
|
142
120
|
# next id to use when adding a block
|
143
|
-
#
|
144
|
-
sig "nextId", outputs: ["uint256"]
|
145
121
|
def nextId()
|
146
122
|
do_call("nextId")
|
147
123
|
end
|
124
|
+
sig "nextId", outputs: ["uint256"]
|
148
125
|
|
149
126
|
# function svgFromIDs
|
150
127
|
#
|
151
|
-
#
|
152
|
-
# ```
|
153
128
|
# svgFromIDs returns the svg data as a string
|
154
129
|
# e.g. [9,55,99]
|
155
130
|
# One of the elements must be must be a layer 0 block.
|
156
131
|
# This element decides what version of image to use for the higher layers
|
157
132
|
# (dataMale or dataFemale)
|
158
133
|
# @param _ids uint256 ids of an attribute, by it's index of creation
|
159
|
-
# ```
|
160
|
-
#
|
161
|
-
sig "svgFromIDs", inputs: ["uint256[]"], outputs: ["string"]
|
162
134
|
def svgFromIDs(_ids)
|
163
135
|
do_call("svgFromIDs", _ids)
|
164
136
|
end
|
137
|
+
sig "svgFromIDs", inputs: ["uint256[]"], outputs: ["string"]
|
165
138
|
|
166
139
|
# function svgFromKeys
|
167
140
|
#
|
168
|
-
#
|
169
|
-
# ```
|
170
141
|
# svgFromKeys returns the svg data as a string
|
171
142
|
# @param _attributeKeys a list of attribute names that have been hashed,
|
172
143
|
# eg keccak256("Male 1"), keccak256("Goat")
|
@@ -175,17 +146,13 @@ end
|
|
175
146
|
# (dataMale or dataFemale)
|
176
147
|
# e.g. ["0x9039da071f773e85254cbd0f99efa70230c4c11d63fce84323db9eca8e8ef283",
|
177
148
|
# "0xd5de5c20969a9e22f93842ca4d65bac0c0387225cee45a944a14f03f9221fd4a"]
|
178
|
-
# ```
|
179
|
-
#
|
180
|
-
sig "svgFromKeys", inputs: ["bytes32[]"], outputs: ["string"]
|
181
149
|
def svgFromKeys(_attributeKeys)
|
182
150
|
do_call("svgFromKeys", _attributeKeys)
|
183
151
|
end
|
152
|
+
sig "svgFromKeys", inputs: ["bytes32[]"], outputs: ["string"]
|
184
153
|
|
185
154
|
# function svgFromNames
|
186
155
|
#
|
187
|
-
#
|
188
|
-
# ```
|
189
156
|
# svgFromNames returns the svg data as a string
|
190
157
|
# @param _attributeNames a list of attribute names, eg "Male 1", "Goat"
|
191
158
|
# must have at least 1 layer 0 attribute (eg. Male, Female, Alien, Ape, Zombie)
|
@@ -193,26 +160,19 @@ end
|
|
193
160
|
# Where "Male 1" is a layer 0 attribute, that decides what version of
|
194
161
|
# image to use for the higher
|
195
162
|
# layers (dataMale or dataFemale)
|
196
|
-
# ```
|
197
|
-
#
|
198
|
-
#
|
199
|
-
sig "svgFromNames", inputs: ["string[]"], outputs: ["string"]
|
200
163
|
def svgFromNames(_attributeNames)
|
201
164
|
do_call("svgFromNames", _attributeNames)
|
202
165
|
end
|
166
|
+
sig "svgFromNames", inputs: ["string[]"], outputs: ["string"]
|
203
167
|
|
204
168
|
# function svgFromPunkID
|
205
169
|
#
|
206
|
-
#
|
207
|
-
# ```
|
208
170
|
# svgFromPunkID returns the svg data as a string given a punk id
|
209
171
|
# @param _tokenID uint256 IDs a punk id, 0-9999
|
210
|
-
# ```
|
211
|
-
#
|
212
|
-
sig "svgFromPunkID", inputs: ["uint256"], outputs: ["string"]
|
213
172
|
def svgFromPunkID(_tokenID)
|
214
173
|
do_call("svgFromPunkID", _tokenID)
|
215
174
|
end
|
175
|
+
sig "svgFromPunkID", inputs: ["uint256"], outputs: ["string"]
|
216
176
|
|
217
177
|
end ## class PunkBlocks
|
218
178
|
|
@@ -1,38 +1,31 @@
|
|
1
1
|
#########################
|
2
2
|
# PunksV1 contract / (blockchain) services / function calls
|
3
|
-
# auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-
|
3
|
+
# auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-13 15:31:37 UTC
|
4
4
|
# - 14 query functions(s)
|
5
|
-
|
5
|
+
#
|
6
|
+
#
|
6
7
|
# - Pragma: solidity ^0.4.8
|
7
|
-
#
|
8
|
-
#
|
8
|
+
#
|
9
|
+
#
|
9
10
|
# **Data Structures**
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# ```
|
21
|
-
#
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# struct Offer {
|
14
|
+
# bool isForSale;
|
15
|
+
# uint punkIndex;
|
16
|
+
# address seller;
|
17
|
+
# uint minValue; // in ether
|
18
|
+
# address onlySellTo; // specify to sell only to a specific person
|
19
|
+
# }
|
20
|
+
#
|
22
21
|
# **Events**
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
# event PunkNoLongerForSale(uint indexed punkIndex)
|
31
|
-
# ```
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
22
|
+
#
|
23
|
+
# event Assign(address indexed to, uint256 punkIndex)
|
24
|
+
# event Transfer(address indexed from, address indexed to, uint256 value)
|
25
|
+
# event PunkTransfer(address indexed from, address indexed to, uint256 punkIndex)
|
26
|
+
# event PunkOffered(uint indexed punkIndex, uint minValue, address indexed toAddress)
|
27
|
+
# event PunkBought(uint indexed punkIndex, uint value, address indexed fromAddress, address indexed toAddress)
|
28
|
+
# event PunkNoLongerForSale(uint indexed punkIndex)
|
36
29
|
|
37
30
|
|
38
31
|
class PunksV1 < Ethlite::Contract
|
@@ -41,119 +34,104 @@ class PunksV1 < Ethlite::Contract
|
|
41
34
|
|
42
35
|
# storage - string public name
|
43
36
|
#
|
44
|
-
sig "name", outputs: ["string"]
|
45
37
|
def name()
|
46
38
|
do_call("name")
|
47
39
|
end
|
40
|
+
sig "name", outputs: ["string"]
|
48
41
|
|
49
42
|
# storage - mapping (uint => Offer) public punksOfferedForSale
|
50
43
|
#
|
51
|
-
#
|
52
44
|
# A record of punks that are offered for sale at a specific minimum value, and perhaps to a specific person
|
53
|
-
#
|
54
|
-
sig "punksOfferedForSale", inputs: ["uint256"], outputs: ["bool","uint256","address","uint256","address"]
|
55
45
|
def punksOfferedForSale(arg0)
|
56
46
|
do_call("punksOfferedForSale", arg0)
|
57
47
|
end
|
48
|
+
sig "punksOfferedForSale", inputs: ["uint256"], outputs: ["bool","uint256","address","uint256","address"]
|
58
49
|
|
59
50
|
# storage - uint256 public totalSupply
|
60
51
|
#
|
61
|
-
#
|
62
|
-
sig "totalSupply", outputs: ["uint256"]
|
63
52
|
def totalSupply()
|
64
53
|
do_call("totalSupply")
|
65
54
|
end
|
55
|
+
sig "totalSupply", outputs: ["uint256"]
|
66
56
|
|
67
57
|
# storage - uint8 public decimals
|
68
58
|
#
|
69
|
-
sig "decimals", outputs: ["uint8"]
|
70
59
|
def decimals()
|
71
60
|
do_call("decimals")
|
72
61
|
end
|
62
|
+
sig "decimals", outputs: ["uint8"]
|
73
63
|
|
74
64
|
# storage - string public imageHash
|
75
65
|
#
|
76
|
-
#
|
77
66
|
# You can use this hash to verify the image file containing all the punks
|
78
|
-
#
|
79
|
-
sig "imageHash", outputs: ["string"]
|
80
67
|
def imageHash()
|
81
68
|
do_call("imageHash")
|
82
69
|
end
|
70
|
+
sig "imageHash", outputs: ["string"]
|
83
71
|
|
84
72
|
# storage - uint public nextPunkIndexToAssign
|
85
73
|
#
|
86
|
-
#
|
87
|
-
sig "nextPunkIndexToAssign", outputs: ["uint256"]
|
88
74
|
def nextPunkIndexToAssign()
|
89
75
|
do_call("nextPunkIndexToAssign")
|
90
76
|
end
|
77
|
+
sig "nextPunkIndexToAssign", outputs: ["uint256"]
|
91
78
|
|
92
79
|
# storage - mapping (uint => address) public punkIndexToAddress
|
93
80
|
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
sig "punkIndexToAddress", inputs: ["uint256"], outputs: ["address"]
|
97
81
|
def punkIndexToAddress(arg0)
|
98
82
|
do_call("punkIndexToAddress", arg0)
|
99
83
|
end
|
84
|
+
sig "punkIndexToAddress", inputs: ["uint256"], outputs: ["address"]
|
100
85
|
|
101
86
|
# storage - string public standard
|
102
87
|
#
|
103
|
-
#
|
104
|
-
sig "standard", outputs: ["string"]
|
105
88
|
def standard()
|
106
89
|
do_call("standard")
|
107
90
|
end
|
91
|
+
sig "standard", outputs: ["string"]
|
108
92
|
|
109
93
|
# storage - mapping (address => uint256) public balanceOf
|
110
94
|
#
|
111
95
|
# This creates an array with all balances
|
112
|
-
#
|
113
|
-
#
|
114
|
-
sig "balanceOf", inputs: ["address"], outputs: ["uint256"]
|
115
96
|
def balanceOf(arg0)
|
116
97
|
do_call("balanceOf", arg0)
|
117
98
|
end
|
99
|
+
sig "balanceOf", inputs: ["address"], outputs: ["uint256"]
|
118
100
|
|
119
101
|
# storage - string public symbol
|
120
102
|
#
|
121
|
-
sig "symbol", outputs: ["string"]
|
122
103
|
def symbol()
|
123
104
|
do_call("symbol")
|
124
105
|
end
|
106
|
+
sig "symbol", outputs: ["string"]
|
125
107
|
|
126
108
|
# storage - uint public numberOfPunksToReserve
|
127
109
|
#
|
128
|
-
sig "numberOfPunksToReserve", outputs: ["uint256"]
|
129
110
|
def numberOfPunksToReserve()
|
130
111
|
do_call("numberOfPunksToReserve")
|
131
112
|
end
|
113
|
+
sig "numberOfPunksToReserve", outputs: ["uint256"]
|
132
114
|
|
133
115
|
# storage - uint public numberOfPunksReserved
|
134
116
|
#
|
135
|
-
#
|
136
|
-
sig "numberOfPunksReserved", outputs: ["uint256"]
|
137
117
|
def numberOfPunksReserved()
|
138
118
|
do_call("numberOfPunksReserved")
|
139
119
|
end
|
120
|
+
sig "numberOfPunksReserved", outputs: ["uint256"]
|
140
121
|
|
141
122
|
# storage - uint public punksRemainingToAssign
|
142
123
|
#
|
143
|
-
sig "punksRemainingToAssign", outputs: ["uint256"]
|
144
124
|
def punksRemainingToAssign()
|
145
125
|
do_call("punksRemainingToAssign")
|
146
126
|
end
|
127
|
+
sig "punksRemainingToAssign", outputs: ["uint256"]
|
147
128
|
|
148
129
|
# storage - mapping (address => uint) public pendingWithdrawals
|
149
130
|
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
sig "pendingWithdrawals", inputs: ["address"], outputs: ["uint256"]
|
154
131
|
def pendingWithdrawals(arg0)
|
155
132
|
do_call("pendingWithdrawals", arg0)
|
156
133
|
end
|
134
|
+
sig "pendingWithdrawals", inputs: ["address"], outputs: ["uint256"]
|
157
135
|
|
158
136
|
end ## class PunksV1
|
159
137
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethlite-contracts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ethlite
|