-
Notifications
You must be signed in to change notification settings - Fork 37
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
chore(jellyfish): add negative interest rate tests #1755
chore(jellyfish): add negative interest rate tests #1755
Conversation
- add flag fortcanninggreatworldheight
Code Climate has analyzed commit 970cfa6 and detected 0 issues on this pull request. View more on Code Climate. |
✅ Deploy Preview for jellyfishsdk ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Docker build preview for jellyfish/apps is ready! Built with commit 26bb487
You can also get an immutable image with the commit hash
|
packages/testcontainers/src/containers/RegTestContainer/index.ts
Outdated
Show resolved
Hide resolved
Codecov ReportBase: 93.51% // Head: 93.06% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1755 +/- ##
==========================================
- Coverage 93.51% 93.06% -0.46%
==========================================
Files 361 361
Lines 10416 10416
Branches 1304 1304
==========================================
- Hits 9741 9694 -47
- Misses 647 693 +46
- Partials 28 29 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Now when I take a loan with const dusdLoanAmount = 5000
const txid = await testing.rpc.loan.takeLoan({
vaultId: bobVaultId,
amounts: `${dusdLoanAmount}@DUSD`
}) And then check the interest rate with const interests = await testing.rpc.loan.getInterest('scheme') The interest is 0 console.log(interests[0].totalInterest.toFixed(8)) // 0.00000000
console.log(interests[0].interestPerBlock.toFixed(8)) // 0.00000000
console.log(interests[0].realizedInterestPerBlock.toFixed(8)) // 0.00000000 |
But if I comment out the setGov function, I get some value for the interest rate await testing.rpc.masternode.setGov({
ATTRIBUTES: {
'v0/token/1/loan_minting_interest': '-5'
}
})
await testing.generate(1) the result is something like console.log(interests[0].totalInterest.toFixed(8)) // 0.00475647
console.log(interests[0].interestPerBlock.toFixed(8)) // 0.00475647
console.log(interests[0].realizedInterestPerBlock.toFixed(8)) // 0.00475647 |
- adding greatworldheight=14 in Container cmds fixed the issue. - first test is half way completed.
2337e29
to
81270f6
Compare
- fix the test "it should takeLoan with negative interest and accrue DUSD"
- unable to payback negative interest loan.
I wonder what I am doing wrong here. // payback loan
const loanPaybackResult = await testing.rpc.loan.paybackLoan({
vaultId: bobVaultId,
amounts: afterLoanAmount, // console.log shows the value is 4995.24353121@DUSD
from: aliceAddr
}) |
I have implemented all the tests. |
// High interest rate so the change will be significant | ||
const interestRate = 5000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm.. 5000
is quite abnormal.. preferably provide a more reality interest rate.. maybe 3.3
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, i wanted to see a significant change with just one block added to the chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted that.. hmm.. the reason why i recommend to provide tricky figure like 3.3
or 5.6433
is to check the precision working
the significant change
can be tested by c.generate(36)
heyy @DieHard073055 |
I’ve a PR that fixes the regression but I haven’t see if it’s all fixed thereRegards,Fuxing LohOn 15 Sep 2022, at 12:29 PM, canonbrother ***@***.***> wrote:
heyy @DieHard073055
that's some failed test.. can you check if that is regression issue??
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because your review was requested.Message ID: ***@***.***>
|
One of the errors is happening in setLoanToken.test.ts Because of the following condition Should I remove this test? @fuxingloh |
Noted that @DieHard073055 |
If they are no longer valid |
@DieHard073055 can you also update the 2 |
- update `updateLoanToken` to allow negative interest - update `setLoanToken` to allow negative interest
What this PR does / why we need it:
Tests the negative interest rate update that was released.
Which issue(s) does this PR fixes?:
Fixes part of #1749
Additional comments?:
I will be pushing smaller changes at a time, while i get reviews on the work.
TODO: