-
Notifications
You must be signed in to change notification settings - Fork 0
Oracle-based fee charging #91
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
Conversation
80f2aaa to
48fc56b
Compare
279e738 to
b48b4bb
Compare
9257e3f to
99a523a
Compare
99a523a to
6b444fe
Compare
|
@IaroslavMazur before I proceed with a full review, I have a quick question why is the |
Because at this point, we don't have a way of modifying it (by an admin) after the program deployment. This will be implemented in #171. |
|
hmm, why not implement it from the beginning and do it as a 2-step process? 😆 |
Fee changing wasn't a part of our product offering for v1, as far as I remember. |
what's v1? we initially used a constant (for the lamports amount) due to not having chainlink available - but now, we should have the USD fee editable now nvm, we'll implement it later then |
The first official release of SolSab.
This subject was raised during the EthCC All-Hands - and, as far as I remember, the consensus was that it's not a must for V1. I have no issue with implementing it now. In fact, that's what I envisioned for us in the nearest future, as well. I just explained why it was not a part of this PR. |
is it? then, i may have been remembered incorrectly - mb |
andreivladbrg
left a comment
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.
left some comments on the lockup implementation — the same feedback can be applied to merkle_instant
i haven't reviewed the tests yet, as we'll first need to rebase from PRB's PR, which will of course cause conflicts
but there's one thing that caught my attention:
you're using the actual devnet address for the chainlink oracle
these are fork tests, not unit ones - we should declare some mocks that return various values, see this
or maybe chainlink already provides some test utils
For this,
Are you suggesting we do the latter? And do it before the audit? |
asked Claude and it should be doable without having a very complex system |
cc079a1 to
6d9fa01
Compare
|
@andreivladbrg, rebased the PR. Note that we still need to double-check the generic branch of the following let fee_in_lamports: u64 = match oracle_decimals {
8 => {
// If the oracle decimals are 8, calculate the fee.
CLAIM_FEE_USD * LAMPORTS_PER_SOL / price
}
decimals => {
// Otherwise, adjust the calculation to account for the oracle decimals.
CLAIM_FEE_USD * 10_u64.pow(10 + decimals as u32) / price
}
};Also, I'm not sure why CI is failing. Will check it tomorrow. |
andreivladbrg
left a comment
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.
will leave comments sequentially
fixed in ed22eb1 |
|
@IaroslavMazur does the Treasury naming make sense anymore? i believe we can rename it to comptroller (like in EVM) wdyt? |
Now that we have both the "Comptroller" sounds good! |
andreivladbrg
left a comment
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.
@IaroslavMazur left few more comments, i'll address them (already made changes locally)
thanks |
Awesome, thank you! |
|
@IaroslavMazur pushed 2 more commits: 68e12c7 3b2504d if they look good, could you please mark the above comments as resolved? |
IaroslavMazur
left a comment
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.
The changes to the program code look good, in general.
Left some feedback.
programs/merkle_instant/src/instructions/view/claim_fee_in_lamports.rs
Outdated
Show resolved
Hide resolved
andreivladbrg
left a comment
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.
left few comments more
|
@IaroslavMazur I did it 🎉 I finally managed to mock Chainlink! I'd recommend revisiting coverage later with different mock scenarios. Please review: cc02f36 |
IaroslavMazur
left a comment
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.
Very well done! Without the requests to the Solana Devnet & the Chainlink/Hermes oracles, the tests are truly flying now! 👏
Leaving some feedback below, along with a little cleaning in bc64a55.
8e14cbf to
4b5e9e6
Compare
|
@andreivladbrg, squashed the commits from this branch - and rebased them onto |
4b5e9e6 to
3d4b800
Compare
andreivladbrg
left a comment
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.
Let's merge this
test: Oracle-based fee charging docs: mention the amount in USD charged docs: explanatory comment for the constants docs: polish refactor: polish feat: add view function to calculate the withdraw/claim lamports fee refactor: move fee calculation into a separate file test: mock chainlink Co-authored-by: Andrei Vlad <[email protected]>
5daee84 to
38fca92
Compare
|
Rebased the branch again. @andreivladbrg, feel free to merge if it lgty. |
Closes #47. Depends on #174.