osbc 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env +5 -0
- data/.rspec +1 -0
- data/.rubocop.yml +273 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Dockerfile +17 -0
- data/Gemfile +109 -0
- data/Gemfile.lock +343 -0
- data/LICENSE.md +21 -0
- data/LICENSE.txt +21 -0
- data/Procfile +3 -0
- data/Procfile.dev +2 -0
- data/README.md +185 -0
- data/Rakefile +6 -0
- data/app/assets/builds/.keep +0 -0
- data/app/assets/config/manifest.js +5 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/bg.png +0 -0
- data/app/assets/images/gimage.png +0 -0
- data/app/assets/images/image.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/outerspc.jpg +0 -0
- data/app/assets/images/proxy.jpg +0 -0
- data/app/assets/images/space.jpg +0 -0
- data/app/assets/images/space_four.jpg +0 -0
- data/app/assets/images/space_t.jpg +0 -0
- data/app/assets/images/space_th.jpg +0 -0
- data/app/assets/images/space_two.jpg +0 -0
- data/app/assets/images/th.jpg +0 -0
- data/app/assets/stylesheets/application.css +344 -0
- data/app/assets/stylesheets/application.tailwind.css +13 -0
- data/app/assets/stylesheets/home.css +0 -0
- data/app/channels/application_cable/channel.rb +6 -0
- data/app/channels/application_cable/connection.rb +6 -0
- data/app/controllers/api/v1/block_confirmations_controller.rb +65 -0
- data/app/controllers/application_controller.rb +72 -0
- data/app/controllers/blocks_controller.rb +20 -0
- data/app/controllers/chains_controller.rb +72 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/contracts_controller.rb +25 -0
- data/app/controllers/pools_controller.rb +73 -0
- data/app/controllers/signatures_controller.rb +25 -0
- data/app/controllers/tickets_controller.rb +76 -0
- data/app/controllers/transactions_controller.rb +48 -0
- data/app/controllers/users/confirmations_controller.rb +30 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +30 -0
- data/app/controllers/users/passwords_controller.rb +34 -0
- data/app/controllers/users/registrations_controller.rb +61 -0
- data/app/controllers/users/sessions_controller.rb +27 -0
- data/app/controllers/users/unlocks_controller.rb +30 -0
- data/app/controllers/wallets_controller.rb +18 -0
- data/app/helpers/application_helper.rb +4 -0
- data/app/helpers/blocks_helper.rb +4 -0
- data/app/helpers/chains_helper.rb +4 -0
- data/app/helpers/contracts_helper.rb +4 -0
- data/app/helpers/pools_helper.rb +4 -0
- data/app/helpers/signatures_helper.rb +4 -0
- data/app/helpers/tickets_helper.rb +4 -0
- data/app/helpers/transactions_helper.rb +4 -0
- data/app/helpers/wallets_helper.rb +4 -0
- data/app/javascript/application.js +3 -0
- data/app/javascript/controllers/application.js +9 -0
- data/app/javascript/controllers/hello_controller.js +7 -0
- data/app/javascript/controllers/index.js +11 -0
- data/app/jobs/application_job.rb +9 -0
- data/app/mailers/application_mailer.rb +6 -0
- data/app/models/acceptable_number_sequence.rb +4 -0
- data/app/models/acceptable_symbol_sequence.rb +4 -0
- data/app/models/acceptable_word.rb +4 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/block.rb +17 -0
- data/app/models/chain.rb +10 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/concerns/sequences_validator.rb +30 -0
- data/app/models/concerns/wallet_exists_validator.rb +13 -0
- data/app/models/contract.rb +7 -0
- data/app/models/pool.rb +5 -0
- data/app/models/signature.rb +12 -0
- data/app/models/ticket.rb +11 -0
- data/app/models/transaction.rb +25 -0
- data/app/models/user.rb +44 -0
- data/app/models/wallet.rb +33 -0
- data/app/services/application_service.rb +23 -0
- data/app/services/assign_contracts_service.rb +162 -0
- data/app/services/create_ticket_service.rb +87 -0
- data/app/services/create_wallet_service.rb +20 -0
- data/app/services/transaction_to_block_service.rb +62 -0
- data/app/views/application/_featured_board.html.erb +77 -0
- data/app/views/application/home.html.slim +1 -0
- data/app/views/application/mining_profile.html.slim +59 -0
- data/app/views/application/privacy_policy.html.erb +0 -0
- data/app/views/application/terms.html.erb +0 -0
- data/app/views/blocks/_block.html.slim +13 -0
- data/app/views/blocks/_block.json.jbuilder +4 -0
- data/app/views/blocks/_form.html.slim +26 -0
- data/app/views/blocks/edit.html.slim +10 -0
- data/app/views/blocks/index.html.slim +12 -0
- data/app/views/blocks/index.json.jbuilder +3 -0
- data/app/views/blocks/new.html.slim +8 -0
- data/app/views/blocks/show.html.slim +8 -0
- data/app/views/blocks/show.json.jbuilder +3 -0
- data/app/views/chains/_chain.html.slim +16 -0
- data/app/views/chains/_chain.json.jbuilder +4 -0
- data/app/views/chains/_form.html.slim +30 -0
- data/app/views/chains/edit.html.slim +10 -0
- data/app/views/chains/index.html.slim +11 -0
- data/app/views/chains/index.json.jbuilder +3 -0
- data/app/views/chains/new.html.slim +8 -0
- data/app/views/chains/show.html.slim +10 -0
- data/app/views/chains/show.json.jbuilder +3 -0
- data/app/views/contracts/_contract.html.slim +8 -0
- data/app/views/contracts/_contract.json.jbuilder +4 -0
- data/app/views/contracts/_form.html.slim +34 -0
- data/app/views/contracts/edit.html.slim +10 -0
- data/app/views/contracts/index.html.slim +12 -0
- data/app/views/contracts/index.json.jbuilder +3 -0
- data/app/views/contracts/new.html.slim +8 -0
- data/app/views/contracts/show.html.slim +8 -0
- data/app/views/contracts/show.json.jbuilder +3 -0
- data/app/views/layouts/_alert.html.slim +6 -0
- data/app/views/layouts/_navbar.html.slim +27 -0
- data/app/views/layouts/_notice.html.slim +6 -0
- data/app/views/layouts/application.html.erb +32 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/pools/_form.html.slim +30 -0
- data/app/views/pools/_pool.html.slim +16 -0
- data/app/views/pools/_pool.json.jbuilder +4 -0
- data/app/views/pools/edit.html.slim +10 -0
- data/app/views/pools/index.html.slim +12 -0
- data/app/views/pools/index.json.jbuilder +3 -0
- data/app/views/pools/new.html.slim +8 -0
- data/app/views/pools/show.html.slim +8 -0
- data/app/views/pools/show.json.jbuilder +3 -0
- data/app/views/signatures/_form.html.slim +46 -0
- data/app/views/signatures/_signature.html.slim +28 -0
- data/app/views/signatures/_signature.json.jbuilder +4 -0
- data/app/views/signatures/edit.html.slim +10 -0
- data/app/views/signatures/index.html.slim +10 -0
- data/app/views/signatures/index.json.jbuilder +3 -0
- data/app/views/signatures/new.html.slim +8 -0
- data/app/views/signatures/show.html.slim +10 -0
- data/app/views/signatures/show.json.jbuilder +3 -0
- data/app/views/tickets/_form.html.slim +26 -0
- data/app/views/tickets/_ticket.html.slim +10 -0
- data/app/views/tickets/_ticket.json.jbuilder +4 -0
- data/app/views/tickets/edit.html.slim +10 -0
- data/app/views/tickets/index.html.slim +16 -0
- data/app/views/tickets/index.json.jbuilder +3 -0
- data/app/views/tickets/new.html.slim +10 -0
- data/app/views/tickets/show.html.slim +8 -0
- data/app/views/tickets/show.json.jbuilder +3 -0
- data/app/views/transactions/_form.html.slim +16 -0
- data/app/views/transactions/_transaction.html.slim +24 -0
- data/app/views/transactions/_transaction.json.jbuilder +4 -0
- data/app/views/transactions/edit.html.slim +10 -0
- data/app/views/transactions/index.html.slim +19 -0
- data/app/views/transactions/index.json.jbuilder +3 -0
- data/app/views/transactions/new.html.slim +9 -0
- data/app/views/transactions/show.html.slim +8 -0
- data/app/views/transactions/show.json.jbuilder +3 -0
- data/app/views/users/confirmations/new.html.erb +16 -0
- data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/users/mailer/email_changed.html.erb +7 -0
- data/app/views/users/mailer/password_change.html.erb +3 -0
- data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/users/passwords/edit.html.erb +25 -0
- data/app/views/users/passwords/new.html.erb +16 -0
- data/app/views/users/registrations/edit.html.erb +43 -0
- data/app/views/users/registrations/new.html.erb +37 -0
- data/app/views/users/sessions/new.html.erb +30 -0
- data/app/views/users/shared/_error_messages.html.erb +15 -0
- data/app/views/users/shared/_links.html.erb +25 -0
- data/app/views/users/unlocks/new.html.erb +16 -0
- data/app/views/wallets/_form.html.slim +30 -0
- data/app/views/wallets/_wallet.html.slim +13 -0
- data/app/views/wallets/_wallet.json.jbuilder +4 -0
- data/app/views/wallets/edit.html.slim +10 -0
- data/app/views/wallets/index.html.slim +18 -0
- data/app/views/wallets/index.json.jbuilder +3 -0
- data/app/views/wallets/new.html.slim +8 -0
- data/app/views/wallets/show.html.slim +11 -0
- data/app/views/wallets/show.json.jbuilder +3 -0
- data/app/workers/application_worker.rb +82 -0
- data/app/workers/assign_contract_worker.rb +27 -0
- data/app/workers/create_ticket_worker.rb +23 -0
- data/app/workers/create_wallet_worker.rb +21 -0
- data/app/workers/transaction_to_block_worker.rb +48 -0
- data/bin/bundle +114 -0
- data/bin/console +15 -0
- data/bin/dev +9 -0
- data/bin/importmap +5 -0
- data/bin/osbc +77 -0
- data/bin/rails +6 -0
- data/bin/rake +6 -0
- data/bin/setup +35 -0
- data/config/application.rb +25 -0
- data/config/boot.rb +6 -0
- data/config/cable.yml +10 -0
- data/config/credentials.yml.enc +1 -0
- data/config/database.yml +21 -0
- data/config/environment.rb +7 -0
- data/config/environments/development.rb +73 -0
- data/config/environments/production.rb +95 -0
- data/config/environments/test.rb +62 -0
- data/config/importmap.rb +9 -0
- data/config/initializers/assets.rb +14 -0
- data/config/initializers/content_security_policy.rb +26 -0
- data/config/initializers/devise.rb +311 -0
- data/config/initializers/filter_parameter_logging.rb +10 -0
- data/config/initializers/inflections.rb +17 -0
- data/config/initializers/permissions_policy.rb +12 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/en.yml +33 -0
- data/config/puma.rb +45 -0
- data/config/routes/api.rb +9 -0
- data/config/routes.rb +30 -0
- data/config/sidekiq.yml +10 -0
- data/config/storage.yml +34 -0
- data/config/tailwind.config.js +23 -0
- data/config.ru +8 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +1853 -0
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/0.12.3/colorbox/border.png +0 -0
- data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
- data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
- data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.12.3/favicon_green.png +0 -0
- data/coverage/assets/0.12.3/favicon_red.png +0 -0
- data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.12.3/loading.gif +0 -0
- data/coverage/assets/0.12.3/magnify.png +0 -0
- data/coverage/index.html +20731 -0
- data/db/migrate/20221018053949_devise_create_users.rb +45 -0
- data/db/migrate/20221019002956_create_chains.rb +13 -0
- data/db/migrate/20221020112137_create_blocks.rb +12 -0
- data/db/migrate/20221020123102_add_chain_to_blocks.rb +5 -0
- data/db/migrate/20221020150504_create_wallets.rb +13 -0
- data/db/migrate/20221022221059_create_transactions.rb +20 -0
- data/db/migrate/20221023011005_add_block_to_transactions.rb +5 -0
- data/db/migrate/20221023014707_create_contracts.rb +11 -0
- data/db/migrate/20221023040749_create_pools.rb +13 -0
- data/db/migrate/20221023041015_create_tickets.rb +11 -0
- data/db/migrate/20221023103509_add_contracts_count_to_block.rb +6 -0
- data/db/migrate/20221023110613_add_acceptable_word_list_to_users.rb +7 -0
- data/db/migrate/20221023113539_create_signatures.rb +19 -0
- data/db/migrate/20221023113750_create_acceptable_words.rb +9 -0
- data/db/migrate/20221023114152_create_acceptable_number_sequences.rb +9 -0
- data/db/migrate/20221023114203_create_acceptable_symbol_sequences.rb +9 -0
- data/db/migrate/20221023114324_add_user_acceptable_hash_to_tickets.rb +7 -0
- data/db/migrate/20221023114408_add_time_ref_to_tickets.rb +5 -0
- data/db/migrate/20221024125047_add_master_hash_to_blocks.rb +5 -0
- data/db/migrate/20221109161845_add_transactions_count_to_blocks.rb +5 -0
- data/db/migrate/20221117135003_add_balance_to_chains.rb +5 -0
- data/db/migrate/20221117203417_add_transaction_id_list_to_tickets.rb +5 -0
- data/db/migrate/20221118080357_add_api_keys_to_users.rb +6 -0
- data/db/schema.rb +179 -0
- data/db/seeds.rb +134 -0
- data/docker-compose.yml +53 -0
- data/entrypoint.sh +8 -0
- data/lib/assets/.keep +0 -0
- data/lib/osbc/osbc.rb +9 -0
- data/lib/outerspace/blockchain/version.rb +7 -0
- data/lib/outerspace/blockchain.rb +10 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/compose.rake +92 -0
- data/lib/tasks/compose_db.rake +71 -0
- data/lib/tasks/compose_logs.rake +95 -0
- data/lib/tasks/compose_test.rake +62 -0
- data/log/.keep +0 -0
- data/mining_concept.ipynb +284 -0
- data/outerspace-blockchain.gemspec +50 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/apple-touch-icon-precomposed.png +0 -0
- data/public/apple-touch-icon.png +0 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +1 -0
- data/storage/.keep +0 -0
- data/tmp/.keep +0 -0
- data/tmp/pids/.keep +0 -0
- data/tmp/storage/.keep +0 -0
- data/vendor/.keep +0 -0
- data/vendor/javascript/.keep +0 -0
- metadata +643 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
= form_with(model: @transaction) do |form|
|
2
|
+
- if @transaction.errors.any?
|
3
|
+
div style="color: red"
|
4
|
+
h2 = "#{pluralize(@transaction.errors.count, "error")} prohibited this transaction from being saved:"
|
5
|
+
ul
|
6
|
+
- @transaction.errors.each do |error|
|
7
|
+
li = error.full_message
|
8
|
+
div.text-black
|
9
|
+
= form.label :receiver_key, style: "display: block", class: "text-white"
|
10
|
+
= form.text_field :receiver_key, class: "form-control"
|
11
|
+
div.text-black
|
12
|
+
= form.label :amount, style: "display: block", class: "text-white"
|
13
|
+
= form.number_field :amount, step: 0.01, min: 0, class: "form-control"
|
14
|
+
|
15
|
+
div[style="margin-top: 20px;"]
|
16
|
+
= form.submit class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
div id="#{dom_id transaction}"
|
2
|
+
p
|
3
|
+
strong Sended by:
|
4
|
+
=< transaction.sender
|
5
|
+
p
|
6
|
+
strong Receiver By:
|
7
|
+
=< transaction.receiver
|
8
|
+
/ only show the information below if the Show page is being rendered
|
9
|
+
- if action_name == "show"
|
10
|
+
p
|
11
|
+
strong Amount:
|
12
|
+
=< transaction.amount
|
13
|
+
p
|
14
|
+
strong Status:
|
15
|
+
=< transaction.status
|
16
|
+
p
|
17
|
+
strong Block:
|
18
|
+
=< transaction.block.id
|
19
|
+
p
|
20
|
+
strong Created at:
|
21
|
+
=< transaction.created_at
|
22
|
+
p
|
23
|
+
strong Updated at:
|
24
|
+
=< transaction.updated_at
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.text-white.text-center
|
2
|
+
|
3
|
+
|
4
|
+
h1 Transactions
|
5
|
+
|
6
|
+
#transactions
|
7
|
+
- @transactions.each do |transaction|
|
8
|
+
== render transaction
|
9
|
+
br
|
10
|
+
p
|
11
|
+
= link_to "Show this transaction", transaction, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
12
|
+
br
|
13
|
+
br
|
14
|
+
= link_to "New transaction", new_transaction_path, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
15
|
+
br
|
16
|
+
br
|
17
|
+
= link_to "Back to home", root_path, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
18
|
+
br
|
19
|
+
br
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Resend confirmation instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "users/shared/links" %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @email %>!</p>
|
2
|
+
|
3
|
+
<% if @resource.try(:unconfirmed_email?) %>
|
4
|
+
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
5
|
+
<% else %>
|
6
|
+
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
7
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label :password, "New password" %><br />
|
9
|
+
<% if @minimum_password_length %>
|
10
|
+
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
11
|
+
<% end %>
|
12
|
+
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
17
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="actions">
|
21
|
+
<%= f.submit "Change my password" %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render "users/shared/links" %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Forgot your password?</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Send me reset password instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "users/shared/links" %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
12
|
+
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
17
|
+
<%= f.password_field :password, autocomplete: "new-password" %>
|
18
|
+
<% if @minimum_password_length %>
|
19
|
+
<br />
|
20
|
+
<em><%= @minimum_password_length %> characters minimum</em>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :password_confirmation %><br />
|
26
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="field">
|
30
|
+
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
31
|
+
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit "Update" %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<h3>Cancel my account</h3>
|
40
|
+
|
41
|
+
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
42
|
+
|
43
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div class="text-white text-center"
|
2
|
+
<h2>Sign up</h2>
|
3
|
+
|
4
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
5
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
6
|
+
<div class="field text-black">
|
7
|
+
<%= f.label :username, class: "text-white" %><br />
|
8
|
+
<em class="text-white">(10 characters minimum)</em>
|
9
|
+
<%= f.text_field :username, autofocus: true, autocomplete: "username",class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="field text-black">
|
13
|
+
<%= f.label :email, class: "text-white" %><br />
|
14
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="field text-black">
|
18
|
+
<%= f.label :password, class: "text-white" %><br />
|
19
|
+
<% if @minimum_password_length %>
|
20
|
+
<em class="text-white">(<%= @minimum_password_length %> characters minimum)</em>
|
21
|
+
<% end %><br />
|
22
|
+
<%= f.password_field :password, autocomplete: "new-password", class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="field text-black">
|
26
|
+
<%= f.label :password_confirmation, class: "text-white" %><br />
|
27
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
28
|
+
</div>
|
29
|
+
<br/>
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit "Sign up", class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
<br/>
|
35
|
+
<%= render "users/shared/links" %>
|
36
|
+
<br/>
|
37
|
+
</div>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<div class="text-white text-center">
|
2
|
+
|
3
|
+
<h2>Log in</h2>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="field">
|
12
|
+
<%= f.label :password %><br />
|
13
|
+
<%= f.password_field :password, autocomplete: "current-password" , class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900"%>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<% if devise_mapping.rememberable? %>
|
17
|
+
<div class="field">
|
18
|
+
<%= f.check_box :remember_me %>
|
19
|
+
<%= f.label :remember_me %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<br/>
|
23
|
+
<div class="actions">
|
24
|
+
<%= f.submit "Log in", class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %>
|
25
|
+
</div>
|
26
|
+
<br/>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<%= render "users/shared/links" %>
|
30
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if resource.errors.any? %>
|
2
|
+
<div>
|
3
|
+
<h2>
|
4
|
+
<%= I18n.t("errors.messages.not_saved",
|
5
|
+
count: resource.errors.count,
|
6
|
+
resource: resource.class.model_name.human.downcase)
|
7
|
+
%>
|
8
|
+
</h2>
|
9
|
+
<ul>
|
10
|
+
<% resource.errors.full_messages.each do |message| %>
|
11
|
+
<li><%= message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Log in", new_session_path(resource_name), class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %><br/><br/>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name), class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %><br/><br/>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name), class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %><br/><br/>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white" %><br/><br/>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br/><br/>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br/><br/>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= render "users/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Resend unlock instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "users/shared/links" %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
= form_with(model: @wallet) do |form|
|
2
|
+
- if @wallet.errors.any?
|
3
|
+
div style="color: red"
|
4
|
+
h2 = "#{pluralize(@wallet.errors.count, "error")} prohibited this wallet from being saved:"
|
5
|
+
ul
|
6
|
+
- @wallet.errors.each do |error|
|
7
|
+
li = error.full_message
|
8
|
+
|
9
|
+
div
|
10
|
+
= form.label :user_id, style: "display: block"
|
11
|
+
= form.text_field :user_id
|
12
|
+
|
13
|
+
div
|
14
|
+
= form.label :pr_key, style: "display: block"
|
15
|
+
= form.text_field :pr_key
|
16
|
+
|
17
|
+
div
|
18
|
+
= form.label :pv_key, style: "display: block"
|
19
|
+
= form.text_field :pv_key
|
20
|
+
|
21
|
+
div
|
22
|
+
= form.label :balance, style: "display: block"
|
23
|
+
= form.text_field :balance
|
24
|
+
|
25
|
+
div
|
26
|
+
= form.label :status, style: "display: block"
|
27
|
+
= form.number_field :status
|
28
|
+
|
29
|
+
div
|
30
|
+
= form.submit
|
@@ -0,0 +1,18 @@
|
|
1
|
+
.text-white.text-center
|
2
|
+
|
3
|
+
|
4
|
+
h1 Wallets
|
5
|
+
|
6
|
+
#wallets
|
7
|
+
- if @wallets.user == current_user
|
8
|
+
== render @wallets
|
9
|
+
br
|
10
|
+
p
|
11
|
+
= link_to "Show this wallet", @wallets, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
12
|
+
br
|
13
|
+
|
14
|
+
/ = link_to "New wallet", new_wallet_path
|
15
|
+
br
|
16
|
+
= link_to "Back to home", root_path, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
17
|
+
br
|
18
|
+
br
|
@@ -0,0 +1,11 @@
|
|
1
|
+
.text-white.text-center
|
2
|
+
|
3
|
+
|
4
|
+
.row
|
5
|
+
.col-md-6.offset-md-3.col-sm-12
|
6
|
+
== render @wallet
|
7
|
+
br
|
8
|
+
div
|
9
|
+
= link_to "Back to wallets", wallets_path, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
|
10
|
+
br
|
11
|
+
/ = button_to "Destroy this wallet", @wallet, method: :delete
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ApplicationWorker
|
4
|
+
include Sidekiq::Worker
|
5
|
+
include ActiveSupport::Rescuable
|
6
|
+
|
7
|
+
class UserNotFoundError < StandardError
|
8
|
+
def initialize(message = "User not found")
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class WalletNotFoundError < StandardError
|
14
|
+
def initialize(message = "Wallet not found")
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class AmountNotEnoughError < StandardError
|
20
|
+
def initialize(message = "Wallet balance is not enough")
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class BlockNotFoundError < StandardError
|
26
|
+
def initialize(message = "Block not found")
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class PoolNotFoundError < StandardError
|
32
|
+
def initialize(message = "Pool not found")
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
ERRORS = [UserNotFoundError, WalletNotFoundError, AmountNotEnoughError, BlockNotFoundError].freeze
|
38
|
+
|
39
|
+
ERRORS.each do |error|
|
40
|
+
rescue_from error do |e|
|
41
|
+
dev_error(e)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def perform
|
46
|
+
raise NotImplementedError
|
47
|
+
end
|
48
|
+
|
49
|
+
def success?
|
50
|
+
@success ||= false
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def dev_error(e)
|
55
|
+
if env_acceptable?
|
56
|
+
puts "#{e.class}: #{e.message}"
|
57
|
+
puts e.backtrace
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def user_exists?
|
62
|
+
User.find_by(id: user_id).present?
|
63
|
+
end
|
64
|
+
|
65
|
+
def pool_exists?
|
66
|
+
Pool.find_by(id: pool_id).present?
|
67
|
+
end
|
68
|
+
|
69
|
+
def block_exists?
|
70
|
+
Block.find_by(id: block_id).present?
|
71
|
+
rescue NameError
|
72
|
+
false
|
73
|
+
end
|
74
|
+
|
75
|
+
def wallet_exists?(method, key)
|
76
|
+
Wallet.find_by(method => key).present?
|
77
|
+
end
|
78
|
+
|
79
|
+
def env_acceptable?
|
80
|
+
Rails.env.development? || Rails.env.test?
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AssignContractWorker < ApplicationWorker
|
4
|
+
def perform(ticket_id)
|
5
|
+
@ticket_id = ticket_id
|
6
|
+
assign_contract
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
attr_reader :ticket_id
|
11
|
+
|
12
|
+
def ticket
|
13
|
+
@ticket ||= Ticket.find_by(id: ticket_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def transactions
|
17
|
+
@transactions ||= Transaction.where(id: ticket.transaction_id_list)
|
18
|
+
end
|
19
|
+
|
20
|
+
def contracts
|
21
|
+
@contracts ||= Contract.where(transaction_id: transactions.pluck(:id))
|
22
|
+
end
|
23
|
+
|
24
|
+
def assign_contract
|
25
|
+
AssignContractsService.new(contracts.pluck(:id), ticket_id).call
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateTicketWorker < ApplicationWorker
|
4
|
+
sidekiq_options retry: false
|
5
|
+
|
6
|
+
def perform(user_id, pool_id, time_ref)
|
7
|
+
@user_id = user_id
|
8
|
+
@pool_id = pool_id
|
9
|
+
@time_ref = time_ref
|
10
|
+
raise UserNotFoundError unless user_exists?
|
11
|
+
raise PoolNotFoundError unless pool_exists?
|
12
|
+
if create_ticket
|
13
|
+
@success = true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
attr_reader :user_id, :pool_id, :time_ref
|
19
|
+
|
20
|
+
def create_ticket
|
21
|
+
CreateTicketService.new(user_id, pool_id, time_ref).call
|
22
|
+
end
|
23
|
+
end
|