Submitted by zhaojie, also found by jerseyjoewalcott
The timeSinceStart in the vrgdac.xToY function will revert over a certain value, resulting in the ERC20TokenEmitter#buyToken function always revert.
Initialize the VRGDAC using the parameters in the test code.
The timeSinceStart is set to 394 days in the test code:
Run the forge test -vvvv, console to output:
Changing the timeSinceStart to toDaysWadUnsafe(86400 * 365) will work.
When this function is used in ERC20TokenEmitter#buyToken, the timeSinceStart is: block.timestamp-startTime
startTime is set during the initialization of the ERC20TokenEmitter contract:
In other words, if the ERC20TokenEmitter contract is deployed and initialized and becomes unavailable after 400 days(400 days is the test value, the actual value will be affected by other parameters), calling the buyToken function will always revert.
VScode
Optimize the vrgdac.yToX function, or set a minimum timeSinceStart value, which is used when the minimum is exceeded.
rocketman-21 (Revolution) confirmed and commented:
0xTheC0der (Judge) commented:
