remove currency model and all references
This commit is contained in:
@@ -6,8 +6,6 @@ module Mutations
|
||||
argument :order, Inputs::CreateBuyCryptoOrderAttributesInput, required: true
|
||||
|
||||
def resolve(order:)
|
||||
currency_id = decode_id(order[:currency_id])
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
current_user
|
||||
.fiat_balance
|
||||
@@ -15,7 +13,6 @@ module Mutations
|
||||
|
||||
record = BuyCryptoOrder.create!(
|
||||
paid_amount_cents: order[:amount_cents],
|
||||
currency_id: currency_id,
|
||||
user_id: current_user.id,
|
||||
)
|
||||
|
||||
|
||||
@@ -6,18 +6,15 @@ module Mutations
|
||||
argument :order, Inputs::CreateSellCryptoOrderAttributesInput, required: true
|
||||
|
||||
def resolve(order:)
|
||||
currency_id = decode_id(order[:currency_id])
|
||||
amount = BigDecimal(order[:amount])
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
current_user
|
||||
.balances
|
||||
.find_by!(currency_id: currency_id)
|
||||
.balance
|
||||
.withdrawal!(amount)
|
||||
|
||||
record = SellCryptoOrder.create!(
|
||||
paid_amount: amount,
|
||||
currency_id: currency_id,
|
||||
user_id: current_user.id,
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -6,14 +6,12 @@ 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
|
||||
record = StakeOrder.find_or_initialize_by(
|
||||
pool_name: order[:pool_name],
|
||||
user_id: current_user.id,
|
||||
currency_id: currency_id,
|
||||
status: :processing
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user