fix contract

This commit is contained in:
2026-01-12 14:33:16 +08:00
parent a18b9a42e4
commit d56f83726b
70 changed files with 1988 additions and 142 deletions

View File

@@ -71,6 +71,7 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
event HandlerSet(address indexed handler, bool isActive);
event GovChanged(address indexed oldGov, address indexed newGov);
event AumAdjustmentChanged(uint256 addition, uint256 deduction);
event CooldownInherited(address indexed from, address indexed to, uint256 cooldownTime);
modifier onlyGov() {
if (msg.sender != gov) revert Forbidden();
@@ -138,6 +139,24 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
emit AumAdjustmentChanged(_addition, _deduction);
}
/**
* @notice LP 代币转账时的回调函数
* @param _from 发送方地址
* @param _to 接收方地址
* @dev 当 LP 代币转账时,接收方继承发送方的冷却时间,防止绕过冷却期
*/
function onLPTransfer(address _from, address _to) external {
// 只允许 ytLP 代币合约调用
if (msg.sender != ytLP) revert Forbidden();
// 如果发送方有冷却时间记录,且接收方的冷却时间更早(或没有记录)
// 则将发送方的冷却时间继承给接收方
if (lastAddedAt[_from] > 0 && lastAddedAt[_to] < lastAddedAt[_from]) {
lastAddedAt[_to] = lastAddedAt[_from];
emit CooldownInherited(_from, _to, lastAddedAt[_from]);
}
}
/**
* @notice 为指定账户添加流动性Handler调用
*/