Skip to content

Commit

Permalink
Merge pull request #47 from BalancerMaxis/feat/linting
Browse files Browse the repository at this point in the history
chore: lint all files and remove ignore section from toml file
  • Loading branch information
Tritium-VLK authored Oct 19, 2024
2 parents d4639f5 + 658dd88 commit 2b8145a
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 456 deletions.
465 changes: 199 additions & 266 deletions contracts/ChildChainGaugeInjectorV2.sol

Large diffs are not rendered by default.

37 changes: 17 additions & 20 deletions contracts/injectorFactoryV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}
Expand Down
5 changes: 1 addition & 4 deletions contracts/interfaces/balancer/AuthorizerAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 1 addition & 5 deletions contracts/interfaces/balancer/IBALTokenHolder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
25 changes: 5 additions & 20 deletions contracts/interfaces/balancer/IBalancerMinter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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;

Expand Down
155 changes: 83 additions & 72 deletions contracts/interfaces/balancer/IChildChainGauge.sol

Large diffs are not rendered by default.

16 changes: 3 additions & 13 deletions contracts/interfaces/balancer/IChildChainStreamer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
65 changes: 12 additions & 53 deletions contracts/interfaces/balancer/IRewardsOnlyGauge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;

Expand All @@ -50,28 +37,17 @@ 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;

function withdraw(uint256 _value, bool _claim_rewards) external;

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

Expand All @@ -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);

Expand All @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 2b8145a

Please sign in to comment.