-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: Frax middleman example #41
Conversation
function incentivizePool( | ||
address poolAddress, | ||
address, | ||
address, | ||
address incentiveTokenAddress, | ||
uint256, | ||
uint256 amount | ||
) external { | ||
IERC20(incentiveTokenAddress).safeTransferFrom(msg.sender, address(this), amount); | ||
DistributionParameters memory params = gaugeParams[poolAddress][incentiveTokenAddress]; | ||
if (params.uniV3Pool == address(0)) revert InvalidParams(); | ||
DistributionCreator creator = merklDistributionCreator(); | ||
// Minimum amount of incentive tokens to be distributed per hour | ||
uint256 minAmount = creator.rewardTokenMinAmounts(incentiveTokenAddress) * params.numEpoch; | ||
params.epochStart = uint32(block.timestamp); | ||
// Adding the leftover amounts to the total amount to be distributed | ||
uint256 leftover = leftovers[incentiveTokenAddress][poolAddress]; | ||
amount += leftover; | ||
params.amount = amount; | ||
if (amount > 0) { | ||
if (amount > minAmount) { | ||
_handleIncentiveTokenAllowance(IERC20(incentiveTokenAddress), address(creator), amount); | ||
merklDistributionCreator().createDistribution(params); | ||
if (leftover > 0) leftovers[incentiveTokenAddress][poolAddress] = 0; | ||
} else { | ||
leftovers[incentiveTokenAddress][poolAddress] = amount; | ||
} | ||
} | ||
} |
Check warning
Code scanning / Slither
Unused return
function setOperator(address _operatorAddress) external onlyByOwnerOperator { | ||
operatorAddress = _operatorAddress; | ||
} |
Check notice
Code scanning / Slither
Missing events access control
} | ||
|
||
/// @notice Sets the operator of the contract | ||
function setOperator(address _operatorAddress) external onlyByOwnerOperator { |
Check notice
Code scanning / Slither
Missing zero address validation
function incentivizePool( | ||
address poolAddress, | ||
address, | ||
address, | ||
address incentiveTokenAddress, | ||
uint256, | ||
uint256 amount | ||
) external { | ||
IERC20(incentiveTokenAddress).safeTransferFrom(msg.sender, address(this), amount); | ||
DistributionParameters memory params = gaugeParams[poolAddress][incentiveTokenAddress]; | ||
if (params.uniV3Pool == address(0)) revert InvalidParams(); | ||
DistributionCreator creator = merklDistributionCreator(); | ||
// Minimum amount of incentive tokens to be distributed per hour | ||
uint256 minAmount = creator.rewardTokenMinAmounts(incentiveTokenAddress) * params.numEpoch; | ||
params.epochStart = uint32(block.timestamp); | ||
// Adding the leftover amounts to the total amount to be distributed | ||
uint256 leftover = leftovers[incentiveTokenAddress][poolAddress]; | ||
amount += leftover; | ||
params.amount = amount; | ||
if (amount > 0) { | ||
if (amount > minAmount) { | ||
_handleIncentiveTokenAllowance(IERC20(incentiveTokenAddress), address(creator), amount); | ||
merklDistributionCreator().createDistribution(params); | ||
if (leftover > 0) leftovers[incentiveTokenAddress][poolAddress] = 0; | ||
} else { | ||
leftovers[incentiveTokenAddress][poolAddress] = amount; | ||
} | ||
} | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
ebcf76c
to
ce72f26
Compare
No description provided.