Let’s make this clear first: whenever you extend your alpaca locking to 52 weeks, your xAlpaca balance is supposed to resume to exactly the same number as your locked alpaca just as the very first time, and then it shrinks gradually.
However, it is not how the contract actually works.
I just extend my locking to 52 weeks, and my xAlpaca balance is 98% of my locked alpaca token, which means I can’t fully enjoy the benefit of locking my alpaca tokens.
My guess is this is somehow related to the very first time of locking, like how close it is to the weekly epoch time?
It’s not just me, right?
Please fixed this.
It’s not a bug, it’s by design.
365 days is actually 52.14 weeks. A year has been hardcoded as 53 weeks to account for that and avoid decimal calculations.
You will only ever have 52/53th of your ALPACA balance in xALPACA if you lock for the full year.
You can verify that information yourself here (line 80) : xALPACA-contract/xALPACA.sol at main · alpaca-finance/xALPACA-contract · GitHub
Of course this is a bug.
When we talk about a bug, we talk about how the code differs from the design. You refer to the code as the design, this way I believe there will never be any bug in the world.
Actually , as stated in the document https://docs.alpacafinance.org/governance/governance-vault 1 ALPACA locked for one year = 1 xALPACA, this is the design.
And the code works otherwise. This is a bug by definition.
If you check the examples given in the gov-vault doc, there are some more proof as following.
You are right about one year has some more days than 52 weeks, but indeed, thanks to this we should fully get 100% xAlpaca balance , instead of 52/53 of them, by locking alpaca for 52 weeks.
John locked 100 ALPACA for 26 weeks , and received 50 xALPACA
Feeling like a llama, John then decided he’d prefer to get a higher multiple on his rewards so he extended his lockup from 26 to 52 weeks, and received an additional 50 xALPACA, bringing his total balance to 100 xALPACA
You can see the formula below for xALPACA calculation.
1.) “CurrentTime” is the time the snapshot is taken each Thursday
2.) UnlockTime is when the ALPACA will be unlocked based on users selection. Since the unlock time is always forced to fall on Thursday, everyone who choose max lock. will have same unlock time regardless of when they lock it.
3.) Regardless of the xALPACA balance prior to the snapshot (which will depend a bit on the lock time), everyone with “max lock time” will have same xALPACA balance at the first snapshot
4.) The amount is all relative, meaning it affects everyone equally, it affects everyone equally. and no-one who does max lock really gets “diluted” even though xALPACA balance is slightly less than 1 at max lock. You are still getting max lock b/c no one else also has 1xALPACA.
Hope this answers your question.
We can change the language in the docs to reflect the nuance in the actual implementation if it’s a source of confusion.
I think this explains, also I think it’s necessary to update our doc to diminish confusion
Sure thing. Will update in our Docs to make it more clear.