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

Adding/setting rarity points after gems have been staked or moved to vault (deposited). #53

Open
torbentemp opened this issue Mar 10, 2022 · 8 comments

Comments

@torbentemp
Copy link

torbentemp commented Mar 10, 2022

TL;DR: when changing the rarity points of a deposited gem a new total rarity points for the vault isn't calculated/updated. Therefore, the staking reward amount/rate isn't updated. Furthermore, it is not possible to withdraw the gem (due to certain checks for security reasons).
Does anyone know of a way to fix or get around this? (Maybe updating/refreshing the Vault struct will fix it?)

Example/issue:
Two gems, each with rarity points of 1, are moved to the vault (and may also be staked) and while they are in the vault the rarity points of one of them are set/updated to 4.
(The same things apply to a scenario with just a single gem that gets rarity points updated while in the vault)

The amount of tokens rewarded from staking remains unchanged after the update, so it seems as if the calculated total rarity points of the vault isn't updated/refreshed.

Furthermore, trying to withdraw the gem with 4 rarity points now fails with the 0x1770 error as the program tries subtracting 4 from 2 (see attached screenshot) - it appears that the calculated total rarity points of the vault is updated somewhere (but not the place that affects staking rewards).

Question:
Is there any way of "refreshing" the total calculated rarity points of a vault after the rarity points of a gem (or several) in the vault has been changed?
(I.e. is it possible to change/update the rarities if the staking of a collection of gems is already live)

withdraw-error

@torbentemp
Copy link
Author

torbentemp commented Mar 10, 2022

From the docs regarding rarities: "Those rarity points are summed up and stored on the Vault struct"
I assume that I need to update the Vault struct? Does anyone know how to do this?
(I´m quite a rust/vue noob)

@torbentemp
Copy link
Author

Or perhaps the Vault struct is in fact updated but the front end is not?

@torbentemp torbentemp changed the title Adding/setting rarity points after gems have been staked or moved to vault. Adding/setting rarity points after gems have been staked or moved to vault (deposited). Mar 10, 2022
@reidelkins
Copy link

@torbentemp Hey seems like I'm going through this same issue. Did you ever find a fix? My current plan (I know not a great idea) is to temporarily remove the check so they can be unstaked and then add that fix back

@0xnetfox
Copy link

I had this issue the other day and in order for the users to be able to unstake again, I changed back the rarity of all of the NFTs to 1

Sucks tho that there's no way for now to update the staked ones

@torbentemp
Copy link
Author

@torbentemp Hey seems like I'm going through this same issue. Did you ever find a fix? My current plan (I know not a great idea) is to temporarily remove the check so they can be unstaked and then add that fix back

Nope.
I ended up starting a separate farm for the new collection of NFTs that I wanted to integrate - not ideal (and costs extra sol) but priority was/is UX for the users.

@torbentemp
Copy link
Author

@nf0x Thank you for your rarity-configuration script/repo! It saved me a lot of time. Much appreciated!

@0xrtm1s
Copy link

0xrtm1s commented Jun 20, 2022

@nf0x @torbentemp can you share the repo with me as well?

@ghost
Copy link

ghost commented Jun 29, 2022

I have the same problems now. Updated rarities after some nfts staked. Now user can't unstake, one or more. it depends.
The problem from the error message I can infer.
There is a rairity total saved in each vault, default it's 0 or the number of total nfts.
now you set rairity for nfts
You unstkae one, then the program try to recalculate the total rarity for th vault, new total = old total - the rarity fo the one you unstake, it turned to new value = 0- xxx, that caused the error.

Soooooooooooooooooooooooo painful using this!!!!!!!!!!!!!!!!!!!!!

@nf0x reset all nfts's rarity all to 1 can't solve all the problem.
if the current vaults's total rarity is 0( you have some already staked, set rarity, unstake one, this can lead the total to 0),
if you set the nft's rarity to 1, you still can't unstake.
you have to set it to 0 and then 0-0 is ok, you are able to unstake

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

No branches or pull requests

4 participants