Skip to content

Commit

Permalink
fix: entry and account fields test
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Oct 6, 2023
1 parent 04550ac commit 70ea7ec
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions calc/account_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (c Calculator) CalcAccountFields(ts uint64, blockNum int64,
calTotalValueInUSD = new(big.Int).Add(calTotalValueInUSD, tokenValueInUSD)
}
}

calBorrowWithInterest = new(big.Int).Quo(
new(big.Int).Mul(poolCumIndexNow, account.GetBorrowedAmount()),
account.GetCumulativeIndex())
Expand Down
1 change: 1 addition & 0 deletions calc/account_fields_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type CalcFieldsParams struct {

// for v1
func TestCalcFields(t *testing.T) {
log.SetTestLogging(t)
//
input := CalcFieldsParams{}
utils.ReadJsonAndSetInterface("../inputs/calc_account_fields.json", &input)
Expand Down
2 changes: 1 addition & 1 deletion core/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type TokenBalanceCallData struct {
func ConvertToDBBalanceFormat(dcv2Balances []TokenBalanceCallData) DBBalanceFormat {
m := DBBalanceFormat{}
for _, entry := range dcv2Balances {
if !entry.IsEnabled {
if entry.IsEnabled {
m[entry.Token] = entry.DBTokenBalance
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewVersion(v int16) VersionType {
} else if v == 210 || v == 220 {
return VersionType{v: 2}
}
log.Fatal("version not supported")
log.Fatal("version not supported", v)
panic("")
}

Expand Down
4 changes: 2 additions & 2 deletions jsonnet/calc_account_fields.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@
IsEnabled: true,
},
],
UnderlyingToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
Version: 1,
},
UnderlyingToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
BlockNum: 15380052,
Version: 1,
CumIndexOfPool: '1008974004624121395847841465',
Prices: {
'1': {
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/calc_account_fields_v2.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@
Balance: 0,
},
],
UnderlyingToken: '0x595DFFf822767c2E14CFB7D5e0b5a5e23eCfACdd',
Version: 2,
},
UnderlyingToken: '0x595DFFf822767c2E14CFB7D5e0b5a5e23eCfACdd',
BlockNum: 7712345,
Version: 2,
CumIndexOfPool: '1000748182006430558180400186',
Prices: {
'2': {
Expand Down

0 comments on commit 70ea7ec

Please sign in to comment.