Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@0xleal
Copy link
Member

@0xleal 0xleal commented Nov 7, 2025

Note

Introduces TalentVaultV3 (ERC4626) with time-locked deposits, configurable yield and limits, plus deployment tooling and comprehensive tests.

  • Contracts:
    • Add contracts/talent/TalentVaultV3.sol (ERC4626) with:
      • Time-locked withdrawals via lockPeriod and per-deposit lastDepositAt check in _withdraw.
      • Configurable yield: yieldRate (only increase), yieldAccrualDeadline, start/stop flags, yieldSource-funded rewards minted via _deposit in yieldRewards and refresh/refreshForAddress.
      • Deposit controls: maxOverallDeposit and per-address max via setMaxMint/removeMaxMintLimit; reverts on zero or exceeding limits.
      • Non-transferable shares (override transfer/transferFrom), withdrawAll, and owner-only admin setters.
  • Scripts:
    • Add scripts/shared/index.ts helper deployTalentVaultV3.
    • Add scripts/talent/deployTalentVaultV3.ts for Base/Mainnet/Testnet deploy, on-chain address validation, explorer verification, and post-deploy checklist.
  • Tests:
    • Add test/contracts/talent/TalentVaultV3.ts covering deployment, 1:1 conversions, deposit/mint/withdraw/redeem, rewards accrual/pausing, limits, admin-only setters, lock-period enforcement (including bypass attempts), and withdrawAll behavior.
  • Misc:
    • Update test/shared/artifacts.ts to include TalentVaultV3.
    • Update .tool-versions to include yarn 1.22.19.

Written by Cursor Bugbot for commit ab73740. This will update automatically on new commits. Configure here.

Comment on lines +167 to +173
function setYieldAccrualDeadline(uint256 _yieldAccrualDeadline) external onlyOwner {
require(_yieldAccrualDeadline > block.timestamp, "Invalid yield accrual deadline");

yieldAccrualDeadline = _yieldAccrualDeadline;

emit YieldAccrualDeadlineUpdated(_yieldAccrualDeadline);
}
Copy link
Collaborator

@pmatsinopoulos pmatsinopoulos Nov 7, 2025

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?

Comment on lines +177 to +185
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;
}
Copy link
Collaborator

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?

Comment on lines +215 to +235
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;
}
Copy link
Collaborator

@pmatsinopoulos pmatsinopoulos Nov 7, 2025

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) ?

Copy link
Member

@RubenSousaDinis RubenSousaDinis left a 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!

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

Successfully merging this pull request may close these issues.

4 participants