-
Notifications
You must be signed in to change notification settings - Fork 888
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
Onsen Allocator update #278
base: allocators
Are you sure you want to change the base?
Conversation
/// Call the poolLength function from sushi masterchef v2 and compare against the LP token passed as parameter | ||
uint256 poolsLength = IMasterChef(masterChef).poolLength(); | ||
|
||
for (uint256 i; i < poolsLength; i++) { |
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.
Poollength of masterchef is 355 i think unless im looking at wrong contract. i think this can be done offchain. We can figure out the id mappings offchain using view functions on masterchef and insert them in with a setter function. This would work but im worried it will use alot more gas than we need to.
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.
Added the following 2 functions:
function setLPTokenOnsenPoolId(address lpToken, uint256 onsenPoolId) external onlyGuardian
function getLPTokenOnsenPoolId(address lpToken) external view returns (bool, uint256)
So we can add the Onsen Pool Id for the LP Tokens ahead of time and also check if the LP token was already added, worst-case scenario would be that the token is not added and it will go search for it based on the Onsen Pool Length.
@Paul4912 Please let me know if this is fine or if we need to be able to add all Onsen Pool Ids at once?
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 that's how id imagine we'd do it.
Idk how many onsen farms there are to need a batch add.
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.
@PARABRAHMAN0 @ind-igo Do you have any idea about how many Onsen Pools are used? Or do you know where I can check this?
We would like to know if a batch function to add Onsen pools is needed or not?
address _sushi, | ||
address _xSushi, | ||
address _treasury, | ||
AllocatorInitData memory data |
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.
What if we want to add more tokens? Add a setter for more LP tokens, should be easy.
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.
@PARABRAHMAN0 Sorry but not sure about what this means, or maybe is already added based on a previous comment with the following 2 functions?
function setLPTokenOnsenPoolId(address lpToken, uint256 onsenPoolId) external onlyGuardian
function getLPTokenOnsenPoolId(address lpToken) external view returns (bool, uint256)
r u planning on adding tests in this pr or seperate pr |
Yes, I am working on testing and I will create a new PR for it |
Can you just do this in this PR? I mean when you push to your branch it will automatically add it to the PR. Then you can also re-request a review. |
Sure, I thought I needed to add it as new PR, but sure I will push the testing to the branch and re-request review |
Added Onsen allocator based on the latest allocators branch.