Skip to content

Commit

Permalink
feat:use quotaIndexLU in tokenBalance and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Nov 23, 2023
1 parent 5de0a09 commit 788ffeb
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Gearbox-protocol/third-eye
go 1.19

require (
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012015859-f522b767956c
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012144203-6d22b349a33e
github.com/ethereum/go-ethereum v1.10.17
github.com/go-playground/validator/v10 v10.4.1
github.com/google/go-cmp v0.5.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012015859-f522b767956c h1:RHfXxbFBkb9ZN6mQtxF8EiRx7W/LNVGTosJtk/KUZOg=
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012015859-f522b767956c/go.mod h1:GniLx/DU7tCT+QSlKt9REqUaF748X8rbDNR4vAd1m+Y=
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012144203-6d22b349a33e h1:0pNnq4He1S3/J3cWNtAo/F6FMOmBTWHPhNk37Ptm+BM=
github.com/Gearbox-protocol/sdk-go v0.0.0-20231012144203-6d22b349a33e/go.mod h1:GniLx/DU7tCT+QSlKt9REqUaF748X8rbDNR4vAd1m+Y=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/account_lifecycle/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ local newCollateral = 1;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
accounts: [{
address: '#Account_1',
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/account_lifecycle_v2/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ local newCollateral = 1;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
accounts: [{
address: '#Account_1',
Expand Down Expand Up @@ -311,7 +311,7 @@ local newCollateral = 1;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/close_credit_account/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ local newCollateral = 1;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/close_credit_account_v2/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ local extraBorrowedAmount = 1000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/dao_operations/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ local borrowedAmount = 4000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/liquidate_credit_account/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ local extraBorrowedAmount = 1000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/multiple_facade_interaction_single_tx/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ local moreCollateral = 1000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
accounts: [{
address: '#Account_1',
Expand Down Expand Up @@ -307,7 +307,7 @@ local moreCollateral = 1000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
accounts: [{
address: '#Account_2',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/open_credit_account/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ local borrowedAmount = 4000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
accounts: [{
address: '#Account_1',
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/repay_credit_account/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local extraBorrowedAmount = 1000;
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
cms: [{
address: '#CreditManager_1',
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/sync_adapters/input.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ local utils = import '../utils.libsonnet';
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
},
},
Expand Down Expand Up @@ -281,7 +281,7 @@ local utils = import '../utils.libsonnet';
baseBorrowRate: utils.bigInt(0),
dieselRate: utils.bigInt(0),
withdrawFee: '0',
linearCumulativeIndex: utils.bigInt(1, 27),
cumulativeIndex: utils.bigInt(1, 27),
}],
},
},
Expand Down
3 changes: 1 addition & 2 deletions models/pool/pool_v2/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func (p *Poolv2) createSnapshot(blockNum int64, state dc.PoolCallData) {
// TODO: change borrow apy
p.State.BorrowAPYBI = (*core.BigInt)(state.BaseInterestRate)
p.State.DepositAPYBI = (*core.BigInt)(state.SupplyRate)
// log.Infof("Pool:%s ciRAY: %s and linearCI: %s\n", p.Address, state.CumulativeIndexRAY.String(), state.LinearCumulativeIndex.String())
p.Repo.AddPoolStat(&schemas.PoolStat{
BlockNum: blockNum,
Address: p.Address,
Expand Down Expand Up @@ -102,7 +101,7 @@ func (p *Poolv2) createSnapshot(blockNum int64, state dc.PoolCallData) {
DieselRateBI: (*core.BigInt)(state.DieselRateRAY),
DieselRate: utils.GetFloat64Decimal(state.DieselRateRAY, 27),
WithdrawFee: int(state.WithdrawFee.Convert().Int64()),
CumulativeIndexRAY: (*core.BigInt)(state.LinearCumulativeIndex),
CumulativeIndexRAY: (*core.BigInt)(state.CumulativeIndexRAY),
})
p.dieselRate = state.DieselRateRAY.Convert()
}
3 changes: 1 addition & 2 deletions models/pool/pool_v3/state_snapshot_and_gateway_fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (p *Poolv3) createSnapshot(blockNum int64, state dc.PoolCallData) {
p.State.IsWETH = dc.IsWETH(p.Client, state.Underlying)
p.State.BorrowAPYBI = (*core.BigInt)(state.BaseInterestRate)
p.State.DepositAPYBI = (*core.BigInt)(state.SupplyRate)
// log.Infof("Pool:%s ciRAY: %s and linearCI: %s\n", p.Address, state.CumulativeIndexRAY.String(), state.LinearCumulativeIndex.String())
p.Repo.AddPoolStat(&schemas.PoolStat{
BlockNum: blockNum,
Address: p.Address,
Expand All @@ -93,6 +92,6 @@ func (p *Poolv3) createSnapshot(blockNum int64, state dc.PoolCallData) {
DieselRateBI: (*core.BigInt)(state.DieselRateRAY),
DieselRate: utils.GetFloat64Decimal(state.DieselRateRAY, 27),
WithdrawFee: int(state.WithdrawFee.Convert().Int64()),
CumulativeIndexRAY: (*core.BigInt)(state.LinearCumulativeIndex),
CumulativeIndexRAY: (*core.BigInt)(state.CumulativeIndexRAY),
})
}

0 comments on commit 788ffeb

Please sign in to comment.