remove currency model and all references

This commit is contained in:
João Geonizeli
2021-08-28 01:29:07 -03:00
parent 31078f87ae
commit 0d10e86526
74 changed files with 665 additions and 1561 deletions

View File

@@ -6,18 +6,15 @@ module Mutations
argument :order, Inputs::CreateStakeOrderAttributesInput, required: true
def resolve(order:)
currency_id = Currency.find_by!(name: "CAKE").id
amount = BigDecimal(order[:amount])
ActiveRecord::Base.transaction do
current_user
.balances
.find_by!(currency_id: currency_id)
.balance
.withdrawal!(amount)
record = StakeOrder.create!(
amount: amount,
currency_id: currency_id,
pool_name: order[:pool_name],
user_id: current_user.id,
)