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

fix: stATOM/ATOM rate #733

Merged
merged 3 commits into from
Mar 22, 2024
Merged

fix: stATOM/ATOM rate #733

merged 3 commits into from
Mar 22, 2024

Conversation

Senna46
Copy link
Contributor

@Senna46 Senna46 commented Mar 12, 2024

Fix stATOM/ATOM rate

ex:
stATOM/ATOM = 1.1
1 ATOM = 0.9 stATOM

@Senna46 Senna46 requested a review from jununifi March 12, 2024 11:24
@@ -33,6 +33,9 @@ func (k Keeper) TranchePtAPYs(c context.Context, req *types.QueryTranchePtAPYsRe
return nil, err
}
restMaturity := tranche.StartTime + tranche.Maturity - uint64(ctx.BlockTime().Unix())
if restMaturity < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

restMaturity is uint64 and won't have <0 case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, that's true

@@ -24,6 +24,23 @@ func (k Keeper) EstimateSwapInPool(c context.Context, req *types.QueryEstimateSw
if !ok {
return nil, types.ErrInvalidAmount
}
ptDenom := types.PtDenom(tranche)
if req.Denom == ptDenom {
if tranche.StartTime+tranche.Maturity <= uint64(ctx.BlockTime().Unix()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this case? Can you add some comments on the code?

Copy link
Contributor Author

@Senna46 Senna46 Mar 12, 2024

Choose a reason for hiding this comment

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

I missed the processing at maturity

@Senna46 Senna46 merged commit 884c573 into irs_module Mar 22, 2024
1 of 2 checks passed
@Senna46 Senna46 deleted the reverse-rate branch March 22, 2024 13:00
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.

2 participants