-
Notifications
You must be signed in to change notification settings - Fork 21
Add new talent vault #123
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
base: master
Are you sure you want to change the base?
Add new talent vault #123
Conversation
| function setYieldAccrualDeadline(uint256 _yieldAccrualDeadline) external onlyOwner { | ||
| require(_yieldAccrualDeadline > block.timestamp, "Invalid yield accrual deadline"); | ||
|
|
||
| yieldAccrualDeadline = _yieldAccrualDeadline; | ||
|
|
||
| emit YieldAccrualDeadlineUpdated(_yieldAccrualDeadline); | ||
| } |
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.
Initially, the accrual deadline is 90 days after the contract deployment. Are we going to call this function again before the 90 days to make it further in the future?
| function stopYieldingRewards() external onlyOwner { | ||
| yieldRewardsFlag = false; | ||
| } | ||
|
|
||
| /// @notice Start the contract accruing rewards | ||
| /// @dev Can only be called by the owner | ||
| function startYieldingRewards() external onlyOwner { | ||
| yieldRewardsFlag = true; | ||
| } |
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.
Do you think that it might be useful to emit corresponding events?
| function deposit(uint256 assets, address receiver) public virtual override returns (uint256) { | ||
| if (assets <= 0) { | ||
| revert InvalidDepositAmount(); | ||
| } | ||
|
|
||
| if (totalAssets() + assets > maxOverallDeposit) { | ||
| revert MaxOverallDepositReached(); | ||
| } | ||
|
|
||
| refreshForAddress(receiver); | ||
|
|
||
| uint256 shares = super.deposit(assets, receiver); | ||
|
|
||
| UserBalanceMeta storage balanceMeta = userBalanceMeta[receiver]; | ||
|
|
||
| balanceMeta.depositedAmount += assets; | ||
|
|
||
| balanceMeta.lastDepositAt = block.timestamp; | ||
|
|
||
| return shares; | ||
| } |
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.
Besides checking that the deposit doesn't make the total assets cross the maxOverallDeposit, I think that we should check that the deposit doesn't cross the limit that each address might have via the maxMint(address) function. Am i wrong? Otherwise, one might deposit more that they might be allowed 🤔 ... In other words, maybe the balanceMeta.depositedAmount += assets; should not bring the balanceMeta.depositedAmount in a value which is greater than the maximum amount that an address can deposit based on the maxMint(address) ?
RubenSousaDinis
left a comment
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.
Looks good to me!
Note
Introduces
TalentVaultV3(ERC4626) with time-locked deposits, configurable yield and limits, plus deployment tooling and comprehensive tests.contracts/talent/TalentVaultV3.sol(ERC4626) with:lockPeriodand per-depositlastDepositAtcheck in_withdraw.yieldRate(only increase),yieldAccrualDeadline, start/stop flags,yieldSource-funded rewards minted via_depositinyieldRewardsandrefresh/refreshForAddress.maxOverallDepositand per-address max viasetMaxMint/removeMaxMintLimit; reverts on zero or exceeding limits.transfer/transferFrom),withdrawAll, and owner-only admin setters.scripts/shared/index.tshelperdeployTalentVaultV3.scripts/talent/deployTalentVaultV3.tsfor Base/Mainnet/Testnet deploy, on-chain address validation, explorer verification, and post-deploy checklist.test/contracts/talent/TalentVaultV3.tscovering deployment, 1:1 conversions, deposit/mint/withdraw/redeem, rewards accrual/pausing, limits, admin-only setters, lock-period enforcement (including bypass attempts), andwithdrawAllbehavior.test/shared/artifacts.tsto includeTalentVaultV3..tool-versionsto includeyarn 1.22.19.Written by Cursor Bugbot for commit ab73740. This will update automatically on new commits. Configure here.