From 658dd8828ca6067b30d3bb3c68c1848ea0f324f4 Mon Sep 17 00:00:00 2001 From: Petrovska Date: Fri, 18 Oct 2024 14:20:22 +0700 Subject: [PATCH] chore: lint all files and remove ignore section from toml file --- contracts/ChildChainGaugeInjectorV2.sol | 465 ++++++++---------- contracts/injectorFactoryV2.sol | 37 +- .../interfaces/balancer/AuthorizerAdapter.sol | 5 +- .../interfaces/balancer/IBALTokenHolder.sol | 6 +- .../interfaces/balancer/IBalancerMinter.sol | 25 +- .../interfaces/balancer/IChildChainGauge.sol | 155 +++--- .../balancer/IChildChainStreamer.sol | 16 +- .../interfaces/balancer/IRewardsOnlyGauge.sol | 65 +-- foundry.toml | 3 - 9 files changed, 321 insertions(+), 456 deletions(-) diff --git a/contracts/ChildChainGaugeInjectorV2.sol b/contracts/ChildChainGaugeInjectorV2.sol index 6642744..c870063 100644 --- a/contracts/ChildChainGaugeInjectorV2.sol +++ b/contracts/ChildChainGaugeInjectorV2.sol @@ -24,12 +24,7 @@ import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; * @dev Any contract that will be an owner of this contract should either have passthrough functions to change owner, or sweep all funds. * see https://docs.chain.link/chainlink-automation/utility-contracts/ */ -contract ChildChainGaugeInjectorV2 is -Ownable2Step, -Pausable, -Initializable, -KeeperCompatibleInterface -{ +contract ChildChainGaugeInjectorV2 is Ownable2Step, Pausable, Initializable, KeeperCompatibleInterface { using EnumerableSet for EnumerableSet.AddressSet; event KeeperRegistryAddressUpdated(address[] oldAddresses, address[] newAddresses); @@ -51,21 +46,14 @@ KeeperCompatibleInterface ); event RecipientRemoved(address gaugeAddress); event InjectorInitialized( - address[] keeperAddresses, - uint256 minWaitPeriodSeconds, - address injectTokenAddress, - uint256 maxInjectionAmount + address[] keeperAddresses, uint256 minWaitPeriodSeconds, address injectTokenAddress, uint256 maxInjectionAmount ); error OnlyKeepers(address sender); error ZeroAddress(); error RewardTokenError(); error RemoveNonexistentRecipient(address gaugeAddress); - error ExceedsMaxInjectionAmount( - address gaugeAddress, - uint256 amountsPerPeriod, - uint256 maxInjectionAmount - ); + error ExceedsMaxInjectionAmount(address gaugeAddress, uint256 amountsPerPeriod, uint256 maxInjectionAmount); error ExceedsWeeklySpend(uint256 weeklySpend); error ExceedsTotalInjectorProgramBudget(uint256 totalDue); error InjectorNotDistributor(address gauge, address InjectTokenAddress); @@ -82,41 +70,41 @@ KeeperCompatibleInterface EnumerableSet.AddressSet internal ActiveGauges; mapping(address => Target) internal GaugeConfigs; -/** -/* @notice The addresses that can call performUpkeep,the 0 address anywhere in this list is a wildcard, in this case anyone can keep. -*/ + /** + * /* @notice The addresses that can call performUpkeep,the 0 address anywhere in this list is a wildcard, in this case anyone can keep. + */ address[] public KeeperAddresses; -/** -/* @notice The max amount any 1 schedule can inject in any one round -*/ + /** + * /* @notice The max amount any 1 schedule can inject in any one round + */ uint256 public MaxInjectionAmount; -/** -/* @notice The max amount that can be programmed fire over 1 run on all active periods, add will not work if this is exceed. 0 for unlimited. -*/ + /** + * /* @notice The max amount that can be programmed fire over 1 run on all active periods, add will not work if this is exceed. 0 for unlimited. + */ uint256 public MaxGlobalAmountPerPeriod; -/** -/* @notice The max total amount due over all active programs. New program adds will not be allowed if they exceed this number. 0 for unlimited. -*/ + /** + * /* @notice The max total amount due over all active programs. New program adds will not be allowed if they exceed this number. 0 for unlimited. + */ uint256 public MaxTotalDue; -/** -/* @notice Regardless of other logic, wait at least this long on each gauge between injections. -*/ + /** + * /* @notice Regardless of other logic, wait at least this long on each gauge between injections. + */ uint256 public MinWaitPeriodSeconds; -/** -/* @notice The token this injector operates on. -*/ + /** + * /* @notice The token this injector operates on. + */ address public InjectTokenAddress; - constructor() Ownable(msg.sender) {} + constructor() Ownable(msg.sender) {} -/* - * @notice Initializes the ChildChainGaugeInjector logic contract. - * @param owner of the injector. Has special privileges. - * @param keeperAddresses The addresses of the keeper contracts - * @param minWaitPeriodSeconds The minimum wait period for address between funding (for security) - * @param injectTokenAddress The ERC20 token this contract should mange - * @param maxInjectionAmount The max amount of tokens that should be injected to a single gauge in a single week by this injector. - */ + /* + * @notice Initializes the ChildChainGaugeInjector logic contract. + * @param owner of the injector. Has special privileges. + * @param keeperAddresses The addresses of the keeper contracts + * @param minWaitPeriodSeconds The minimum wait period for address between funding (for security) + * @param injectTokenAddress The ERC20 token this contract should mange + * @param maxInjectionAmount The max amount of tokens that should be injected to a single gauge in a single week by this injector. + */ function initialize( address owner, address[] memory keeperAddresses, @@ -129,18 +117,13 @@ KeeperCompatibleInterface MinWaitPeriodSeconds = minWaitPeriodSeconds; InjectTokenAddress = injectTokenAddress; MaxInjectionAmount = maxInjectionAmount; - emit InjectorInitialized( - keeperAddresses, - minWaitPeriodSeconds, - injectTokenAddress, - maxInjectionAmount - ); + emit InjectorInitialized(keeperAddresses, minWaitPeriodSeconds, injectTokenAddress, maxInjectionAmount); } -/** - * @notice Injects funds into the gauges provided - * @param gauges the list of gauges to fund (addresses must be pre-approved) - */ + /** + * @notice Injects funds into the gauges provided + * @param gauges the list of gauges to fund (addresses must be pre-approved) + */ function _injectFunds(address[] memory gauges) internal whenNotPaused { uint256 minWaitPeriodSeconds = MinWaitPeriodSeconds; IERC20 token = IERC20(InjectTokenAddress); @@ -149,65 +132,50 @@ KeeperCompatibleInterface address gaugeAddress = gauges[idx]; Target storage targetConfig = GaugeConfigs[gaugeAddress]; IChildChainGauge gauge = IChildChainGauge(gaugeAddress); - uint256 current_gauge_emissions_end = gauge - .reward_data(address(token)) - .period_finish; + uint256 current_gauge_emissions_end = gauge.reward_data(address(token)).period_finish; if ( - targetConfig.lastInjectionTimestamp + minWaitPeriodSeconds <= block.timestamp && // Not too recent based on minWaitPeriodSeconds - targetConfig.programStartTimestamp <= block.timestamp && // Not before program start time - current_gauge_emissions_end <= block.timestamp && // This token is currently not streaming on this gauge - targetConfig.periodNumber < targetConfig.maxPeriods && // We have not already executed the last period - balance >= targetConfig.amountPerPeriod && // We have enough coins to pay - targetConfig.amountPerPeriod <= MaxInjectionAmount && // We are not trying to inject more than the global max for 1 injection - targetConfig.isActive // The gauge is marked active in the injector + targetConfig.lastInjectionTimestamp + minWaitPeriodSeconds <= block.timestamp // Not too recent based on minWaitPeriodSeconds + && targetConfig.programStartTimestamp <= block.timestamp // Not before program start time + && current_gauge_emissions_end <= block.timestamp // This token is currently not streaming on this gauge + && targetConfig.periodNumber < targetConfig.maxPeriods // We have not already executed the last period + && balance >= targetConfig.amountPerPeriod // We have enough coins to pay + && targetConfig.amountPerPeriod <= MaxInjectionAmount // We are not trying to inject more than the global max for 1 injection + && targetConfig.isActive // The gauge is marked active in the injector ) { - SafeERC20.forceApprove( - token, - gaugeAddress, - targetConfig.amountPerPeriod - ); - - gauge.deposit_reward_token( - address(token), - targetConfig.amountPerPeriod - ); + SafeERC20.forceApprove(token, gaugeAddress, targetConfig.amountPerPeriod); + + gauge.deposit_reward_token(address(token), targetConfig.amountPerPeriod); balance -= targetConfig.amountPerPeriod; targetConfig.lastInjectionTimestamp = uint56(block.timestamp); targetConfig.periodNumber++; - emit EmissionsInjection( - gaugeAddress, - address(token), - targetConfig.amountPerPeriod - ); + emit EmissionsInjection(gaugeAddress, address(token), targetConfig.amountPerPeriod); } } } -/** - * @notice This is to allow the owner to manually trigger an injection of funds in place of the keeper - * @notice without abi encoding the gauge list - * @param gauges array of gauges to inject tokens to - */ + /** + * @notice This is to allow the owner to manually trigger an injection of funds in place of the keeper + * @notice without abi encoding the gauge list + * @param gauges array of gauges to inject tokens to + */ function injectFunds(address[] memory gauges) external onlyOwner { _injectFunds(gauges); } -/** - * @notice Get list of addresses that are ready for new token injections and return keeper-compatible payload - * @notice calldata required by the chainlink interface but not used in this case, use 0x - * @return upkeepNeeded signals if upkeep is needed - * @return performData is an abi encoded list of addresses that need funds - */ - function checkUpkeep( - bytes calldata - ) - external - view - override - whenNotPaused - returns (bool upkeepNeeded, bytes memory performData) + /** + * @notice Get list of addresses that are ready for new token injections and return keeper-compatible payload + * @notice calldata required by the chainlink interface but not used in this case, use 0x + * @return upkeepNeeded signals if upkeep is needed + * @return performData is an abi encoded list of addresses that need funds + */ + function checkUpkeep(bytes calldata) + external + view + override + whenNotPaused + returns (bool upkeepNeeded, bytes memory performData) { address[] memory ready = getReadyGauges(); upkeepNeeded = ready.length > 0; @@ -215,24 +183,23 @@ KeeperCompatibleInterface return (upkeepNeeded, performData); } -/** - * @notice Called by keeper to send funds to underfunded addresses - * @param performData The abi encoded list of addresses to fund - */ - function performUpkeep( - bytes calldata performData - ) external override onlyKeeper whenNotPaused { + /** + * @notice Called by keeper to send funds to underfunded addresses + * @param performData The abi encoded list of addresses to fund + */ + function performUpkeep(bytes calldata performData) external override onlyKeeper whenNotPaused { address[] memory needsFunding = abi.decode(performData, (address[])); _injectFunds(needsFunding); emit PerformedUpkeep(needsFunding); } -/** - * @notice Adds/updates a list of recipients with the same configuration - * @param recipients A list of gauges to be setup with the defined params amounts - * @param amountPerPeriod the wei amount of tokens per period that each listed gauge should receive - * @param maxPeriods The number of weekly periods the specified amount should be paid to the specified gauge over - * @param doNotStartBeforeTimestamp A timestamp that injections should not start before. Use 0 to start as soon as gauges are ready. - */ + /** + * @notice Adds/updates a list of recipients with the same configuration + * @param recipients A list of gauges to be setup with the defined params amounts + * @param amountPerPeriod the wei amount of tokens per period that each listed gauge should receive + * @param maxPeriods The number of weekly periods the specified amount should be paid to the specified gauge over + * @param doNotStartBeforeTimestamp A timestamp that injections should not start before. Use 0 to start as soon as gauges are ready. + */ + function addRecipients( address[] calldata recipients, uint256 amountPerPeriod, @@ -244,22 +211,13 @@ KeeperCompatibleInterface // Check that we are not violating MaxInjectionAmount - we use recipients[0] here as address because in this // case all added gauges violate MaxInjectionAmount and the event takes a single address, so the first one breaks it. if (MaxInjectionAmount > 0 && MaxInjectionAmount < amountPerPeriod) { - revert ExceedsMaxInjectionAmount( - recipients[0], - amountPerPeriod, - MaxInjectionAmount - ); + revert ExceedsMaxInjectionAmount(recipients[0], amountPerPeriod, MaxInjectionAmount); } - for (uint i = 0; i < recipients.length; i++) { + for (uint256 i = 0; i < recipients.length; i++) { // Check that this is a gauge and it is ready for us to inject to it IChildChainGauge gauge = IChildChainGauge(recipients[i]); - if ( - gauge.reward_data(InjectTokenAddress).distributor != address(this) - ) { - revert InjectorNotDistributor( - address(gauge), - InjectTokenAddress - ); + if (gauge.reward_data(InjectTokenAddress).distributor != address(this)) { + revert InjectorNotDistributor(address(gauge), InjectTokenAddress); } // enumerableSet returns false if Already Exists @@ -284,22 +242,17 @@ KeeperCompatibleInterface } emit RecipientAdded( - recipients[i], - amountPerPeriod, - maxPeriods, - executedPeriods, - doNotStartBeforeTimestamp, - update + recipients[i], amountPerPeriod, maxPeriods, executedPeriods, doNotStartBeforeTimestamp, update ); } } -/** - * @notice Removes Recipients - * @param recipients A list of recipients to remove - */ + /** + * @notice Removes Recipients + * @param recipients A list of recipients to remove + */ function removeRecipients(address[] calldata recipients) public onlyOwner { - for (uint i = 0; i < recipients.length; i++) { + for (uint256 i = 0; i < recipients.length; i++) { if (ActiveGauges.remove(recipients[i])) { GaugeConfigs[recipients[i]].isActive = false; emit RecipientRemoved(recipients[i]); @@ -309,49 +262,48 @@ KeeperCompatibleInterface } } -/** - * @notice Sweep the full contract's balance for a given ERC-20 token - * @param token The ERC-20 token which needs to be swept - */ + /** + * @notice Sweep the full contract's balance for a given ERC-20 token + * @param token The ERC-20 token which needs to be swept + */ function sweep(address token, address dest) external onlyOwner { uint256 balance = IERC20(token).balanceOf(address(this)); SafeERC20.safeTransfer(IERC20(token), dest, balance); emit ERC20Swept(token, owner(), balance); } -/** - * @notice Manually deposit an amount of tokens to the gauge - Does not check MaxInjectionAmount - * @param gauge The Gauge to set distributor to injector owner - * @param reward_token Reward token you are seeding - * @param amount Amount to deposit - */ - function manualDeposit( - address gauge, - address reward_token, - uint256 amount - ) external onlyOwner { + /** + * @notice Manually deposit an amount of tokens to the gauge - Does not check MaxInjectionAmount + * @param gauge The Gauge to set distributor to injector owner + * @param reward_token Reward token you are seeding + * @param amount Amount to deposit + */ + function manualDeposit(address gauge, address reward_token, uint256 amount) external onlyOwner { IChildChainGauge gaugeContract = IChildChainGauge(gauge); IERC20 token = IERC20(reward_token); SafeERC20.forceApprove(token, gauge, amount); gaugeContract.deposit_reward_token(reward_token, amount); emit EmissionsInjection(gauge, reward_token, amount); } -/** -* @notice Get's the full injector schedule in 1 call. All lists are ordered such that the same member across all arrays represents one program. - * @return gauges Currently scheduled gauges - * @return amountsPerPeriod how much token in wei is paid to the gauge per period - * @return maxPeriods the max number of periods this program will run for - * @return lastTimestamps the last timestamp the injector ran for this gauge - * @return doNotStartBeforeTimestamps a timestamp this schedule should not start before - - */ - -/** -* @notice Gets all current schedule information as a set of arrays -*/ - function getFullSchedule() external view returns (address[] memory, uint256[] memory, uint8[] memory, uint8[] memory, uint56[] memory, uint56[] memory) { + /** + * @notice Get's the full injector schedule in 1 call. All lists are ordered such that the same member across all arrays represents one program. + * @return gauges Currently scheduled gauges + * @return amountsPerPeriod how much token in wei is paid to the gauge per period + * @return maxPeriods the max number of periods this program will run for + * @return lastTimestamps the last timestamp the injector ran for this gauge + * @return doNotStartBeforeTimestamps a timestamp this schedule should not start before + */ + + /** + * @notice Gets all current schedule information as a set of arrays + */ + function getFullSchedule() + external + view + returns (address[] memory, uint256[] memory, uint8[] memory, uint8[] memory, uint56[] memory, uint56[] memory) + { address[] memory gauges = getActiveGaugeList(); - uint len = gauges.length; + uint256 len = gauges.length; uint256[] memory amountsPerPeriod = new uint256[](len); uint8[] memory currentPeriods = new uint8[](len); uint8[] memory maxPeriods = new uint8[](len); @@ -369,25 +321,24 @@ KeeperCompatibleInterface return (gauges, amountsPerPeriod, maxPeriods, currentPeriods, lastTimestamps, doNotStartBeforeTimestamps); } -/** - * @notice Gets the total amount of tokens due to complete the program. - * @return totalDue The total amount of tokens required in the contract balance to pay out all programmed injections across all gauges. - */ + /** + * @notice Gets the total amount of tokens due to complete the program. + * @return totalDue The total amount of tokens required in the contract balance to pay out all programmed injections across all gauges. + */ function getTotalDue() public view returns (uint256 totalDue) { address[] memory gaugeList = getActiveGaugeList(); for (uint256 idx = 0; idx < gaugeList.length; idx++) { Target memory target = GaugeConfigs[gaugeList[idx]]; - totalDue += - (target.maxPeriods - target.periodNumber) * - target.amountPerPeriod; + totalDue += (target.maxPeriods - target.periodNumber) * target.amountPerPeriod; } return totalDue; } -/** - * @notice Gets the total weekly spend - * @return weeklySpend The total amount of tokens required to fulfil all active programs for 1 period. - */ - function getWeeklySpend() public view returns (uint256 weeklySpend){ + /** + * @notice Gets the total weekly spend + * @return weeklySpend The total amount of tokens required to fulfil all active programs for 1 period. + */ + + function getWeeklySpend() public view returns (uint256 weeklySpend) { address[] memory gauges = getActiveGaugeList(); for (uint256 i = 0; i < gauges.length; i++) { Target memory target = GaugeConfigs[gauges[i]]; @@ -398,10 +349,10 @@ KeeperCompatibleInterface return weeklySpend; } -/** - * @notice Gets the difference between the total amount scheduled and the balance in the contract. - * @return delta is 0 if balances match, negative if injector balance is in deficit to service all loaded programs, and positive if there is a surplus. - */ + /** + * @notice Gets the difference between the total amount scheduled and the balance in the contract. + * @return delta is 0 if balances match, negative if injector balance is in deficit to service all loaded programs, and positive if there is a surplus. + */ function getBalanceDelta() public view returns (int256 delta) { uint256 balance = IERC20(InjectTokenAddress).balanceOf(address(this)); uint256 totalDue = getTotalDue(); @@ -413,12 +364,11 @@ KeeperCompatibleInterface } } - -/** - * @notice Gets a list of addresses that are ready to inject - * @notice This is done by checking if the current period has ended, and should inject new funds directly after the end of each period. - * @return list of addresses that are ready to inject - */ + /** + * @notice Gets a list of addresses that are ready to inject + * @notice This is done by checking if the current period has ended, and should inject new funds directly after the end of each period. + * @return list of addresses that are ready to inject + */ function getReadyGauges() public view returns (address[] memory) { address[] memory gaugeList = getActiveGaugeList(); address[] memory ready = new address[](gaugeList.length); @@ -431,24 +381,16 @@ KeeperCompatibleInterface for (uint256 idx = 0; idx < gaugeList.length; idx++) { target = GaugeConfigs[gaugeList[idx]]; IChildChainGauge gauge = IChildChainGauge(gaugeList[idx]); - uint256 current_gauge_emissions_end = gauge - .reward_data(tokenAddress) - .period_finish; + uint256 current_gauge_emissions_end = gauge.reward_data(tokenAddress).period_finish; if (target.amountPerPeriod > maxInjectionAmount) { - revert ExceedsMaxInjectionAmount( - gaugeList[idx], - target.amountPerPeriod, - maxInjectionAmount - ); + revert ExceedsMaxInjectionAmount(gaugeList[idx], target.amountPerPeriod, maxInjectionAmount); } if ( - target.lastInjectionTimestamp + minWaitPeriod <= block.timestamp && - target.programStartTimestamp <= block.timestamp && - current_gauge_emissions_end <= block.timestamp && - balance >= target.amountPerPeriod && - target.periodNumber < target.maxPeriods && - target.amountPerPeriod <= maxInjectionAmount && - gauge.reward_data(tokenAddress).distributor == address(this) + target.lastInjectionTimestamp + minWaitPeriod <= block.timestamp + && target.programStartTimestamp <= block.timestamp && current_gauge_emissions_end <= block.timestamp + && balance >= target.amountPerPeriod && target.periodNumber < target.maxPeriods + && target.amountPerPeriod <= maxInjectionAmount + && gauge.reward_data(tokenAddress).distributor == address(this) ) { ready[count] = gaugeList[idx]; count++; @@ -466,30 +408,28 @@ KeeperCompatibleInterface return ready; } -/** - * @notice Return a list of active gauges - */ + /** + * @notice Return a list of active gauges + */ function getActiveGaugeList() public view returns (address[] memory) { return ActiveGauges.values(); } -/** - * @notice Gets configuration information for an address on the gauge list - * @param targetAddress return Target struct for a given gauge according to the current scheduled distributions - */ - function getGaugeInfo( - address targetAddress - ) - external - view - returns ( - uint256 amountPerPeriod, - bool isActive, - uint8 maxPeriods, - uint8 periodNumber, - uint56 lastInjectionTimestamp, - uint56 doNotStartBeforeTimestamp - ) + /** + * @notice Gets configuration information for an address on the gauge list + * @param targetAddress return Target struct for a given gauge according to the current scheduled distributions + */ + function getGaugeInfo(address targetAddress) + external + view + returns ( + uint256 amountPerPeriod, + bool isActive, + uint8 maxPeriods, + uint8 periodNumber, + uint56 lastInjectionTimestamp, + uint56 doNotStartBeforeTimestamp + ) { Target memory target = GaugeConfigs[targetAddress]; return ( @@ -502,84 +442,77 @@ KeeperCompatibleInterface ); } -/** -* @notice Set distributor from the injector to a specified distributor. -* @notice This injector will only function for gauges it is distributor on -* @notice be aware that the only addresses able to call set_reward_distributor is the current distributor, so make the right person has control over the new address. -* @param gauge address The Gauge to set distributor for -* @param reward_token address Token you are setting the distributor for -* @param distributor address The new distributor -*/ - function changeDistributor( - address gauge, - address reward_token, - address distributor - ) external onlyOwner { - IChildChainGauge(gauge).set_reward_distributor( - reward_token, - distributor - ); + /** + * @notice Set distributor from the injector to a specified distributor. + * @notice This injector will only function for gauges it is distributor on + * @notice be aware that the only addresses able to call set_reward_distributor is the current distributor, so make the right person has control over the new address. + * @param gauge address The Gauge to set distributor for + * @param reward_token address Token you are setting the distributor for + * @param distributor address The new distributor + */ + function changeDistributor(address gauge, address reward_token, address distributor) external onlyOwner { + IChildChainGauge(gauge).set_reward_distributor(reward_token, distributor); } - function getKeeperAddresses() external view returns (address[] memory) { return KeeperAddresses; } -/** - * @notice Sets the keeper addresses - * @dev Setting the keeper to address(0) will make `performUpkeep` permissionless - * @param keeperAddresses The array of addresses of the keeper contracts - */ + /** + * @notice Sets the keeper addresses + * @dev Setting the keeper to address(0) will make `performUpkeep` permissionless + * @param keeperAddresses The array of addresses of the keeper contracts + */ function setKeeperAddresses(address[] memory keeperAddresses) external onlyOwner { emit KeeperRegistryAddressUpdated(KeeperAddresses, keeperAddresses); KeeperAddresses = keeperAddresses; } -/** - * @notice Sets the minimum wait period (in seconds) for addresses between injections - */ + /** + * @notice Sets the minimum wait period (in seconds) for addresses between injections + */ function setMinWaitPeriodSeconds(uint256 period) external onlyOwner { emit MinWaitPeriodUpdated(MinWaitPeriodSeconds, period); MinWaitPeriodSeconds = period; } -/** - * @notice Sets global MaxInjectionAmount for the injector which will be checked on each injection. - * @param amount The max amount that the injector will allow to be paid to a single gauge in single programmed injection - */ + /** + * @notice Sets global MaxInjectionAmount for the injector which will be checked on each injection. + * @param amount The max amount that the injector will allow to be paid to a single gauge in single programmed injection + */ function setMaxInjectionAmount(uint256 amount) external onlyOwner { emit MaxInjectionAmountUpdated(MaxInjectionAmount, amount); MaxInjectionAmount = amount; } -/** - * @notice Sets global MaxGlobalAmountPerPeriod for the injector, which will prevent schedules from being added that increases the spend of a single round of all active periods from exceeding this amount. - * @param amount The max amount that should be allowed to be scheduled in 1 period across all active programs. - */ + /** + * @notice Sets global MaxGlobalAmountPerPeriod for the injector, which will prevent schedules from being added that increases the spend of a single round of all active periods from exceeding this amount. + * @param amount The max amount that should be allowed to be scheduled in 1 period across all active programs. + */ function setMaxGlobalAmountPerPeriod(uint256 amount) external onlyOwner { emit MaxGlobalAmountPerPeriodUpdated(MaxGlobalAmountPerPeriod, amount); MaxGlobalAmountPerPeriod = amount; } -/** - * @notice Sets global MaxTotalDue for the injector, which will prevent schedules from being added that increases the the total spend of all active programs over all remaining periods from exceeding this amount. - * @param amount The max amount that should be allowed to be scheduled across all remaining periods of all active programs. - */ + /** + * @notice Sets global MaxTotalDue for the injector, which will prevent schedules from being added that increases the the total spend of all active programs over all remaining periods from exceeding this amount. + * @param amount The max amount that should be allowed to be scheduled across all remaining periods of all active programs. + */ function setMaxTotalDue(uint256 amount) external onlyOwner { emit MaxTotalDueUpdated(MaxTotalDue, amount); MaxTotalDue = amount; } -/** - * @notice Pauses the contract, which prevents executing performUpkeep - */ + /** + * @notice Pauses the contract, which prevents executing performUpkeep + */ + function pause() external onlyOwner { _pause(); } -/** - * @notice Unpauses the contract - */ + /** + * @notice Unpauses the contract + */ function unpause() external onlyOwner { _unpause(); } @@ -587,7 +520,7 @@ KeeperCompatibleInterface modifier onlyKeeper() { if (KeeperAddresses.length > 0) { bool isKeeper = false; - for (uint i = 0; i < KeeperAddresses.length; i++) { + for (uint256 i = 0; i < KeeperAddresses.length; i++) { if (msg.sender == KeeperAddresses[i] || KeeperAddresses[i] == address(0)) { isKeeper = true; break; diff --git a/contracts/injectorFactoryV2.sol b/contracts/injectorFactoryV2.sol index da9a8e8..acdf4df 100644 --- a/contracts/injectorFactoryV2.sol +++ b/contracts/injectorFactoryV2.sol @@ -9,27 +9,27 @@ import "@openzeppelin/contracts/proxy/Clones.sol"; * @dev Factory contract to deploy instances of ChildChainGaugeInjectorV2 using a proxy pattern for low deployment cost */ contract ChildChainGaugeInjectorV2Factory { - event InjectorCreated(address indexed injector, address[] keeperAddresses, address injectTokenAddress, address owner); - + event InjectorCreated( + address indexed injector, address[] keeperAddresses, address injectTokenAddress, address owner + ); address public immutable implementation; address[] private deployedInjectors; - constructor(address logic) { implementation = logic; } -/** - * @dev Deploys a new instance of ChildChainGaugeInjectorV2 using Clones.sol - * @param keeperAddresses The array of addresses of the keeper contracts - * @param minWaitPeriodSeconds The minimum wait period for address between funding (for security) - * @param injectTokenAddress The ERC20 token this contract should manage - * @param maxInjectionAmount The max amount of tokens that should be injected to a single gauge in a single week by this injector. - * @param owner The owner of the ChildChainGaugeInjectorV2 instance - * @return The address of the newly deployed ChildChainGaugeInjectorV2 instance - */ + /** + * @dev Deploys a new instance of ChildChainGaugeInjectorV2 using Clones.sol + * @param keeperAddresses The array of addresses of the keeper contracts + * @param minWaitPeriodSeconds The minimum wait period for address between funding (for security) + * @param injectTokenAddress The ERC20 token this contract should manage + * @param maxInjectionAmount The max amount of tokens that should be injected to a single gauge in a single week by this injector. + * @param owner The owner of the ChildChainGaugeInjectorV2 instance + * @return The address of the newly deployed ChildChainGaugeInjectorV2 instance + */ function createInjector( address[] memory keeperAddresses, uint256 minWaitPeriodSeconds, @@ -39,20 +39,17 @@ contract ChildChainGaugeInjectorV2Factory { ) external returns (address) { address injector = Clones.clone(implementation); ChildChainGaugeInjectorV2(injector).initialize( - owner, - keeperAddresses, - minWaitPeriodSeconds, - injectTokenAddress, - maxInjectionAmount + owner, keeperAddresses, minWaitPeriodSeconds, injectTokenAddress, maxInjectionAmount ); emit InjectorCreated(injector, keeperAddresses, injectTokenAddress, owner); deployedInjectors.push(injector); return injector; } -/** @dev Returns the array of addresses of deployed injectors, note that not all injectors on the list may be active or functional - * @return The array of addresses of deployed injectors - */ + /** + * @dev Returns the array of addresses of deployed injectors, note that not all injectors on the list may be active or functional + * @return The array of addresses of deployed injectors + */ function getDeployedInjectors() external view returns (address[] memory) { return deployedInjectors; } diff --git a/contracts/interfaces/balancer/AuthorizerAdapter.sol b/contracts/interfaces/balancer/AuthorizerAdapter.sol index fc86295..d8962cd 100644 --- a/contracts/interfaces/balancer/AuthorizerAdapter.sol +++ b/contracts/interfaces/balancer/AuthorizerAdapter.sol @@ -9,10 +9,7 @@ interface AuthorizerAdapter { function getVault() external view returns (address); - function performAction( - address target, - bytes memory data - ) external payable returns (bytes memory); + function performAction(address target, bytes memory data) external payable returns (bytes memory); } // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: diff --git a/contracts/interfaces/balancer/IBALTokenHolder.sol b/contracts/interfaces/balancer/IBALTokenHolder.sol index 2865625..3c0c212 100644 --- a/contracts/interfaces/balancer/IBALTokenHolder.sol +++ b/contracts/interfaces/balancer/IBALTokenHolder.sol @@ -12,11 +12,7 @@ interface IBALTokenHolder { function getVault() external view returns (address); - function sweepTokens( - address token, - address recipient, - uint256 amount - ) external; + function sweepTokens(address token, address recipient, uint256 amount) external; function withdrawFunds(address recipient, uint256 amount) external; } diff --git a/contracts/interfaces/balancer/IBalancerMinter.sol b/contracts/interfaces/balancer/IBalancerMinter.sol index 8a42931..35dc627 100644 --- a/contracts/interfaces/balancer/IBalancerMinter.sol +++ b/contracts/interfaces/balancer/IBalancerMinter.sol @@ -4,16 +4,9 @@ pragma solidity ^0.8.21; interface IBalancerMinter { event Minted(address indexed recipient, address gauge, uint256 minted); - event MinterApprovalSet( - address indexed user, - address indexed minter, - bool approval - ); + event MinterApprovalSet(address indexed user, address indexed minter, bool approval); - function allowed_to_mint_for(address minter, address user) - external - view - returns (bool); + function allowed_to_mint_for(address minter, address user) external view returns (bool); function getBalancerToken() external view returns (address); @@ -23,10 +16,7 @@ interface IBalancerMinter { function getGaugeController() external view returns (address); - function getMinterApproval(address minter, address user) - external - view - returns (bool); + function getMinterApproval(address minter, address user) external view returns (bool); function getNextNonce(address user) external view returns (uint256); @@ -36,18 +26,13 @@ interface IBalancerMinter { function mintMany(address[] memory gauges) external returns (uint256); - function mintManyFor(address[] memory gauges, address user) - external - returns (uint256); + function mintManyFor(address[] memory gauges, address user) external returns (uint256); function mint_for(address gauge, address user) external; function mint_many(address[8] memory gauges) external; - function minted(address user, address gauge) - external - view - returns (uint256); + function minted(address user, address gauge) external view returns (uint256); function setMinterApproval(address minter, bool approval) external; diff --git a/contracts/interfaces/balancer/IChildChainGauge.sol b/contracts/interfaces/balancer/IChildChainGauge.sol index cf81b0d..2dcf056 100644 --- a/contracts/interfaces/balancer/IChildChainGauge.sol +++ b/contracts/interfaces/balancer/IChildChainGauge.sol @@ -4,82 +4,93 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; interface IChildChainGauge { + event Approval(address indexed _owner, address indexed _spender, uint256 _value); + event Transfer(address indexed _from, address indexed _to, uint256 _value); + event Deposit(address indexed _user, uint256 _value); + event Withdraw(address indexed _user, uint256 _value); + event UpdateLiquidityLimit( + address indexed _user, + uint256 _original_balance, + uint256 _original_supply, + uint256 _working_balance, + uint256 _working_supply + ); - -event Approval( address indexed _owner,address indexed _spender,uint256 _value ) ; -event Transfer( address indexed _from,address indexed _to,uint256 _value ) ; -event Deposit( address indexed _user,uint256 _value ) ; -event Withdraw( address indexed _user,uint256 _value ) ; -event UpdateLiquidityLimit( address indexed _user,uint256 _original_balance,uint256 _original_supply,uint256 _working_balance,uint256 _working_supply ) ; - -function deposit( uint256 _value ) external ; -function deposit( uint256 _value,address _user ) external ; -function withdraw( uint256 _value ) external ; -function withdraw( uint256 _value,address _user ) external ; -function transferFrom( address _from,address _to,uint256 _value ) external returns (bool ) ; -function approve( address _spender,uint256 _value ) external returns (bool ) ; -function permit( address _owner,address _spender,uint256 _value,uint256 _deadline,uint8 _v,bytes32 _r,bytes32 _s ) external returns (bool ) ; -function transfer( address _to,uint256 _value ) external returns (bool ) ; -function increaseAllowance( address _spender,uint256 _added_value ) external returns (bool ) ; -function decreaseAllowance( address _spender,uint256 _subtracted_value ) external returns (bool ) ; -function user_checkpoint( address addr ) external returns (bool ) ; -function claimable_tokens( address addr ) external returns (uint256 ) ; -function claimed_reward( address _addr,address _token ) external view returns (uint256 ) ; -function claimable_reward( address _user,address _reward_token ) external view returns (uint256 ) ; -function set_rewards_receiver( address _receiver ) external ; -function claim_rewards( ) external ; -function claim_rewards( address _addr ) external ; -function claim_rewards( address _addr,address _receiver ) external ; -function claim_rewards( address _addr,address _receiver,uint256[] memory _reward_indexes ) external ; -function add_reward( address _reward_token,address _distributor ) external ; -function set_reward_distributor( address _reward_token,address _distributor ) external ; -function deposit_reward_token( address _reward_token,uint256 _amount ) external ; -function killGauge( ) external ; -function unkillGauge( ) external ; -function decimals( ) external view returns (uint256 ) ; -function allowance( address owner,address spender ) external view returns (uint256 ) ; -function integrate_checkpoint( ) external view returns (uint256 ) ; -function bal_token( ) external view returns (address ) ; -function bal_pseudo_minter( ) external view returns (address ) ; -function voting_escrow_delegation_proxy( ) external view returns (address ) ; -function authorizer_adaptor( ) external view returns (address ) ; -function initialize( address _lp_token,string memory _version ) external ; -function DOMAIN_SEPARATOR( ) external view returns (bytes32 ) ; -function nonces( address arg0 ) external view returns (uint256 ) ; -function name( ) external view returns (string memory ) ; -function symbol( ) external view returns (string memory ) ; -function balanceOf( address arg0 ) external view returns (uint256 ) ; -function totalSupply( ) external view returns (uint256 ) ; -function lp_token( ) external view returns (address ) ; -function version( ) external view returns (string memory ) ; -function factory( ) external view returns (address ) ; -function working_balances( address arg0 ) external view returns (uint256 ) ; -function working_supply( ) external view returns (uint256 ) ; -function period( ) external view returns (uint256 ) ; -function period_timestamp( uint256 arg0 ) external view returns (uint256 ) ; -function integrate_checkpoint_of( address arg0 ) external view returns (uint256 ) ; -function integrate_fraction( address arg0 ) external view returns (uint256 ) ; -function integrate_inv_supply( uint256 arg0 ) external view returns (uint256 ) ; -function integrate_inv_supply_of( address arg0 ) external view returns (uint256 ) ; -function reward_count( ) external view returns (uint256 ) ; -function reward_tokens( uint256 arg0 ) external view returns (address ) ; -function reward_data( address arg0 ) external view returns (S_0 memory ) ; -function rewards_receiver( address arg0 ) external view returns (address ) ; -function reward_integral_for( address arg0,address arg1 ) external view returns (uint256 ) ; -function is_killed( ) external view returns (bool ) ; -function inflation_rate( uint256 arg0 ) external view returns (uint256 ) ; + function deposit(uint256 _value) external; + function deposit(uint256 _value, address _user) external; + function withdraw(uint256 _value) external; + function withdraw(uint256 _value, address _user) external; + function transferFrom(address _from, address _to, uint256 _value) external returns (bool); + function approve(address _spender, uint256 _value) external returns (bool); + function permit( + address _owner, + address _spender, + uint256 _value, + uint256 _deadline, + uint8 _v, + bytes32 _r, + bytes32 _s + ) external returns (bool); + function transfer(address _to, uint256 _value) external returns (bool); + function increaseAllowance(address _spender, uint256 _added_value) external returns (bool); + function decreaseAllowance(address _spender, uint256 _subtracted_value) external returns (bool); + function user_checkpoint(address addr) external returns (bool); + function claimable_tokens(address addr) external returns (uint256); + function claimed_reward(address _addr, address _token) external view returns (uint256); + function claimable_reward(address _user, address _reward_token) external view returns (uint256); + function set_rewards_receiver(address _receiver) external; + function claim_rewards() external; + function claim_rewards(address _addr) external; + function claim_rewards(address _addr, address _receiver) external; + function claim_rewards(address _addr, address _receiver, uint256[] memory _reward_indexes) external; + function add_reward(address _reward_token, address _distributor) external; + function set_reward_distributor(address _reward_token, address _distributor) external; + function deposit_reward_token(address _reward_token, uint256 _amount) external; + function killGauge() external; + function unkillGauge() external; + function decimals() external view returns (uint256); + function allowance(address owner, address spender) external view returns (uint256); + function integrate_checkpoint() external view returns (uint256); + function bal_token() external view returns (address); + function bal_pseudo_minter() external view returns (address); + function voting_escrow_delegation_proxy() external view returns (address); + function authorizer_adaptor() external view returns (address); + function initialize(address _lp_token, string memory _version) external; + function DOMAIN_SEPARATOR() external view returns (bytes32); + function nonces(address arg0) external view returns (uint256); + function name() external view returns (string memory); + function symbol() external view returns (string memory); + function balanceOf(address arg0) external view returns (uint256); + function totalSupply() external view returns (uint256); + function lp_token() external view returns (address); + function version() external view returns (string memory); + function factory() external view returns (address); + function working_balances(address arg0) external view returns (uint256); + function working_supply() external view returns (uint256); + function period() external view returns (uint256); + function period_timestamp(uint256 arg0) external view returns (uint256); + function integrate_checkpoint_of(address arg0) external view returns (uint256); + function integrate_fraction(address arg0) external view returns (uint256); + function integrate_inv_supply(uint256 arg0) external view returns (uint256); + function integrate_inv_supply_of(address arg0) external view returns (uint256); + function reward_count() external view returns (uint256); + function reward_tokens(uint256 arg0) external view returns (address); + function reward_data(address arg0) external view returns (S_0 memory); + function rewards_receiver(address arg0) external view returns (address); + function reward_integral_for(address arg0, address arg1) external view returns (uint256); + function is_killed() external view returns (bool); + function inflation_rate(uint256 arg0) external view returns (uint256); } -struct S_0 { address distributor; -uint256 period_finish; -uint256 rate; -uint256 last_update; -uint256 integral; } - - - +struct S_0 { + address distributor; + uint256 period_finish; + uint256 rate; + uint256 last_update; + uint256 integral; +} // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* [{"name":"Approval","inputs":[{"name":"_owner","type":"address","indexed":true},{"name":"_spender","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Transfer","inputs":[{"name":"_from","type":"address","indexed":true},{"name":"_to","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Deposit","inputs":[{"name":"_user","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Withdraw","inputs":[{"name":"_user","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"UpdateLiquidityLimit","inputs":[{"name":"_user","type":"address","indexed":true},{"name":"_original_balance","type":"uint256","indexed":false},{"name":"_original_supply","type":"uint256","indexed":false},{"name":"_working_balance","type":"uint256","indexed":false},{"name":"_working_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_voting_escrow_delegation_proxy","type":"address"},{"name":"_bal_pseudo_minter","type":"address"},{"name":"_authorizer_adaptor","type":"address"},{"name":"_version","type":"string"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"deposit","inputs":[{"name":"_value","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"deposit","inputs":[{"name":"_value","type":"uint256"},{"name":"_user","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_value","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_value","type":"uint256"},{"name":"_user","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"transferFrom","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"approve","inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"permit","inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_deadline","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"transfer","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"increaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_added_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"decreaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_subtracted_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"user_checkpoint","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"claimable_tokens","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"claimed_reward","inputs":[{"name":"_addr","type":"address"},{"name":"_token","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"claimable_reward","inputs":[{"name":"_user","type":"address"},{"name":"_reward_token","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"set_rewards_receiver","inputs":[{"name":"_receiver","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim_rewards","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim_rewards","inputs":[{"name":"_addr","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim_rewards","inputs":[{"name":"_addr","type":"address"},{"name":"_receiver","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim_rewards","inputs":[{"name":"_addr","type":"address"},{"name":"_receiver","type":"address"},{"name":"_reward_indexes","type":"uint256[]"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"add_reward","inputs":[{"name":"_reward_token","type":"address"},{"name":"_distributor","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_reward_distributor","inputs":[{"name":"_reward_token","type":"address"},{"name":"_distributor","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"deposit_reward_token","inputs":[{"name":"_reward_token","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"killGauge","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"unkillGauge","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"decimals","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"allowance","inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"integrate_checkpoint","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"bal_token","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"bal_pseudo_minter","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"voting_escrow_delegation_proxy","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"authorizer_adaptor","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"initialize","inputs":[{"name":"_lp_token","type":"address"},{"name":"_version","type":"string"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"DOMAIN_SEPARATOR","inputs":[],"outputs":[{"name":"","type":"bytes32"}]},{"stateMutability":"view","type":"function","name":"nonces","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"name","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"symbol","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"lp_token","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"factory","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"working_balances","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"working_supply","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"period","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"period_timestamp","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"integrate_checkpoint_of","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"integrate_fraction","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"integrate_inv_supply","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"integrate_inv_supply_of","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"reward_count","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"reward_tokens","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"reward_data","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"distributor","type":"address"},{"name":"period_finish","type":"uint256"},{"name":"rate","type":"uint256"},{"name":"last_update","type":"uint256"},{"name":"integral","type":"uint256"}]}]},{"stateMutability":"view","type":"function","name":"rewards_receiver","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"reward_integral_for","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"is_killed","inputs":[],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"inflation_rate","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]}] -*/ \ No newline at end of file +*/ diff --git a/contracts/interfaces/balancer/IChildChainStreamer.sol b/contracts/interfaces/balancer/IChildChainStreamer.sol index 1cbf993..c9499a2 100644 --- a/contracts/interfaces/balancer/IChildChainStreamer.sol +++ b/contracts/interfaces/balancer/IChildChainStreamer.sol @@ -4,17 +4,10 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; interface IChildChainStreamer { - event RewardDistributorUpdated( - address indexed reward_token, - address distributor - ); + event RewardDistributorUpdated(address indexed reward_token, address distributor); event RewardDurationUpdated(address indexed reward_token, uint256 duration); - function add_reward( - address _token, - address _distributor, - uint256 _duration - ) external; + function add_reward(address _token, address _distributor, uint256 _duration) external; function remove_reward(address _token, address _recipient) external; @@ -24,10 +17,7 @@ interface IChildChainStreamer { function set_reward_duration(address _token, uint256 _duration) external; - function set_reward_distributor( - address _token, - address _distributor - ) external; + function set_reward_distributor(address _token, address _distributor) external; function initialize(address reward_receiver) external; diff --git a/contracts/interfaces/balancer/IRewardsOnlyGauge.sol b/contracts/interfaces/balancer/IRewardsOnlyGauge.sol index 44d6b69..2d33663 100644 --- a/contracts/interfaces/balancer/IRewardsOnlyGauge.sol +++ b/contracts/interfaces/balancer/IRewardsOnlyGauge.sol @@ -7,11 +7,7 @@ interface IRewardsOnlyGauge { event Deposit(address indexed provider, uint256 value); event Withdraw(address indexed provider, uint256 value); event Transfer(address indexed _from, address indexed _to, uint256 _value); - event Approval( - address indexed _owner, - address indexed _spender, - uint256 _value - ); + event Approval(address indexed _owner, address indexed _spender, uint256 _value); function decimals() external view returns (uint256); @@ -21,22 +17,13 @@ interface IRewardsOnlyGauge { function last_claim() external view returns (uint256); - function claimed_reward( - address _addr, - address _token - ) external view returns (uint256); + function claimed_reward(address _addr, address _token) external view returns (uint256); - function claimable_reward( - address _addr, - address _token - ) external view returns (uint256); + function claimable_reward(address _addr, address _token) external view returns (uint256); function reward_data(address _token) external view returns (S_0 memory); - function claimable_reward_write( - address _addr, - address _token - ) external returns (uint256); + function claimable_reward_write(address _addr, address _token) external returns (uint256); function set_rewards_receiver(address _receiver) external; @@ -50,11 +37,7 @@ interface IRewardsOnlyGauge { function deposit(uint256 _value, address _addr) external; - function deposit( - uint256 _value, - address _addr, - bool _claim_rewards - ) external; + function deposit(uint256 _value, address _addr, bool _claim_rewards) external; function withdraw(uint256 _value) external; @@ -62,16 +45,9 @@ interface IRewardsOnlyGauge { function transfer(address _to, uint256 _value) external returns (bool); - function transferFrom( - address _from, - address _to, - uint256 _value - ) external returns (bool); + function transferFrom(address _from, address _to, uint256 _value) external returns (bool); - function allowance( - address owner, - address spender - ) external view returns (uint256); + function allowance(address owner, address spender) external view returns (uint256); function approve(address _spender, uint256 _value) external returns (bool); @@ -85,27 +61,13 @@ interface IRewardsOnlyGauge { bytes32 _s ) external returns (bool); - function increaseAllowance( - address _spender, - uint256 _added_value - ) external returns (bool); + function increaseAllowance(address _spender, uint256 _added_value) external returns (bool); - function decreaseAllowance( - address _spender, - uint256 _subtracted_value - ) external returns (bool); + function decreaseAllowance(address _spender, uint256 _subtracted_value) external returns (bool); - function set_rewards( - address _reward_contract, - bytes32 _claim_sig, - address[8] memory _reward_tokens - ) external; + function set_rewards(address _reward_contract, bytes32 _claim_sig, address[8] memory _reward_tokens) external; - function initialize( - address _lp_token, - address _reward_contract, - bytes32 _claim_sig - ) external; + function initialize(address _lp_token, address _reward_contract, bytes32 _claim_sig) external; function lp_token() external view returns (address); @@ -131,10 +93,7 @@ interface IRewardsOnlyGauge { function reward_integral(address arg0) external view returns (uint256); - function reward_integral_for( - address arg0, - address arg1 - ) external view returns (uint256); + function reward_integral_for(address arg0, address arg1) external view returns (uint256); } struct S_0 { diff --git a/foundry.toml b/foundry.toml index 78e643e..0e9e332 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,9 +5,6 @@ libs = ['node_modules','lib'] test = 'foundry_test' solc = '0.8.25' -[fmt] -ignore = ['./contracts/**/*'] - [rpc_endpoints] arbitrum = "${ARBITRUM_RPC_URL}" base = "${BASE_RPC_URL}"