erc20 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: codecov
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- codecov:
12
- timeout-minutes: 15
13
- runs-on: ubuntu-24.04
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 3.3
19
- bundler-cache: true
20
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
- - run: bundle install --no-color
22
- - run: bundle exec rake
23
- - uses: codecov/codecov-action@v5
24
- with:
25
- token: ${{ secrets.CODECOV_TOKEN }}
26
- files: coverage/.resultset.json
27
- fail_ci_if_error: true
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: copyrights
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- copyrights:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: yegor256/copyrights-action@0.0.8
@@ -1,23 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: markdown-lint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- paths-ignore: ['paper/**', 'sandbox/**']
14
- concurrency:
15
- group: markdown-lint-${{ github.ref }}
16
- cancel-in-progress: true
17
- jobs:
18
- markdown-lint:
19
- timeout-minutes: 15
20
- runs-on: ubuntu-24.04
21
- steps:
22
- - uses: actions/checkout@v4
23
- - uses: articulate/actions-markdownlint@v1
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: pdd
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- pdd:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: volodya-lombrozo/pdd-action@master
@@ -1,38 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: rake
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- rake:
15
- strategy:
16
- matrix:
17
- os: [ubuntu-24.04]
18
- ruby: [3.3]
19
- runs-on: ${{ matrix.os }}
20
- env:
21
- INFURA_KEY: ${{ secrets.INFURA_KEY }}
22
- GETBLOCK_KEY: ${{ secrets.GETBLOCK_KEY }}
23
- GETBLOCK_SEPOILA_KEY: ${{ secrets.GETBLOCK_SEPOILA_KEY }}
24
- steps:
25
- - uses: actions/checkout@v4
26
- - run: |
27
- sudo apt-get update --yes --fix-missing
28
- sudo apt-get install --yes autoconf
29
- if: matrix.os == 'ubuntu-24.04'
30
- - run: brew install automake
31
- if: matrix.os == 'macos-15'
32
- - uses: ruby/setup-ruby@v1
33
- with:
34
- ruby-version: ${{ matrix.ruby }}
35
- bundler-cache: true
36
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
37
- - run: bundle install --no-color
38
- - run: bundle exec rake
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: reuse
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- reuse:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: fsfe/reuse-action@v5
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: shellcheck
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- shellcheck:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: ludeeus/action-shellcheck@master
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: xcop
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- xcop:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: g4s8/xcop-action@master
@@ -1,21 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: yamllint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- yamllint:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: ibiqlik/action-yamllint@v3
20
- with:
21
- config_file: .yamllint.yml
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *.gem
2
- .DS_Store
3
- .bundle/
4
- .idea/
5
- .yardoc/
6
- coverage/
7
- doc/
8
- node_modules/
9
- rdoc/
10
- vendor/
data/.gitleaksignore DELETED
@@ -1,2 +0,0 @@
1
- hardhat/hardhat.config.js:generic-api-key:38
2
- hardhat/hardhat.config.js:generic-api-key:42
data/.pdd DELETED
@@ -1,7 +0,0 @@
1
- --source=.
2
- --verbose
3
- --exclude target/**/*
4
- --exclude coverage/**/*
5
- --rule min-words:20
6
- --rule min-estimate:15
7
- --rule max-estimate:90
data/.rubocop.yml DELETED
@@ -1,49 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- AllCops:
5
- Exclude:
6
- - 'bin/**/*'
7
- - 'assets/**/*'
8
- - 'vendor/**/**'
9
- DisplayCopNames: true
10
- TargetRubyVersion: 3.2
11
- SuggestExtensions: false
12
- NewCops: enable
13
- plugins:
14
- - rubocop-performance
15
- - rubocop-rake
16
- - rubocop-minitest
17
- Minitest/EmptyLineBeforeAssertionMethods:
18
- Enabled: false
19
- Gemspec/RequiredRubyVersion:
20
- Enabled: false
21
- Metrics/MethodLength:
22
- Enabled: false
23
- Style/ClassAndModuleChildren:
24
- Enabled: false
25
- Layout/MultilineMethodCallIndentation:
26
- Enabled: false
27
- Metrics/AbcSize:
28
- Enabled: false
29
- Metrics/ParameterLists:
30
- Enabled: false
31
- Metrics/BlockLength:
32
- Max: 100
33
- Metrics/CyclomaticComplexity:
34
- Max: 25
35
- Metrics/PerceivedComplexity:
36
- Max: 30
37
- Metrics/ClassLength:
38
- Enabled: false
39
- Layout/EmptyLineAfterGuardClause:
40
- Enabled: false
41
- Naming/MethodParameterName:
42
- MinNameLength: 2
43
- Layout/EndOfLine:
44
- EnforcedStyle: lf
45
- Security/MarshalLoad:
46
- Enabled: false
47
- Layout/MultilineAssignmentLayout:
48
- Enabled: true
49
- require: []
data/.rultor.yml DELETED
@@ -1,26 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- docker:
6
- image: yegor256/ruby
7
- assets:
8
- rubygems.yml: yegor256/home#assets/rubygems.yml
9
- install: |
10
- pdd -f /dev/null
11
- bundle install --no-color
12
- release:
13
- pre: false
14
- script: |-
15
- [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
16
- DONCE_SUDO=true bundle exec rake
17
- rm -rf *.gem
18
- sed -i "s/0\.0\.0/${tag}/g" lib/erc20/erc20.rb
19
- git add lib/erc20/erc20.rb
20
- git commit -m "version set to ${tag}"
21
- gem build erc20.gemspec
22
- chmod 0600 ../rubygems.yml
23
- gem push *.gem --config-file ../rubygems.yml
24
- merge:
25
- script: |-
26
- DONCE_SUDO=true bundle exec rake
data/.yamllint.yml DELETED
@@ -1,12 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- extends: default
5
- rules:
6
- line-length: disable
7
- brackets:
8
- min-spaces-inside: 0
9
- max-spaces-inside: 2
10
- truthy:
11
- level: warning
12
- allowed-values: [ 'on', 'true', 'false', 'yes', 'no' ]
data/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base"
5
- ]
6
- }
@@ -1,113 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
4
- # SPDX-License-Identifier: MIT
5
-
6
- require 'backtrace'
7
- require 'donce'
8
- require 'eth'
9
- require 'faraday'
10
- require 'loog'
11
- require 'random-port'
12
- require 'shellwords'
13
- require 'threads'
14
- require 'typhoeus'
15
- require_relative '../test__helper'
16
- require_relative '../../lib/erc20/fake_wallet'
17
-
18
- # Test.
19
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
20
- # Copyright:: Copyright (c) 2025 Yegor Bugayenko
21
- # License:: MIT
22
- class TestFakeWallet < ERC20::Test
23
- def test_checks_gas_estimate
24
- b = ERC20::FakeWallet.new.gas_estimate(
25
- '0xEB2fE8872A6f1eDb70a2632Effffffffffffffff',
26
- '0xfadef8ba4a5d709a2bf55b7a8798c9b438c640c1',
27
- 44_000
28
- )
29
- refute_nil(b)
30
- end
31
-
32
- def test_checks_gas_price
33
- gwei = ERC20::FakeWallet.new.gas_price
34
- refute_nil(gwei)
35
- end
36
-
37
- def test_checks_fake_balance
38
- w = ERC20::FakeWallet.new
39
- a = '0xEB2fE8872A6f1eDb70a2632Effffffffffffffff'
40
- b = w.balance(a)
41
- refute_nil(b)
42
- assert_equal(42_000_000, b)
43
- assert_includes(w.history, { method: :balance, result: b, address: a })
44
- end
45
-
46
- def test_checks_preset_fake_balance
47
- w = ERC20::FakeWallet.new
48
- a = '0xEB2fE8872A6f1eDb70a2632Effffffffeefbbfaa'
49
- b = 55_555
50
- w.set_balance(a, b)
51
- assert_equal(b, w.balance(a))
52
- end
53
-
54
- def test_checks_fake_eth_balance
55
- a = '0xEB2fE8872A6f1eDb70a2632Ebbffffff66fff77f'
56
- w = ERC20::FakeWallet.new
57
- b = w.eth_balance(a)
58
- refute_nil(b)
59
- assert_equal(77_000_000_000_000_000, b)
60
- assert_includes(w.history, { method: :eth_balance, result: b, address: a })
61
- end
62
-
63
- def test_checks_preset_fake_eth_balance
64
- a = '0xEB2fE8872A6f1eDb70a2632Eff88fff99fff33ff'
65
- w = ERC20::FakeWallet.new
66
- b = 33_333
67
- w.set_eth_balance(a, b)
68
- assert_equal(b, w.eth_balance(a))
69
- end
70
-
71
- def test_returns_host
72
- assert_equal('example.com', ERC20::FakeWallet.new.host)
73
- end
74
-
75
- def test_pays_fake_money
76
- priv = '81a9b2114d53731ecc84b261ef6c0387dde34d5907fe7b441240cc21d61bf80a'
77
- address = '0xfadef8ba4a5d709a2bf55b7a8798c9b438c640c1'
78
- w = ERC20::FakeWallet.new
79
- amount = 555_000
80
- txn = w.pay(priv, address, amount)
81
- assert_equal(66, txn.length)
82
- assert_match(/^0x[a-f0-9]{64}$/, txn)
83
- assert_equal(ERC20::FakeWallet::TXN_HASH, txn)
84
- assert_includes(w.history, { method: :pay, result: txn, priv:, address:, amount:, gas_limit: nil, gas_price: nil })
85
- end
86
-
87
- def test_pays_fake_eths
88
- priv = '81a9b2114d53731ecc84b261ef6c0387dde34d5907fe7b441240cc21d61bf80a'
89
- to = '0xfadef8ba4a5d709a2bf55b7a8798c9b438c640c1'
90
- txn = ERC20::FakeWallet.new.eth_pay(Eth::Key.new(priv:), to, 555)
91
- assert_equal(66, txn.length)
92
- assert_match(/^0x[a-f0-9]{64}$/, txn)
93
- end
94
-
95
- def test_accepts_payments_on_hardhat
96
- active = Primitivo.new([])
97
- addresses = Primitivo.new(['0xfadef8ba4a5d709a2bf55b7a8798c9b438c640c1'])
98
- event = nil
99
- daemon =
100
- Thread.new do
101
- ERC20::FakeWallet.new.accept(addresses, active, delay: 0.1) do |e|
102
- event = e
103
- end
104
- rescue StandardError => e
105
- fake_loog.error(Backtrace.new(e))
106
- end
107
- wait_for { !active.to_a.empty? }
108
- wait_for { !event.nil? }
109
- daemon.kill
110
- daemon.join(30)
111
- refute_nil(event)
112
- end
113
- end