ethlite-contracts 0.0.1 → 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 +137 -18
- data/lib/ethlite/contracts/punks_v1.rb +72 -30
- 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,59 +1,178 @@
|
|
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-13 15:31:38 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
|
+
# A Registry of 24x24 png images
|
33
|
+
#
|
34
|
+
# This contract:
|
35
|
+
#
|
36
|
+
# 1. Stores all the classic traits of the CryptoPunks in
|
37
|
+
# individual png files, 100% on-chain. These are then used as
|
38
|
+
# blocks to construct CryptoPunk images. Outputted as SVGs.
|
39
|
+
#
|
40
|
+
# 2. Any of the 10,000 "classic" CryptoPunks can be generated
|
41
|
+
# by supplying desired arguments to a function, such as
|
42
|
+
# the id of a punk, or a list of the traits.
|
43
|
+
#
|
44
|
+
# 3. An unlimited number of new punk images can be generated from
|
45
|
+
# the existing classic set of traits, or even from new traits!
|
46
|
+
#
|
47
|
+
# 4. New traits (blocks) can be added to the contract by
|
48
|
+
# registering them with the `registerBlock` function.
|
49
|
+
#
|
50
|
+
# Further documentation:
|
51
|
+
# https://github.com/0xTycoon/punk-blocks
|
52
|
+
#
|
53
|
+
#
|
54
|
+
#
|
55
|
+
# **Data Structures**
|
56
|
+
#
|
57
|
+
# Layer is in the order of rendering
|
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
|
+
#
|
82
|
+
# **Events**
|
83
|
+
#
|
84
|
+
# event NewBlock(address, uint256, string)
|
85
|
+
|
5
86
|
|
6
87
|
class PunkBlocks < Ethlite::Contract
|
7
88
|
|
8
89
|
address "0x58e90596c2065befd3060767736c829c18f3474c"
|
9
90
|
|
10
|
-
#
|
11
|
-
|
91
|
+
# storage - mapping(bytes32 => Block) public blocks
|
92
|
+
#
|
93
|
+
# stores punk attributes as a png
|
12
94
|
def blocks(arg0)
|
13
95
|
do_call("blocks", arg0)
|
14
96
|
end
|
97
|
+
sig "blocks", inputs: ["bytes32"], outputs: ["uint8","bytes","bytes"]
|
15
98
|
|
16
|
-
# function
|
17
|
-
|
99
|
+
# function getBlocks
|
100
|
+
#
|
101
|
+
# getBlocks returns a sequential list of blocks in a single call
|
102
|
+
# @param _fromID is which id to begin from
|
103
|
+
# @param _count how many items to retrieve.
|
104
|
+
# @return Block[] list of blocks, uint256 next id
|
18
105
|
def getBlocks(_fromID, _count)
|
19
106
|
do_call("getBlocks", _fromID, _count)
|
20
107
|
end
|
108
|
+
sig "getBlocks", inputs: ["uint256","uint256"], outputs: ["(uint8,bytes,bytes)[]","uint256"]
|
21
109
|
|
22
|
-
#
|
23
|
-
|
110
|
+
# storage - mapping(uint256 => bytes32) public index
|
111
|
+
#
|
112
|
+
# index of each block by its sequence
|
24
113
|
def index(arg0)
|
25
114
|
do_call("index", arg0)
|
26
115
|
end
|
116
|
+
sig "index", inputs: ["uint256"], outputs: ["bytes32"]
|
27
117
|
|
28
|
-
#
|
29
|
-
|
118
|
+
# storage - uint256 public nextId
|
119
|
+
#
|
120
|
+
# next id to use when adding a block
|
30
121
|
def nextId()
|
31
122
|
do_call("nextId")
|
32
123
|
end
|
124
|
+
sig "nextId", outputs: ["uint256"]
|
33
125
|
|
34
|
-
# function
|
35
|
-
|
126
|
+
# function svgFromIDs
|
127
|
+
#
|
128
|
+
# svgFromIDs returns the svg data as a string
|
129
|
+
# e.g. [9,55,99]
|
130
|
+
# One of the elements must be must be a layer 0 block.
|
131
|
+
# This element decides what version of image to use for the higher layers
|
132
|
+
# (dataMale or dataFemale)
|
133
|
+
# @param _ids uint256 ids of an attribute, by it's index of creation
|
36
134
|
def svgFromIDs(_ids)
|
37
135
|
do_call("svgFromIDs", _ids)
|
38
136
|
end
|
137
|
+
sig "svgFromIDs", inputs: ["uint256[]"], outputs: ["string"]
|
39
138
|
|
40
|
-
# function
|
41
|
-
|
139
|
+
# function svgFromKeys
|
140
|
+
#
|
141
|
+
# svgFromKeys returns the svg data as a string
|
142
|
+
# @param _attributeKeys a list of attribute names that have been hashed,
|
143
|
+
# eg keccak256("Male 1"), keccak256("Goat")
|
144
|
+
# must have at least 1 layer 0 attribute (eg. keccak256("Male 1")) which
|
145
|
+
# decides what version of image to use for the higher layers
|
146
|
+
# (dataMale or dataFemale)
|
147
|
+
# e.g. ["0x9039da071f773e85254cbd0f99efa70230c4c11d63fce84323db9eca8e8ef283",
|
148
|
+
# "0xd5de5c20969a9e22f93842ca4d65bac0c0387225cee45a944a14f03f9221fd4a"]
|
42
149
|
def svgFromKeys(_attributeKeys)
|
43
150
|
do_call("svgFromKeys", _attributeKeys)
|
44
151
|
end
|
152
|
+
sig "svgFromKeys", inputs: ["bytes32[]"], outputs: ["string"]
|
45
153
|
|
46
|
-
# function
|
47
|
-
|
154
|
+
# function svgFromNames
|
155
|
+
#
|
156
|
+
# svgFromNames returns the svg data as a string
|
157
|
+
# @param _attributeNames a list of attribute names, eg "Male 1", "Goat"
|
158
|
+
# must have at least 1 layer 0 attribute (eg. Male, Female, Alien, Ape, Zombie)
|
159
|
+
# e.g. ["Male 1","Goat"]
|
160
|
+
# Where "Male 1" is a layer 0 attribute, that decides what version of
|
161
|
+
# image to use for the higher
|
162
|
+
# layers (dataMale or dataFemale)
|
48
163
|
def svgFromNames(_attributeNames)
|
49
164
|
do_call("svgFromNames", _attributeNames)
|
50
165
|
end
|
166
|
+
sig "svgFromNames", inputs: ["string[]"], outputs: ["string"]
|
51
167
|
|
52
|
-
# function
|
53
|
-
|
168
|
+
# function svgFromPunkID
|
169
|
+
#
|
170
|
+
# svgFromPunkID returns the svg data as a string given a punk id
|
171
|
+
# @param _tokenID uint256 IDs a punk id, 0-9999
|
54
172
|
def svgFromPunkID(_tokenID)
|
55
173
|
do_call("svgFromPunkID", _tokenID)
|
56
174
|
end
|
175
|
+
sig "svgFromPunkID", inputs: ["uint256"], outputs: ["string"]
|
57
176
|
|
58
177
|
end ## class PunkBlocks
|
59
178
|
|
@@ -1,95 +1,137 @@
|
|
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-13 15:31:37 UTC
|
4
|
+
# - 14 query functions(s)
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# - Pragma: solidity ^0.4.8
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# **Data Structures**
|
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
|
+
# **Events**
|
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)
|
29
|
+
|
5
30
|
|
6
31
|
class PunksV1 < Ethlite::Contract
|
7
32
|
|
8
33
|
address "0x6ba6f2207e343923ba692e5cae646fb0f566db8d"
|
9
34
|
|
10
|
-
#
|
11
|
-
|
35
|
+
# storage - string public name
|
36
|
+
#
|
12
37
|
def name()
|
13
38
|
do_call("name")
|
14
39
|
end
|
40
|
+
sig "name", outputs: ["string"]
|
15
41
|
|
16
|
-
#
|
17
|
-
|
42
|
+
# storage - mapping (uint => Offer) public punksOfferedForSale
|
43
|
+
#
|
44
|
+
# A record of punks that are offered for sale at a specific minimum value, and perhaps to a specific person
|
18
45
|
def punksOfferedForSale(arg0)
|
19
46
|
do_call("punksOfferedForSale", arg0)
|
20
47
|
end
|
48
|
+
sig "punksOfferedForSale", inputs: ["uint256"], outputs: ["bool","uint256","address","uint256","address"]
|
21
49
|
|
22
|
-
#
|
23
|
-
|
50
|
+
# storage - uint256 public totalSupply
|
51
|
+
#
|
24
52
|
def totalSupply()
|
25
53
|
do_call("totalSupply")
|
26
54
|
end
|
55
|
+
sig "totalSupply", outputs: ["uint256"]
|
27
56
|
|
28
|
-
#
|
29
|
-
|
57
|
+
# storage - uint8 public decimals
|
58
|
+
#
|
30
59
|
def decimals()
|
31
60
|
do_call("decimals")
|
32
61
|
end
|
62
|
+
sig "decimals", outputs: ["uint8"]
|
33
63
|
|
34
|
-
#
|
35
|
-
|
64
|
+
# storage - string public imageHash
|
65
|
+
#
|
66
|
+
# You can use this hash to verify the image file containing all the punks
|
36
67
|
def imageHash()
|
37
68
|
do_call("imageHash")
|
38
69
|
end
|
70
|
+
sig "imageHash", outputs: ["string"]
|
39
71
|
|
40
|
-
#
|
41
|
-
|
72
|
+
# storage - uint public nextPunkIndexToAssign
|
73
|
+
#
|
42
74
|
def nextPunkIndexToAssign()
|
43
75
|
do_call("nextPunkIndexToAssign")
|
44
76
|
end
|
77
|
+
sig "nextPunkIndexToAssign", outputs: ["uint256"]
|
45
78
|
|
46
|
-
#
|
47
|
-
|
79
|
+
# storage - mapping (uint => address) public punkIndexToAddress
|
80
|
+
#
|
48
81
|
def punkIndexToAddress(arg0)
|
49
82
|
do_call("punkIndexToAddress", arg0)
|
50
83
|
end
|
84
|
+
sig "punkIndexToAddress", inputs: ["uint256"], outputs: ["address"]
|
51
85
|
|
52
|
-
#
|
53
|
-
|
86
|
+
# storage - string public standard
|
87
|
+
#
|
54
88
|
def standard()
|
55
89
|
do_call("standard")
|
56
90
|
end
|
91
|
+
sig "standard", outputs: ["string"]
|
57
92
|
|
58
|
-
#
|
59
|
-
|
93
|
+
# storage - mapping (address => uint256) public balanceOf
|
94
|
+
#
|
95
|
+
# This creates an array with all balances
|
60
96
|
def balanceOf(arg0)
|
61
97
|
do_call("balanceOf", arg0)
|
62
98
|
end
|
99
|
+
sig "balanceOf", inputs: ["address"], outputs: ["uint256"]
|
63
100
|
|
64
|
-
#
|
65
|
-
|
101
|
+
# storage - string public symbol
|
102
|
+
#
|
66
103
|
def symbol()
|
67
104
|
do_call("symbol")
|
68
105
|
end
|
106
|
+
sig "symbol", outputs: ["string"]
|
69
107
|
|
70
|
-
#
|
71
|
-
|
108
|
+
# storage - uint public numberOfPunksToReserve
|
109
|
+
#
|
72
110
|
def numberOfPunksToReserve()
|
73
111
|
do_call("numberOfPunksToReserve")
|
74
112
|
end
|
113
|
+
sig "numberOfPunksToReserve", outputs: ["uint256"]
|
75
114
|
|
76
|
-
#
|
77
|
-
|
115
|
+
# storage - uint public numberOfPunksReserved
|
116
|
+
#
|
78
117
|
def numberOfPunksReserved()
|
79
118
|
do_call("numberOfPunksReserved")
|
80
119
|
end
|
120
|
+
sig "numberOfPunksReserved", outputs: ["uint256"]
|
81
121
|
|
82
|
-
#
|
83
|
-
|
122
|
+
# storage - uint public punksRemainingToAssign
|
123
|
+
#
|
84
124
|
def punksRemainingToAssign()
|
85
125
|
do_call("punksRemainingToAssign")
|
86
126
|
end
|
127
|
+
sig "punksRemainingToAssign", outputs: ["uint256"]
|
87
128
|
|
88
|
-
#
|
89
|
-
|
129
|
+
# storage - mapping (address => uint) public pendingWithdrawals
|
130
|
+
#
|
90
131
|
def pendingWithdrawals(arg0)
|
91
132
|
do_call("pendingWithdrawals", arg0)
|
92
133
|
end
|
134
|
+
sig "pendingWithdrawals", inputs: ["address"], outputs: ["uint256"]
|
93
135
|
|
94
136
|
end ## class PunksV1
|
95
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.
|
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
|