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