Date.Now()provided in TypeScript to get the Unix timestamp at that exact moment. A problem exists that this is in milliseconds, not seconds which
block.timestampuses in Solidity. This is easy enough to fix by doing
Date.now() / 1000.
86400), and the number of days the user specified to lock their stake. For example, if a user requests to lock their stake for 120 days, the calculation would be as follows.
lock = (Date.now() / 1000) + (86400 * 120) lockPeriod = ethers.BigNumber.from(lock)