satellite/payments/storjscan: change USD currency to USDollarsMicro
Changes all usd amounts to use monetary.USDollarsMicro to have better prescision. Change-Id: I391e2680f7fa11a0493e5af77488acff6dbf4999
This commit is contained in:
parent
38d2d0f2fc
commit
9c77c762cb
@ -1007,7 +1007,7 @@ func TestPaymentsWalletPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet,
|
||||
TokenValue: monetary.AmountFromBaseUnits(1000, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: int64(i),
|
||||
|
@ -89,7 +89,7 @@ func (chore *Chore) Run(ctx context.Context) (err error) {
|
||||
From: payment.From,
|
||||
To: payment.To,
|
||||
TokenValue: monetary.AmountFromBaseUnits(payment.TokenValue.Int64(), monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromDecimal(decimal.NewFromFloat(payment.USDValue), monetary.USDollars),
|
||||
USDValue: monetary.AmountFromDecimal(decimal.NewFromFloat(payment.USDValue), monetary.USDollarsMicro),
|
||||
Status: status,
|
||||
BlockHash: payment.BlockHash,
|
||||
BlockNumber: payment.BlockNumber,
|
||||
|
@ -62,7 +62,7 @@ func TestChore(t *testing.T) {
|
||||
From: payment.From,
|
||||
To: payment.To,
|
||||
TokenValue: monetary.AmountFromBaseUnits(payment.TokenValue.Int64(), monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromDecimal(decimal.NewFromFloat(payment.USDValue), monetary.USDollars),
|
||||
USDValue: monetary.AmountFromDecimal(decimal.NewFromFloat(payment.USDValue), monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusPending,
|
||||
BlockHash: payment.BlockHash,
|
||||
BlockNumber: payment.BlockNumber,
|
||||
|
@ -33,7 +33,7 @@ func TestPaymentsDBInsertBatch(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: monetary.AmountFromBaseUnits(1000, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro),
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: int64(i),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
@ -73,70 +73,70 @@ func TestPaymentsDBList(t *testing.T) {
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: tx1,
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[0].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: tx1,
|
||||
Index: 1,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[0].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 2,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[1].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[1].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet2,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 1,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[2].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet2,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[3].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[4].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusPending),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusPending),
|
||||
blocks[4].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet2,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: tx2,
|
||||
Index: 1,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusPending),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusPending),
|
||||
blocks[4].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet2,
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: tx2,
|
||||
Index: 2,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusPending),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusPending),
|
||||
}
|
||||
|
||||
err := paymentsDB.InsertBatch(ctx, expected)
|
||||
@ -170,7 +170,7 @@ func TestPaymentsDBLastBlock(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: monetary.AmountFromBaseUnits(1000, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: int64(i),
|
||||
@ -183,7 +183,7 @@ func TestPaymentsDBLastBlock(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: monetary.AmountFromBaseUnits(1000, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(1000, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusPending,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: int64(10),
|
||||
@ -236,42 +236,42 @@ func TestPaymentsDBDeletePending(t *testing.T) {
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[1].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[2].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[3].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusConfirmed),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusConfirmed),
|
||||
blocks[4].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusPending),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusPending),
|
||||
blocks[5].NewPayment(paymentLog{
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: blockchaintest.NewAddress(),
|
||||
TokenValue: new(big.Int).SetInt64(testrand.Int63n(1000)),
|
||||
Transaction: blockchaintest.NewHash(),
|
||||
Index: 0,
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollars), payments.PaymentStatusPending),
|
||||
}, monetary.AmountFromBaseUnits(testrand.Int63n(1000), monetary.USDollarsMicro), payments.PaymentStatusPending),
|
||||
}
|
||||
require.NoError(t, paymentsDB.InsertBatch(ctx, payments))
|
||||
|
||||
|
@ -33,7 +33,7 @@ func TestServicePayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -45,7 +45,7 @@ func TestServicePayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -57,7 +57,7 @@ func TestServicePayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet2,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -69,7 +69,7 @@ func TestServicePayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(200, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusPending,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 1,
|
||||
@ -141,7 +141,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -153,7 +153,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -165,7 +165,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 0,
|
||||
@ -177,7 +177,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(200, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 1,
|
||||
@ -224,7 +224,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(100, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 1,
|
||||
@ -236,7 +236,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(200, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 1,
|
||||
@ -248,7 +248,7 @@ func TestListPayments(t *testing.T) {
|
||||
From: blockchaintest.NewAddress(),
|
||||
To: wallet1,
|
||||
TokenValue: monetary.AmountFromBaseUnits(200, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(100, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatusConfirmed,
|
||||
BlockHash: blockchaintest.NewHash(),
|
||||
BlockNumber: 2,
|
||||
|
@ -185,7 +185,7 @@ func (storjscanPayments storjscanPayments) ListConfirmed(ctx context.Context, bl
|
||||
func fromDBXPayment(dbxPmnt *dbx.StorjscanPayment) storjscan.CachedPayment {
|
||||
payment := storjscan.CachedPayment{
|
||||
TokenValue: monetary.AmountFromBaseUnits(dbxPmnt.TokenValue, monetary.StorjToken),
|
||||
USDValue: monetary.AmountFromBaseUnits(dbxPmnt.UsdValue, monetary.USDollars),
|
||||
USDValue: monetary.AmountFromBaseUnits(dbxPmnt.UsdValue, monetary.USDollarsMicro),
|
||||
Status: payments.PaymentStatus(dbxPmnt.Status),
|
||||
BlockNumber: dbxPmnt.BlockNumber,
|
||||
LogIndex: dbxPmnt.LogIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user