Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/deposits start #74

Merged
merged 4 commits into from
Aug 30, 2024
Merged

Feat/deposits start #74

merged 4 commits into from
Aug 30, 2024

Conversation

xfiendx4life
Copy link
Collaborator

No description provided.

@@ -472,7 +473,7 @@ func (s *Service) formatAccounts(opts *bind.FilterOpts) ([]*models.Account, erro

for iterator.Next() {
if iterator.Error() != nil {
logger.Log().WithField("layer", "Service-formatAccounts").Errorf("iterator error: %v", err.Error())
logger.Log().WithField("layer", "Service-formatAccounts").Errorf("iterator error: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats requires err.Error()

@@ -498,7 +499,7 @@ func (s *Service) formatAccountsCore(opts *bind.FilterOpts) ([]*models.Account,

for iterator.Next() {
if iterator.Error() != nil {
logger.Log().WithField("layer", "Service-formatAccountsCore").Errorf("iterator error: %v", err.Error())
logger.Log().WithField("layer", "Service-formatAccountsCore").Errorf("iterator error: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was it changed?

if fromBlock == 0 {
fromBlock = s.coreFirstBlock
}

var withdraws []*models.CollateralWithdrawn

logger.Log().WithField("layer", "Service-RetrieveCollateralWithdrawnLimit").Infof(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service-RetrieveCollateralWithdrawn instead of
"Service-RetrieveCollateralWithdrawnLimit

if endBlockOfIteration > toBlock {
endBlockOfIteration = toBlock
}

for i := uint64(1); i <= iterations; i++ {
if i%10 == 0 || i == iterations {
logger.Log().WithField("layer", "Service-RetrieveCollateralWithdrawnLimit").Infof("-- iteration %v", i)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

if fromBlock == 0 {
fromBlock = s.coreFirstBlock
}

var deposits []*models.CollateralDeposited

logger.Log().WithField("layer", "Service-RetrieveCollateralDepositedLimit").Infof(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service-RetrieveCollateralDepositedLimit here is incorrect

if endBlockOfIteration > toBlock {
endBlockOfIteration = toBlock
}

for i := uint64(1); i <= iterations; i++ {
if i%10 == 0 || i == iterations {
logger.Log().WithField("layer", "Service-RetrieveCollateralDepositedLimit").Infof("-- iteration %v", i)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service-RetrieveCollateralDepositedLimit here is incorrect

if endBlockOfIteration > toBlock {
endBlockOfIteration = toBlock
}

for i := uint64(1); i <= iterations; i++ {
if i%10 == 0 || i == iterations {
logger.Log().WithField("layer", "Service-RetrieveUSDMintedLimit").Infof("-- iteration %v", i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service-RetrieveUSDMintedLimit incorrect

@@ -27,16 +30,25 @@ func (s *Service) RetrieveUSDMintedLimit(limit uint64) ([]*models.USDMinted, err

logger.Log().WithField("layer", "Service-RetrieveUSDMintedLimit").Infof(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service-RetrieveUSDMintedLimit incorrect

}

func (s *Service) RetrieveCollateralWithdrawn(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralWithdrawn, error) {
iterations, lastBlock, err := s.getIterationsForLimitQueryCore(limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be s.getIterationsForQuery, instead of s.getIterationsForLimitQueryCore

Because s.getIterationsForLimitQueryCore gives iterations in range from core contract's first block to RPC's last block

}

func (s *Service) RetrieveCollateralDeposited(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralDeposited, error) {
iterations, lastBlock, err := s.getIterationsForLimitQueryCore(limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

return s.RetrieveUSDMinted(0, 0, limit)
}
func (s *Service) RetrieveUSDMinted(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDMinted, error) {
iterations, lastBlock, err := s.getIterationsForLimitQueryCore(limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

}

func (s *Service) RetrieveUSDBurned(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDBurned, error) {
iterations, lastBlock, err := s.getIterationsForLimitQueryCore(limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@dmitriyselivanov
Copy link
Contributor

We should also add new functions (such as RetrieveCollateralWithdrawn, RetrieveCollateralDeposited and etc) to IPerpsv3 interface in perpsv3.go and implementations which calls service level:

func (p *Perpsv3) RetrieveDelegationUpdated(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.DelegationUpdated, error) {
	return p.service.RetrieveDelegationUpdated(fromBlock, toBlock, limit)
}

@xfiendx4life xfiendx4life merged commit a946290 into main Aug 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants