Browse Source

Update missing LoadAmount to DepositAmount

Related to 445f26ec9f
feature/sql-semaphore1
arnaucube 3 years ago
parent
commit
9d0b278d50
6 changed files with 9 additions and 9 deletions
  1. +3
    -3
      api/swagger.yml
  2. +2
    -2
      api/txshistory_test.go
  3. +1
    -1
      common/ethrollup.go
  4. +1
    -1
      db/historydb/historydb_test.go
  5. +1
    -1
      db/historydb/views.go
  6. +1
    -1
      db/migrations/0001.sql

+ 3
- 3
api/swagger.yml

@ -1768,7 +1768,7 @@ components:
example: true
historicDepositAmountUSD:
type: number
description: Load amount in USD, at the moment the transaction was made.
description: Deposit amount in USD, at the moment the transaction was made.
example: 3.897
nullable: true
ethereumBlockNum:
@ -2974,7 +2974,7 @@ components:
example: 1
limitDepositAmount:
type: integer
description: Maximum load amount (L1 to L2) allowed.
description: Maximum deposit amount (L1 to L2) allowed.
example: 321
limitL2TransferAmount:
type: integer
@ -3116,4 +3116,4 @@ components:
allOf:
- $ref: '#/components/schemas/Error'
- example:
message: Database error.
message: Database error.

+ 2
- 2
api/txshistory_test.go

@ -166,9 +166,9 @@ func genTestTxs(
}
laf := new(big.Float).SetInt(l1.DepositAmount)
depositAmountFloat, _ := laf.Float64()
loadUSD := *token.USD * depositAmountFloat / math.Pow(10, float64(token.Decimals))
depositUSD := *token.USD * depositAmountFloat / math.Pow(10, float64(token.Decimals))
if depositAmountFloat != 0 {
tx.L1Info.HistoricDepositAmountUSD = &loadUSD
tx.L1Info.HistoricDepositAmountUSD = &depositUSD
}
}
txs = append(txs, tx)

+ 1
- 1
common/ethrollup.go

@ -87,7 +87,7 @@ const (
)
var (
// RollupConstLimitDepositAmount Max load amount allowed (depositAmount: L1 --> L2)
// RollupConstLimitDepositAmount Max deposit amount allowed (depositAmount: L1 --> L2)
RollupConstLimitDepositAmount, _ = new(big.Int).SetString("340282366920938463463374607431768211456", 10)
// RollupConstLimitL2TransferAmount Max amount allowed (amount L2 --> L2)
RollupConstLimitL2TransferAmount, _ = new(big.Int).SetString("6277101735386680763835789423207666416102355444464034512896", 10)

+ 1
- 1
db/historydb/historydb_test.go

@ -516,7 +516,7 @@ func TestTxs(t *testing.T) {
assert.Equal(t, true, dbL1Txs[8].UserOrigin)
assert.Equal(t, true, dbL1Txs[9].UserOrigin)
// Load Amount
// Deposit Amount
assert.Equal(t, big.NewInt(10), dbL1Txs[0].DepositAmount)
assert.Equal(t, big.NewInt(10), dbL1Txs[1].DepositAmount)
assert.Equal(t, big.NewInt(20), dbL1Txs[2].DepositAmount)

+ 1
- 1
db/historydb/views.go

@ -120,7 +120,7 @@ func (tx TxAPI) MarshalJSON() ([]byte, error) {
// txWrite is an representatiion that merges common.L1Tx and common.L2Tx
// in order to perform inserts into tx table
// EffectiveAmount and LoadEffectiveAmount are not set since they have default values in the DB
// EffectiveAmount and EffectiveDepositAmount are not set since they have default values in the DB
type txWrite struct {
// Generic
IsL1 bool `meddler:"is_l1"`

+ 1
- 1
db/migrations/0001.sql

@ -137,7 +137,7 @@ CREATE SEQUENCE tx_item_id;
-- When tx is not forged: amount_success = false, deposit_amount_success = false
-- When tx is forged:
-- amount_success = false if the "effective amount" is 0, else true
-- deposit_amount_success = false if the "effective load amount" is 0, else true
-- deposit_amount_success = false if the "effective deposit amount" is 0, else true
--
-- However, in order to reduce the amount of updates, by default amount_success and deposit_amount_success will be set to true (when tx is unforged)
-- whne they should be false. This can be worked around at a query level by checking if "batch_num IS NULL" (which indicates that the tx is unforged).

Loading…
Cancel
Save