ethlite-contracts 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d178b4a5c7a28105b60fe1dfaff5bf4f3e5f4f55b3211d264b6dea4c3f50ebf5
4
+ data.tar.gz: b353c9a48aee0ba0cc116f4c6d924d4c6ad1e9a8c795b67520eb8d0313f8f57b
5
+ SHA512:
6
+ metadata.gz: 28fc5a42637286b9124b038da8c48667187755e508eeda7716716cefb4aefef66c66dcdae754cc653a13430ac47d82c13d3d6857d4f95323759a30cd51b0b36d
7
+ data.tar.gz: b599c075e9721301ba1865a151a320fbc8f28ee3a444e4aff68cf421c1ad748a34b03478e6b75cb9c6139d0b629ce6afe66bf8abcff164d650fdbfb0de58b8e4
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.0.1 / 2023-01-09
2
+
3
+ * Everything is new. First release
data/Manifest.txt ADDED
@@ -0,0 +1,9 @@
1
+ CHANGELOG.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/ethlite-contracts.rb
6
+ lib/ethlite/contract.rb
7
+ lib/ethlite/contracts.rb
8
+ lib/ethlite/contracts/punk_blocks.rb
9
+ lib/ethlite/contracts/punks_v1.rb
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Ready-To-Use (Blockchain) Contract Services / Function Calls For Ethereum & Co.
2
+
3
+
4
+ ethlite-contracts - ready-to-use (blockchain) contract services / function calls for ethereum & co
5
+
6
+
7
+ * home :: [github.com/rubycocos/blockchain](https://github.com/rubycocos/blockchain)
8
+ * bugs :: [github.com/rubycocos/blockchain/issues](https://github.com/rubycocos/blockchain/issues)
9
+ * gem :: [rubygems.org/gems/ethlite-contracts](https://rubygems.org/gems/ethlite-contracts)
10
+ * rdoc :: [rubydoc.info/gems/ethlite-contracts](http://rubydoc.info/gems/ethlite-contracts)
11
+
12
+
13
+
14
+ ## Usage
15
+
16
+ To be done
17
+
18
+
19
+
20
+
21
+ ## License
22
+
23
+ The scripts are dedicated to the public domain.
24
+ Use it as you please with no restrictions whatsoever.
25
+
26
+
27
+ ## Questions? Comments?
28
+
29
+
30
+ Post them on the [D.I.Y. Punk (Pixel) Art reddit](https://old.reddit.com/r/DIYPunkArt). Thanks.
31
+
32
+
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'hoe'
2
+
3
+
4
+ Hoe.spec 'ethlite-contracts' do
5
+
6
+ self.version = '0.0.1'
7
+ self.summary = "ethlite-contracts - ready-to-use (blockchain) contract services / function calls for ethereum & co."
8
+ self.description = summary
9
+
10
+ self.urls = { home: 'https://github.com/rubycocos/blockchain' }
11
+
12
+ self.author = 'Gerald Bauer'
13
+ self.email = 'wwwmake@googlegroups.com'
14
+
15
+ # switch extension to .markdown for gihub formatting
16
+ self.readme_file = 'README.md'
17
+ self.history_file = 'CHANGELOG.md'
18
+
19
+ self.extra_deps = [
20
+ ['ethlite'],
21
+ ]
22
+
23
+ self.licenses = ['Public Domain']
24
+
25
+ self.spec_extras = {
26
+ required_ruby_version: '>= 2.3'
27
+ }
28
+
29
+ end
30
+
@@ -0,0 +1,53 @@
1
+
2
+
3
+ module Ethlite
4
+
5
+ class Contract
6
+
7
+
8
+ def self.at( address )
9
+ puts " creating new contract #{self.name} @ #{address}"
10
+ new( address )
11
+ end
12
+
13
+
14
+ def self.sig( name, inputs: [], outputs: [] )
15
+ @methods ||= {}
16
+ @methods[ name ] = ContractMethod.new( name,
17
+ inputs: inputs,
18
+ outputs: outputs )
19
+ @methods
20
+ end
21
+ def self.methods()
22
+ @methods ||= {}
23
+ @methods
24
+ end
25
+
26
+
27
+
28
+ def self.address( address )
29
+ @address = address
30
+ @address
31
+ end
32
+
33
+ def self.default_address()
34
+ defined?( @address ) ? @address : nil
35
+ end
36
+
37
+ def initialize( address = self.class.default_address )
38
+ @address = address
39
+ end
40
+
41
+
42
+ def do_call( name, *args )
43
+ puts "==> calling #{self.class.name}##{name} with args:"
44
+ pp args
45
+ method = self.class.methods[ name ]
46
+ ## pp m
47
+ method.do_call( Ethlite.config.rpc, @address, args )
48
+ end
49
+
50
+ end ## class Contract
51
+
52
+
53
+ end ## module Ethlite
@@ -0,0 +1,59 @@
1
+ #########################
2
+ # PunkBlocks contract / (blockchain) services / function calls
3
+ # auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-09 17:48:57 UTC
4
+ # - 8 query functions(s)
5
+
6
+ class PunkBlocks < Ethlite::Contract
7
+
8
+ address "0x58e90596c2065befd3060767736c829c18f3474c"
9
+
10
+ # function **blocks**(bytes32 _) ⇒ (enum PunkBlocks.Layer layer, bytes dataMale, bytes dataFemale) _readonly_
11
+ sig "blocks", inputs: ["bytes32"], outputs: ["uint8","bytes","bytes"]
12
+ def blocks(arg0)
13
+ do_call("blocks", arg0)
14
+ end
15
+
16
+ # function **getBlocks**(uint256 _fromID, uint256 _count) ⇒ (struct PunkBlocks.Block[] _, uint256 _) _readonly_
17
+ sig "getBlocks", inputs: ["uint256","uint256"], outputs: ["(uint8,bytes,bytes)[]","uint256"]
18
+ def getBlocks(_fromID, _count)
19
+ do_call("getBlocks", _fromID, _count)
20
+ end
21
+
22
+ # function **index**(uint256 _) ⇒ (bytes32 _) _readonly_
23
+ sig "index", inputs: ["uint256"], outputs: ["bytes32"]
24
+ def index(arg0)
25
+ do_call("index", arg0)
26
+ end
27
+
28
+ # function **nextId**() ⇒ (uint256 _) _readonly_
29
+ sig "nextId", outputs: ["uint256"]
30
+ def nextId()
31
+ do_call("nextId")
32
+ end
33
+
34
+ # function **svgFromIDs**(uint256[] _ids) ⇒ (string _) _readonly_
35
+ sig "svgFromIDs", inputs: ["uint256[]"], outputs: ["string"]
36
+ def svgFromIDs(_ids)
37
+ do_call("svgFromIDs", _ids)
38
+ end
39
+
40
+ # function **svgFromKeys**(bytes32[] _attributeKeys) ⇒ (string _) _readonly_
41
+ sig "svgFromKeys", inputs: ["bytes32[]"], outputs: ["string"]
42
+ def svgFromKeys(_attributeKeys)
43
+ do_call("svgFromKeys", _attributeKeys)
44
+ end
45
+
46
+ # function **svgFromNames**(string[] _attributeNames) ⇒ (string _) _readonly_
47
+ sig "svgFromNames", inputs: ["string[]"], outputs: ["string"]
48
+ def svgFromNames(_attributeNames)
49
+ do_call("svgFromNames", _attributeNames)
50
+ end
51
+
52
+ # function **svgFromPunkID**(uint256 _tokenID) ⇒ (string _) _readonly_
53
+ sig "svgFromPunkID", inputs: ["uint256"], outputs: ["string"]
54
+ def svgFromPunkID(_tokenID)
55
+ do_call("svgFromPunkID", _tokenID)
56
+ end
57
+
58
+ end ## class PunkBlocks
59
+
@@ -0,0 +1,95 @@
1
+ #########################
2
+ # PunksV1 contract / (blockchain) services / function calls
3
+ # auto-generated via abigen (see https://rubygems.org/gems/abigen) on 2023-01-09 17:48:57 UTC
4
+ # - 14 query functions(s)
5
+
6
+ class PunksV1 < Ethlite::Contract
7
+
8
+ address "0x6ba6f2207e343923ba692e5cae646fb0f566db8d"
9
+
10
+ # function **name**() ⇒ (string _) _readonly_
11
+ sig "name", outputs: ["string"]
12
+ def name()
13
+ do_call("name")
14
+ end
15
+
16
+ # function **punksOfferedForSale**(uint256 _) ⇒ (bool isForSale, uint256 punkIndex, address seller, uint256 minValue, address onlySellTo) _readonly_
17
+ sig "punksOfferedForSale", inputs: ["uint256"], outputs: ["bool","uint256","address","uint256","address"]
18
+ def punksOfferedForSale(arg0)
19
+ do_call("punksOfferedForSale", arg0)
20
+ end
21
+
22
+ # function **totalSupply**() ⇒ (uint256 _) _readonly_
23
+ sig "totalSupply", outputs: ["uint256"]
24
+ def totalSupply()
25
+ do_call("totalSupply")
26
+ end
27
+
28
+ # function **decimals**() ⇒ (uint8 _) _readonly_
29
+ sig "decimals", outputs: ["uint8"]
30
+ def decimals()
31
+ do_call("decimals")
32
+ end
33
+
34
+ # function **imageHash**() ⇒ (string _) _readonly_
35
+ sig "imageHash", outputs: ["string"]
36
+ def imageHash()
37
+ do_call("imageHash")
38
+ end
39
+
40
+ # function **nextPunkIndexToAssign**() ⇒ (uint256 _) _readonly_
41
+ sig "nextPunkIndexToAssign", outputs: ["uint256"]
42
+ def nextPunkIndexToAssign()
43
+ do_call("nextPunkIndexToAssign")
44
+ end
45
+
46
+ # function **punkIndexToAddress**(uint256 _) ⇒ (address _) _readonly_
47
+ sig "punkIndexToAddress", inputs: ["uint256"], outputs: ["address"]
48
+ def punkIndexToAddress(arg0)
49
+ do_call("punkIndexToAddress", arg0)
50
+ end
51
+
52
+ # function **standard**() ⇒ (string _) _readonly_
53
+ sig "standard", outputs: ["string"]
54
+ def standard()
55
+ do_call("standard")
56
+ end
57
+
58
+ # function **balanceOf**(address _) ⇒ (uint256 _) _readonly_
59
+ sig "balanceOf", inputs: ["address"], outputs: ["uint256"]
60
+ def balanceOf(arg0)
61
+ do_call("balanceOf", arg0)
62
+ end
63
+
64
+ # function **symbol**() ⇒ (string _) _readonly_
65
+ sig "symbol", outputs: ["string"]
66
+ def symbol()
67
+ do_call("symbol")
68
+ end
69
+
70
+ # function **numberOfPunksToReserve**() ⇒ (uint256 _) _readonly_
71
+ sig "numberOfPunksToReserve", outputs: ["uint256"]
72
+ def numberOfPunksToReserve()
73
+ do_call("numberOfPunksToReserve")
74
+ end
75
+
76
+ # function **numberOfPunksReserved**() ⇒ (uint256 _) _readonly_
77
+ sig "numberOfPunksReserved", outputs: ["uint256"]
78
+ def numberOfPunksReserved()
79
+ do_call("numberOfPunksReserved")
80
+ end
81
+
82
+ # function **punksRemainingToAssign**() ⇒ (uint256 _) _readonly_
83
+ sig "punksRemainingToAssign", outputs: ["uint256"]
84
+ def punksRemainingToAssign()
85
+ do_call("punksRemainingToAssign")
86
+ end
87
+
88
+ # function **pendingWithdrawals**(address _) ⇒ (uint256 _) _readonly_
89
+ sig "pendingWithdrawals", inputs: ["address"], outputs: ["uint256"]
90
+ def pendingWithdrawals(arg0)
91
+ do_call("pendingWithdrawals", arg0)
92
+ end
93
+
94
+ end ## class PunksV1
95
+
@@ -0,0 +1 @@
1
+ require_relative '../ethlite-contracts' ## lets you use require 'ethlite/contracts' too
@@ -0,0 +1,17 @@
1
+ ## 3rd party gems
2
+ require 'ethlite'
3
+
4
+
5
+
6
+
7
+ ## out own code
8
+
9
+ # shared base contract machinery - keep here
10
+ ## or rename to Base or such - why? why not?
11
+ require_relative 'ethlite/contract'
12
+
13
+ ### generated contracts via abigen
14
+ require_relative 'ethlite/contracts/punks_v1'
15
+ require_relative 'ethlite/contracts/punk_blocks'
16
+
17
+
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ethlite-contracts
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gerald Bauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ethlite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: hoe
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.23'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.23'
61
+ description: ethlite-contracts - ready-to-use (blockchain) contract services / function
62
+ calls for ethereum & co.
63
+ email: wwwmake@googlegroups.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - CHANGELOG.md
68
+ - Manifest.txt
69
+ - README.md
70
+ files:
71
+ - CHANGELOG.md
72
+ - Manifest.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lib/ethlite-contracts.rb
76
+ - lib/ethlite/contract.rb
77
+ - lib/ethlite/contracts.rb
78
+ - lib/ethlite/contracts/punk_blocks.rb
79
+ - lib/ethlite/contracts/punks_v1.rb
80
+ homepage: https://github.com/rubycocos/blockchain
81
+ licenses:
82
+ - Public Domain
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options:
86
+ - "--main"
87
+ - README.md
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '2.3'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.3.7
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: ethlite-contracts - ready-to-use (blockchain) contract services / function
105
+ calls for ethereum & co.
106
+ test_files: []