From 1f756b6d3d0e7f7a3bebb45b29f181388e1fc366 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 14:02:29 +0400 Subject: [PATCH 1/9] refactor: use brownie-token-tester ERC20 --- contracts/testing/ERC20.vy | 73 ------------------- tests/conftest.py | 32 ++++++-- .../test_deposit_withdraw_voting.py | 5 +- 3 files changed, 27 insertions(+), 83 deletions(-) delete mode 100644 contracts/testing/ERC20.vy diff --git a/contracts/testing/ERC20.vy b/contracts/testing/ERC20.vy deleted file mode 100644 index 900c2f29..00000000 --- a/contracts/testing/ERC20.vy +++ /dev/null @@ -1,73 +0,0 @@ -""" -@notice Mock ERC20 for testing -""" - -# @version 0.2.4 - -event Transfer: - _from: indexed(address) - _to: indexed(address) - _value: uint256 - -event Approval: - _owner: indexed(address) - _spender: indexed(address) - _value: uint256 - - -name: public(String[64]) -symbol: public(String[32]) -decimals: public(uint256) -balanceOf: public(HashMap[address, uint256]) -allowances: HashMap[address, HashMap[address, uint256]] -total_supply: uint256 - - -@external -def __init__(_name: String[64], _symbol: String[32], _decimals: uint256): - self.name = _name - self.symbol = _symbol - self.decimals = _decimals - - -@external -@view -def totalSupply() -> uint256: - return self.total_supply - - -@external -@view -def allowance(_owner : address, _spender : address) -> uint256: - return self.allowances[_owner][_spender] - - -@external -def transfer(_to : address, _value : uint256) -> bool: - self.balanceOf[msg.sender] -= _value - self.balanceOf[_to] += _value - log Transfer(msg.sender, _to, _value) - return True - - -@external -def transferFrom(_from : address, _to : address, _value : uint256) -> bool: - self.balanceOf[_from] -= _value - self.balanceOf[_to] += _value - self.allowances[_from][msg.sender] -= _value - log Transfer(_from, _to, _value) - return True - - -@external -def approve(_spender : address, _value : uint256) -> bool: - self.allowances[msg.sender][_spender] = _value - log Approval(msg.sender, _spender, _value) - return True - - -@external -def _mint_for_testing(_value: uint256): - self.total_supply += _value - self.balanceOf[msg.sender] += _value - log Transfer(ZERO_ADDRESS, msg.sender, _value) diff --git a/tests/conftest.py b/tests/conftest.py index 58f2eb4c..fb9a1c45 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,7 @@ USDNBurner, YBurner, ) +from brownie_tokens import ERC20 YEAR = 365 * 86400 INITIAL_RATE = 274_815_283 @@ -112,7 +113,7 @@ def gauge_proxy(GaugeProxy, alice, bob): @pytest.fixture(scope="module") def coin_reward(ERC20, accounts): - yield ERC20.deploy("YFIIIIII Funance", "YFIIIIII", 18, {"from": accounts[0]}) + yield ERC20("YFIIIIII Funance", "YFIIIIII", 18) @pytest.fixture(scope="module") @@ -154,14 +155,23 @@ def liquidity_gauge_reward( LiquidityGaugeReward, accounts, mock_lp_token, minter, reward_contract, coin_reward ): yield LiquidityGaugeReward.deploy( - mock_lp_token, minter, reward_contract, coin_reward, accounts[0], {"from": accounts[0]}, + mock_lp_token, + minter, + reward_contract, + coin_reward, + accounts[0], + {"from": accounts[0]}, ) @pytest.fixture(scope="module") def reward_gauge_wrapper(LiquidityGaugeRewardWrapper, accounts, liquidity_gauge_reward): yield LiquidityGaugeRewardWrapper.deploy( - "Tokenized Reward Gauge", "TG", liquidity_gauge_reward, accounts[0], {"from": accounts[0]}, + "Tokenized Reward Gauge", + "TG", + liquidity_gauge_reward, + accounts[0], + {"from": accounts[0]}, ) @@ -213,7 +223,13 @@ def vesting_simple(VestingEscrowSimple, accounts, vesting_factory, coin_a, start coin_a._mint_for_testing(10 ** 21, {"from": accounts[0]}) coin_a.transfer(vesting_factory, 10 ** 21, {"from": accounts[0]}) tx = vesting_factory.deploy_vesting_contract( - coin_a, accounts[1], 10 ** 20, True, 100000000, start_time, {"from": accounts[0]}, + coin_a, + accounts[1], + 10 ** 20, + True, + 100000000, + start_time, + {"from": accounts[0]}, ) yield VestingEscrowSimple.at(tx.new_contracts[0]) @@ -251,13 +267,13 @@ def burner(alice, bob, receiver, pool_proxy, request): @pytest.fixture(scope="module") -def coin_a(ERC20, accounts): - yield ERC20.deploy("Coin A", "USDA", 18, {"from": accounts[0]}) +def coin_a(): + yield ERC20("Coin A", "USDA", 18) @pytest.fixture(scope="module") -def coin_b(ERC20, accounts): - yield ERC20.deploy("Coin B", "USDB", 18, {"from": accounts[0]}) +def coin_b(): + yield ERC20("Coin B", "USDB", 18) @pytest.fixture(scope="module") diff --git a/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py b/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py index de6f92b7..7d735506 100644 --- a/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py +++ b/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py @@ -1,6 +1,7 @@ import brownie from brownie import chain, history from brownie.test import strategy +from brownie_tokens import ERC20 WEEK = 86400 * 7 MAX_TIME = 86400 * 365 * 4 @@ -186,8 +187,8 @@ def invariant_historic_balances(self): assert self.voting_escrow.totalSupplyAt(block_number) == total_supply -def test_state_machine(state_machine, accounts, ERC20, VotingEscrow): - token = ERC20.deploy("", "", 18, {"from": accounts[0]}) +def test_state_machine(state_machine, accounts, VotingEscrow): + token = ERC20("", "", 18) voting_escrow = VotingEscrow.deploy( token, "Voting-escrowed CRV", "veCRV", "veCRV_0.99", {"from": accounts[0]} ) From e4cd5974e5fd78c871ce918332cdc4c2544d7656 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 14:02:58 +0400 Subject: [PATCH 2/9] chore: bump deps --- .pre-commit-config.yaml | 2 +- README.md | 4 ++-- requirements.txt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 076d0fa2..89041459 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/README.md b/README.md index 104e70a9..79661653 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ View the [documentation](doc/readme.pdf) for a more in-depth explanation of how - [python3](https://www.python.org/downloads/release/python-368/) version 3.6 or greater, python3-dev - [vyper](https://github.com/vyperlang/vyper) version [0.2.4](https://github.com/vyperlang/vyper/releases/tag/v0.2.4) -- [brownie](https://github.com/iamdefinitelyahuman/brownie) - tested with version [1.13.0](https://github.com/eth-brownie/brownie/releases/tag/v1.13.0) -- [brownie-token-tester](https://github.com/iamdefinitelyahuman/brownie-token-tester) - tested with version [0.1.0](https://github.com/iamdefinitelyahuman/brownie-token-tester/releases/tag/v0.1.0) +- [brownie](https://github.com/iamdefinitelyahuman/brownie) - tested with version [1.14.6](https://github.com/eth-brownie/brownie/releases/tag/v1.14.6) +- [brownie-token-tester](https://github.com/iamdefinitelyahuman/brownie-token-tester) - tested with version [0.2.2](https://github.com/iamdefinitelyahuman/brownie-token-tester/releases/tag/v0.2.2) - [ganache-cli](https://github.com/trufflesuite/ganache-cli) - tested with version [6.12.1](https://github.com/trufflesuite/ganache-cli/releases/tag/v6.12.1) ### Setup diff --git a/requirements.txt b/requirements.txt index fbad2445..85916186 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -black==19.10b0 -eth-brownie>=1.13.0,<2.0.0 +black==20.8b1 +eth-brownie>=1.14.6,<2.0.0 flake8==3.8.4 isort==5.7.0 -brownie-token-tester>=0.1.0 +brownie-token-tester>=0.2.2 From c3ac0eb39edf4286e9bbb2610753000d0131a460 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 14:39:45 +0400 Subject: [PATCH 3/9] chore: linting --- scripts/burners/deploy_burners_fee_distro.py | 2 +- scripts/burners/simulate_fee_distro.py | 2 +- scripts/deployment/deploy_dao.py | 6 +- scripts/deployment/deploy_testnet.py | 61 +++++++------------ scripts/deployment/vest_lp_tokens.py | 26 +++----- tests/fork/Burners/test_btc_burner.py | 2 +- tests/fork/Burners/test_eth_burner.py | 2 +- tests/fork/Burners/test_euro_burner.py | 2 +- tests/fork/Burners/test_metaburner.py | 2 +- tests/fork/Burners/test_synth_burner.py | 2 +- tests/fork/Burners/test_usdn_burner.py | 2 +- tests/fork/Burners/test_yburner.py | 2 +- .../ERC20CRV/test_mint_integration.py | 4 +- .../ERC20CRV/test_mintable_in_timeframe.py | 4 +- .../GaugeController/test_vote_weight.py | 2 +- .../test_borked_rewards.py | 8 ++- .../test_rewards_ratio.py | 8 ++- .../test_rewards_total.py | 7 ++- .../test_liquidity_gauge_v3.py | 9 ++- .../test_rewards_total_transferred_in.py | 6 +- .../VotingEscrow/test_voting_escrow.py | 8 ++- tests/unitary/ERC20CRV/test_mint.py | 6 +- .../FeeDistribution/test_kill_fee_distro.py | 2 +- .../test_set_rewards_gauge_proxy.py | 4 +- .../test_claim_rewards.py | 2 +- .../test_deposit_withdraw.py | 10 +-- .../test_claim_rewards_multiple.py | 6 +- .../LiquidityGaugeV2/test_set_rewards.py | 2 +- .../test_set_rewards_deposit.py | 4 +- .../test_set_rewards_no_deposit.py | 4 +- .../test_claim_rewards_multiple.py | 6 +- .../LiquidityGaugeV3/test_set_rewards.py | 4 +- .../test_set_rewards_deposit.py | 4 +- .../test_set_rewards_no_deposit.py | 4 +- .../test_set_rewards_receiver.py | 4 +- .../test_claim_tokens.py | 4 +- .../test_deposit_withdraw.py | 2 +- .../LiquidityGaugeWrapper/test_transfer.py | 4 +- .../test_transferFrom.py | 4 +- .../test_claim_tokens.py | 4 +- .../test_deposit_withdraw.py | 2 +- .../test_transfer.py | 4 +- .../test_transferFrom.py | 4 +- .../LiquidityGaugeWrapperUnit/test_vault.py | 2 +- tests/unitary/PoolProxy/test_proxy_burn.py | 6 +- .../test_claim_no_reward_contract.py | 4 +- .../test_claim_rewards_multiple.py | 2 +- .../RewardsOnlyGauge/test_set_rewards.py | 4 +- .../test_set_rewards_receiver.py | 2 +- .../test_deploy_escrow.py | 4 +- 50 files changed, 132 insertions(+), 149 deletions(-) diff --git a/scripts/burners/deploy_burners_fee_distro.py b/scripts/burners/deploy_burners_fee_distro.py index 2a5bdc69..0f8943cd 100644 --- a/scripts/burners/deploy_burners_fee_distro.py +++ b/scripts/burners/deploy_burners_fee_distro.py @@ -128,7 +128,7 @@ def main(deployer=DEPLOYER): # approve USDN burner to donate to USDN pool proxy.set_donate_approval( - "0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1", usdn_burner, True, {"from": deployer}, + "0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1", usdn_burner, True, {"from": deployer} ) # set PoolProxy ownership diff --git a/scripts/burners/simulate_fee_distro.py b/scripts/burners/simulate_fee_distro.py index 3ee3f4fb..b6e673ef 100644 --- a/scripts/burners/simulate_fee_distro.py +++ b/scripts/burners/simulate_fee_distro.py @@ -17,7 +17,7 @@ def main(): # transfer 2m USD of 3CRV fee_token.mint( - distributor, 2000000 * 10 ** 18, {"from": "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7"}, + distributor, 2000000 * 10 ** 18, {"from": "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7"} ) distributor.checkpoint_token() diff --git a/scripts/deployment/deploy_dao.py b/scripts/deployment/deploy_dao.py index 70bd6f00..5fcb7112 100644 --- a/scripts/deployment/deploy_dao.py +++ b/scripts/deployment/deploy_dao.py @@ -61,7 +61,7 @@ def live_part_two(): voting_escrow = VotingEscrow.at(deployments["VotingEscrow"]) deploy_part_two( - admin, token, voting_escrow, config.REQUIRED_CONFIRMATIONS, config.DEPLOYMENTS_JSON, + admin, token, voting_escrow, config.REQUIRED_CONFIRMATIONS, config.DEPLOYMENTS_JSON ) @@ -116,9 +116,9 @@ def deploy_part_two(admin, token, voting_escrow, confs=1, deployments_json=None) gauge_controller.add_gauge(gauge, 0, weight, {"from": admin, "required_confs": confs}) deployments["LiquidityGauge"][name] = gauge.address - for (name, (lp_token, reward_claim, reward_token, weight),) in REWARD_POOL_TOKENS.items(): + for (name, (lp_token, reward_claim, reward_token, weight)) in REWARD_POOL_TOKENS.items(): gauge = LiquidityGaugeReward.deploy( - lp_token, minter, reward_claim, reward_token, {"from": admin, "required_confs": confs}, + lp_token, minter, reward_claim, reward_token, {"from": admin, "required_confs": confs} ) gauge_controller.add_gauge(gauge, 0, weight, {"from": admin, "required_confs": confs}) deployments["LiquidityGaugeReward"][name] = gauge.address diff --git a/scripts/deployment/deploy_testnet.py b/scripts/deployment/deploy_testnet.py index c40e9b0e..b1bcc5d3 100644 --- a/scripts/deployment/deploy_testnet.py +++ b/scripts/deployment/deploy_testnet.py @@ -59,15 +59,15 @@ def save_abi(contract, name): def deploy_erc20s_and_pool(deployer): coin_a = repeat(ERC20.deploy, "Coin A", "USDA", 18, {"from": deployer, "required_confs": CONFS}) repeat( - coin_a._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS}, + coin_a._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS} ) coin_b = repeat(ERC20.deploy, "Coin B", "USDB", 18, {"from": deployer, "required_confs": CONFS}) repeat( - coin_b._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS}, + coin_b._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS} ) lp_token = repeat( - ERC20LP.deploy, "Some pool", "cPool", 18, 0, {"from": deployer, "required_confs": CONFS}, + ERC20LP.deploy, "Some pool", "cPool", 18, 0, {"from": deployer, "required_confs": CONFS} ) save_abi(lp_token, "lp_token") pool = repeat( @@ -101,17 +101,10 @@ def deploy_erc20s_and_pool(deployer): ) repeat( - pool.commit_transfer_ownership, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS}, + pool.commit_transfer_ownership, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS} ) repeat(pool.apply_transfer_ownership, {"from": deployer, "required_confs": CONFS}) - # repeat( - # registry.commit_transfer_ownership, - # ARAGON_AGENT, - # {"from": deployer, "required_confs": CONFS}, - # ) - # repeat(registry.apply_transfer_ownership, {"from": deployer, "required_confs": CONFS}) - return [lp_token, coin_a] @@ -130,15 +123,15 @@ def main(): coin_a = repeat(ERC20.deploy, "Coin A", "USDA", 18, {"from": deployer, "required_confs": CONFS}) repeat( - coin_a._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS}, + coin_a._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS} ) coin_b = repeat(ERC20.deploy, "Coin B", "USDB", 18, {"from": deployer, "required_confs": CONFS}) repeat( - coin_b._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS}, + coin_b._mint_for_testing, 10 ** 9 * 10 ** 18, {"from": deployer, "required_confs": CONFS} ) lp_token = repeat( - ERC20LP.deploy, "Some pool", "cPool", 18, 0, {"from": deployer, "required_confs": CONFS}, + ERC20LP.deploy, "Some pool", "cPool", 18, 0, {"from": deployer, "required_confs": CONFS} ) save_abi(lp_token, "lp_token") pool = repeat( @@ -166,14 +159,12 @@ def main(): ) contract = repeat( - CurveRewards.deploy, lp_token, coin_a, {"from": accounts[0], "required_confs": CONFS}, - ) - repeat( - contract.setRewardDistribution, accounts[0], {"from": accounts[0], "required_confs": CONFS}, + CurveRewards.deploy, lp_token, coin_a, {"from": accounts[0], "required_confs": CONFS} ) repeat( - coin_a.transfer, contract, 100e18, {"from": accounts[0], "required_confs": CONFS}, + contract.setRewardDistribution, accounts[0], {"from": accounts[0], "required_confs": CONFS} ) + repeat(coin_a.transfer, contract, 100e18, {"from": accounts[0], "required_confs": CONFS}) liquidity_gauge_rewards = repeat( LiquidityGaugeReward.deploy, @@ -190,7 +181,7 @@ def main(): coin_a = coins[1] token = repeat( - ERC20CRV.deploy, "Curve DAO Token", "CRV", 18, {"from": deployer, "required_confs": CONFS}, + ERC20CRV.deploy, "Curve DAO Token", "CRV", 18, {"from": deployer, "required_confs": CONFS} ) save_abi(token, "token_crv") @@ -204,9 +195,7 @@ def main(): ) save_abi(escrow, "voting_escrow") - repeat( - escrow.changeController, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS}, - ) + repeat(escrow.changeController, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS}) for account in DISTRIBUTION_ADDRESSES: repeat( @@ -217,29 +206,27 @@ def main(): ) gauge_controller = repeat( - GaugeController.deploy, token, escrow, {"from": deployer, "required_confs": CONFS}, + GaugeController.deploy, token, escrow, {"from": deployer, "required_confs": CONFS} ) save_abi(gauge_controller, "gauge_controller") minter = repeat( - Minter.deploy, token, gauge_controller, {"from": deployer, "required_confs": CONFS}, + Minter.deploy, token, gauge_controller, {"from": deployer, "required_confs": CONFS} ) save_abi(minter, "minter") liquidity_gauge = repeat( - LiquidityGauge.deploy, lp_token, minter, {"from": deployer, "required_confs": CONFS}, + LiquidityGauge.deploy, lp_token, minter, {"from": deployer, "required_confs": CONFS} ) save_abi(liquidity_gauge, "liquidity_gauge") contract = repeat( - CurveRewards.deploy, lp_token, coin_a, {"from": accounts[0], "required_confs": CONFS}, + CurveRewards.deploy, lp_token, coin_a, {"from": accounts[0], "required_confs": CONFS} ) repeat( - contract.setRewardDistribution, accounts[0], {"from": accounts[0], "required_confs": CONFS}, - ) - repeat( - coin_a.transfer, contract, 100e18, {"from": accounts[0], "required_confs": CONFS}, + contract.setRewardDistribution, accounts[0], {"from": accounts[0], "required_confs": CONFS} ) + repeat(coin_a.transfer, contract, 100e18, {"from": accounts[0], "required_confs": CONFS}) liquidity_gauge_rewards = repeat( LiquidityGaugeReward.deploy, @@ -251,9 +238,7 @@ def main(): ) repeat(token.set_minter, minter, {"from": deployer, "required_confs": CONFS}) - repeat( - gauge_controller.add_type, b"Liquidity", {"from": deployer, "required_confs": CONFS}, - ) + repeat(gauge_controller.add_type, b"Liquidity", {"from": deployer, "required_confs": CONFS}) repeat( gauge_controller.change_type_weight, 0, @@ -269,7 +254,7 @@ def main(): ) repeat( - gauge_controller.add_type, b"LiquidityRewards", {"from": deployer, "required_confs": CONFS}, + gauge_controller.add_type, b"LiquidityRewards", {"from": deployer, "required_confs": CONFS} ) repeat( gauge_controller.change_type_weight, @@ -290,11 +275,9 @@ def main(): ARAGON_AGENT, {"from": deployer, "required_confs": CONFS}, ) + repeat(gauge_controller.apply_transfer_ownership, {"from": deployer, "required_confs": CONFS}) repeat( - gauge_controller.apply_transfer_ownership, {"from": deployer, "required_confs": CONFS}, - ) - repeat( - escrow.commit_transfer_ownership, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS}, + escrow.commit_transfer_ownership, ARAGON_AGENT, {"from": deployer, "required_confs": CONFS} ) repeat(escrow.apply_transfer_ownership, {"from": deployer, "required_confs": CONFS}) diff --git a/scripts/deployment/vest_lp_tokens.py b/scripts/deployment/vest_lp_tokens.py index b61235c0..e91d0467 100644 --- a/scripts/deployment/vest_lp_tokens.py +++ b/scripts/deployment/vest_lp_tokens.py @@ -133,17 +133,13 @@ def vest_tokens(admin, funding_admins, token_address, confs): vested_amounts[i][1] -= 1 tx = token.approve(vesting_escrow, TOTAL_AMOUNT, {"from": admin, "required_confs": confs}) - _log_tx( - txid=tx.txid, fn_name=tx.fn_name, spender=vesting_escrow.address, amount=TOTAL_AMOUNT, - ) + _log_tx(txid=tx.txid, fn_name=tx.fn_name, spender=vesting_escrow.address, amount=TOTAL_AMOUNT) tx = vesting_escrow.add_tokens(TOTAL_AMOUNT, {"from": admin, "required_confs": confs}) - _log_tx( - txid=tx.txid, fn_name=tx.fn_name, amount=TOTAL_AMOUNT, - ) + _log_tx(txid=tx.txid, fn_name=tx.fn_name, amount=TOTAL_AMOUNT) # convert vested_amounts into input args for `VestingEscrow.fund` calls fund_arguments = [ - ([x[0] for x in vested_amounts[i : i + 100]], [x[1] for x in vested_amounts[i : i + 100]],) + ([x[0] for x in vested_amounts[i : i + 100]], [x[1] for x in vested_amounts[i : i + 100]]) for i in range(0, len(vested_amounts), 100) ] @@ -158,7 +154,7 @@ def vest_tokens(admin, funding_admins, token_address, confs): funding_threads = [] for acct in [admin] + funding_admins: thread = threading.Thread( - target=_fund_accounts, args=(acct, vesting_escrow, fund_arguments, confs), + target=_fund_accounts, args=(acct, vesting_escrow, fund_arguments, confs) ) funding_threads.append(thread) thread.start() @@ -168,19 +164,13 @@ def vest_tokens(admin, funding_admins, token_address, confs): # burn all the admin accounts! tx = vesting_escrow.disable_fund_admins({"from": admin, "required_confs": confs}) - _log_tx( - txid=tx.txid, fn_name=tx.fn_name, - ) + _log_tx(txid=tx.txid, fn_name=tx.fn_name) vesting_escrow.commit_transfer_ownership( - "0x000000000000000000000000000000000000dead", {"from": admin, "required_confs": confs}, - ) - _log_tx( - txid=tx.txid, fn_name=tx.fn_name, + "0x000000000000000000000000000000000000dead", {"from": admin, "required_confs": confs} ) + _log_tx(txid=tx.txid, fn_name=tx.fn_name) vesting_escrow.apply_transfer_ownership({"from": admin, "required_confs": confs}) - _log_tx( - txid=tx.txid, fn_name=tx.fn_name, - ) + _log_tx(txid=tx.txid, fn_name=tx.fn_name) gas_used = sum(i.gas_used for i in history[start_idx:]) print(f"Distribution complete! Total gas used: {gas_used}") diff --git a/tests/fork/Burners/test_btc_burner.py b/tests/fork/Burners/test_btc_burner.py index d411a8e1..adb478dc 100644 --- a/tests/fork/Burners/test_btc_burner.py +++ b/tests/fork/Burners/test_btc_burner.py @@ -20,7 +20,7 @@ def burner(BTCBurner, alice, receiver): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance, + MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance ): coin = MintableTestToken(token) amount = 10 ** coin.decimals() diff --git a/tests/fork/Burners/test_eth_burner.py b/tests/fork/Burners/test_eth_burner.py index 9889307b..868965d8 100644 --- a/tests/fork/Burners/test_eth_burner.py +++ b/tests/fork/Burners/test_eth_burner.py @@ -18,7 +18,7 @@ def burner(ETHBurner, alice, receiver): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance, + MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance ): coin = MintableTestToken(token) amount = 10 ** coin.decimals() diff --git a/tests/fork/Burners/test_euro_burner.py b/tests/fork/Burners/test_euro_burner.py index ad8cdf79..97ea3456 100644 --- a/tests/fork/Burners/test_euro_burner.py +++ b/tests/fork/Burners/test_euro_burner.py @@ -16,7 +16,7 @@ def burner(EuroBurner, alice, receiver): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance, + MintableTestToken, SUSD, alice, receiver, burner, token, burner_balance, caller_balance ): coin = MintableTestToken(token) amount = 10 ** coin.decimals() diff --git a/tests/fork/Burners/test_metaburner.py b/tests/fork/Burners/test_metaburner.py index 90c9fa3b..ff76a2ea 100644 --- a/tests/fork/Burners/test_metaburner.py +++ b/tests/fork/Burners/test_metaburner.py @@ -22,7 +22,7 @@ def burner(MetaBurner, alice, receiver): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - MintableTestToken, ThreeCRV, alice, receiver, burner, token, burner_balance, caller_balance, + MintableTestToken, ThreeCRV, alice, receiver, burner, token, burner_balance, caller_balance ): wrapped = MintableTestToken(token) amount = 10 ** wrapped.decimals() diff --git a/tests/fork/Burners/test_synth_burner.py b/tests/fork/Burners/test_synth_burner.py index 799e998a..19c874f3 100644 --- a/tests/fork/Burners/test_synth_burner.py +++ b/tests/fork/Burners/test_synth_burner.py @@ -48,7 +48,7 @@ def burner(SynthBurner, alice, receiver): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - MintableTestToken, SUSD, alice, receiver, burner, token, target, burner_balance, caller_balance, + MintableTestToken, SUSD, alice, receiver, burner, token, target, burner_balance, caller_balance ): if token == ETH_ADDRESS: coin = token diff --git a/tests/fork/Burners/test_usdn_burner.py b/tests/fork/Burners/test_usdn_burner.py index 28ee8fbf..a6ab6def 100644 --- a/tests/fork/Burners/test_usdn_burner.py +++ b/tests/fork/Burners/test_usdn_burner.py @@ -32,7 +32,7 @@ def USDN(MintableTestToken): @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap( - USDN, ThreeCRV, alice, receiver, burner, burner_balance, caller_balance, swap, pool_proxy, + USDN, ThreeCRV, alice, receiver, burner, burner_balance, caller_balance, swap, pool_proxy ): amount = 0 diff --git a/tests/fork/Burners/test_yburner.py b/tests/fork/Burners/test_yburner.py index d038dfa3..60b99460 100644 --- a/tests/fork/Burners/test_yburner.py +++ b/tests/fork/Burners/test_yburner.py @@ -55,7 +55,7 @@ def test_unwrap(MintableTestToken, alice, receiver, burner, token, burner_balanc @pytest.mark.parametrize("burner_balance", (True, False)) @pytest.mark.parametrize("caller_balance", (True, False)) def test_swap_and_unwrap( - MintableTestToken, USDC, alice, receiver, burner, token, burner_balance, caller_balance, + MintableTestToken, USDC, alice, receiver, burner, token, burner_balance, caller_balance ): wrapped = MintableTestToken(token) amount = 10 ** wrapped.decimals() diff --git a/tests/integration/ERC20CRV/test_mint_integration.py b/tests/integration/ERC20CRV/test_mint_integration.py index 4b635ec0..63279ee1 100644 --- a/tests/integration/ERC20CRV/test_mint_integration.py +++ b/tests/integration/ERC20CRV/test_mint_integration.py @@ -34,9 +34,7 @@ def test_overmint(accounts, chain, token, duration): chain.sleep(duration) with brownie.reverts("dev: exceeds allowable mint amount"): - token.mint( - accounts[1], (chain.time() - creation_time + 2) * rate, {"from": accounts[0]}, - ) + token.mint(accounts[1], (chain.time() - creation_time + 2) * rate, {"from": accounts[0]}) @given(durations=strategy("uint[5]", min_value=YEAR * 0.33, max_value=YEAR * 0.9)) diff --git a/tests/integration/ERC20CRV/test_mintable_in_timeframe.py b/tests/integration/ERC20CRV/test_mintable_in_timeframe.py index 9217cdfa..53676f69 100644 --- a/tests/integration/ERC20CRV/test_mintable_in_timeframe.py +++ b/tests/integration/ERC20CRV/test_mintable_in_timeframe.py @@ -42,9 +42,7 @@ def test_random_range_year_one(token, chain, accounts, time1, time2): assert token.mintable_in_timeframe(start, end) == rate * (end - start) -@given( - start=strategy("uint", max_value=YEAR * 6), duration=strategy("uint", max_value=YEAR), -) +@given(start=strategy("uint", max_value=YEAR * 6), duration=strategy("uint", max_value=YEAR)) def test_random_range_multiple_epochs(token, chain, accounts, start, duration): creation_time = token.start_epoch_time() start += creation_time diff --git a/tests/integration/GaugeController/test_vote_weight.py b/tests/integration/GaugeController/test_vote_weight.py index 49ebe0ac..16c2c8be 100644 --- a/tests/integration/GaugeController/test_vote_weight.py +++ b/tests/integration/GaugeController/test_vote_weight.py @@ -29,7 +29,7 @@ def setup(gauge_controller, accounts, three_gauges, token, voting_escrow): ) @settings(max_examples=10) def test_gauge_weight_vote( - accounts, gauge_controller, three_gauges, voting_escrow, st_deposits, st_length, st_votes, + accounts, gauge_controller, three_gauges, voting_escrow, st_deposits, st_length, st_votes ): """ Test that gauge weights correctly adjust over time. diff --git a/tests/integration/LiquidityGaugeReward/test_borked_rewards.py b/tests/integration/LiquidityGaugeReward/test_borked_rewards.py index c0807ad6..45ab5dfd 100644 --- a/tests/integration/LiquidityGaugeReward/test_borked_rewards.py +++ b/tests/integration/LiquidityGaugeReward/test_borked_rewards.py @@ -19,7 +19,13 @@ def initial_setup(accounts, reward_contract, mock_lp_token, liquidity_gauge_rewa ) @settings(max_examples=10) def test_withdraw_borked_rewards( - accounts, chain, reward_contract, mock_lp_token, liquidity_gauge_reward, amounts, durations, + accounts, + chain, + reward_contract, + mock_lp_token, + liquidity_gauge_reward, + amounts, + durations, ): for i, (amount, duration) in enumerate(zip(amounts, durations), start=1): liquidity_gauge_reward.deposit(amount, {"from": accounts[i]}) diff --git a/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py b/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py index 96719429..48f380b3 100644 --- a/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py +++ b/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py @@ -7,7 +7,13 @@ @given(values=strategy("uint[8]", min_value=1, max_value=10 ** 21)) @settings(max_examples=25) def test_ratio_equality( - chain, accounts, liquidity_gauge_reward, mock_lp_token, reward_contract, coin_reward, values, + chain, + accounts, + liquidity_gauge_reward, + mock_lp_token, + reward_contract, + coin_reward, + values, ): N_acc = len(values) diff --git a/tests/integration/LiquidityGaugeReward/test_rewards_total.py b/tests/integration/LiquidityGaugeReward/test_rewards_total.py index 10dd871c..2aff0938 100644 --- a/tests/integration/LiquidityGaugeReward/test_rewards_total.py +++ b/tests/integration/LiquidityGaugeReward/test_rewards_total.py @@ -16,7 +16,12 @@ class StateMachine: st_reward = strategy("uint64") def __init__( - self, accounts, liquidity_gauge_reward, mock_lp_token, reward_contract, coin_reward, + self, + accounts, + liquidity_gauge_reward, + mock_lp_token, + reward_contract, + coin_reward, ): self.accounts = accounts self.token = mock_lp_token diff --git a/tests/integration/LiquidityGaugeV3/test_liquidity_gauge_v3.py b/tests/integration/LiquidityGaugeV3/test_liquidity_gauge_v3.py index 1741f9af..006ef348 100644 --- a/tests/integration/LiquidityGaugeV3/test_liquidity_gauge_v3.py +++ b/tests/integration/LiquidityGaugeV3/test_liquidity_gauge_v3.py @@ -104,7 +104,14 @@ def update_integral(): def test_mining_with_votelock( - accounts, chain, history, mock_lp_token, token, gauge_v3, gauge_controller, voting_escrow, + accounts, + chain, + history, + mock_lp_token, + token, + gauge_v3, + gauge_controller, + voting_escrow, ): alice, bob = accounts[:2] chain.sleep(2 * WEEK + 5) diff --git a/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py b/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py index 23ee4aa8..857d367b 100644 --- a/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py +++ b/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py @@ -16,7 +16,11 @@ class StateMachine: st_reward = strategy("uint64") def __init__( - self, accounts, rewards_only_gauge, mock_lp_token, coin_reward, + self, + accounts, + rewards_only_gauge, + mock_lp_token, + coin_reward, ): self.accounts = accounts self.token = mock_lp_token diff --git a/tests/integration/VotingEscrow/test_voting_escrow.py b/tests/integration/VotingEscrow/test_voting_escrow.py index 8bf682dc..d4c08a7d 100644 --- a/tests/integration/VotingEscrow/test_voting_escrow.py +++ b/tests/integration/VotingEscrow/test_voting_escrow.py @@ -74,10 +74,14 @@ def test_voting_powers(web3, chain, accounts, token, voting_escrow): chain.mine() dt = chain[-1].timestamp - t0 assert approx( - voting_escrow.totalSupply(), amount // MAXTIME * max(WEEK - 2 * H - dt, 0), TOL, + voting_escrow.totalSupply(), + amount // MAXTIME * max(WEEK - 2 * H - dt, 0), + TOL, ) assert approx( - voting_escrow.balanceOf(alice), amount // MAXTIME * max(WEEK - 2 * H - dt, 0), TOL, + voting_escrow.balanceOf(alice), + amount // MAXTIME * max(WEEK - 2 * H - dt, 0), + TOL, ) assert voting_escrow.balanceOf(bob) == 0 stages["alice_in_0"].append((web3.eth.blockNumber, chain[-1].timestamp)) diff --git a/tests/unitary/ERC20CRV/test_mint.py b/tests/unitary/ERC20CRV/test_mint.py index 4ee410c6..1db4f1b2 100644 --- a/tests/unitary/ERC20CRV/test_mint.py +++ b/tests/unitary/ERC20CRV/test_mint.py @@ -1,9 +1,9 @@ import brownie import pytest +from brownie import ZERO_ADDRESS WEEK = 86400 * 7 YEAR = 365 * 86400 -ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" @pytest.fixture(scope="module", autouse=True) @@ -44,9 +44,7 @@ def test_overmint(accounts, chain, token): chain.sleep(WEEK) with brownie.reverts("dev: exceeds allowable mint amount"): - token.mint( - accounts[1], (chain.time() - creation_time + 2) * rate, {"from": accounts[0]}, - ) + token.mint(accounts[1], (chain.time() - creation_time + 2) * rate, {"from": accounts[0]}) def test_minter_only(accounts, token): diff --git a/tests/unitary/FeeDistribution/test_kill_fee_distro.py b/tests/unitary/FeeDistribution/test_kill_fee_distro.py index a83a35a9..347d74d8 100644 --- a/tests/unitary/FeeDistribution/test_kill_fee_distro.py +++ b/tests/unitary/FeeDistribution/test_kill_fee_distro.py @@ -5,7 +5,7 @@ @pytest.fixture(scope="module") def fee_distributor(FeeDistributor, accounts, chain, voting_escrow, coin_a): yield FeeDistributor.deploy( - voting_escrow, chain.time(), coin_a, accounts[0], accounts[1], {"from": accounts[0]}, + voting_escrow, chain.time(), coin_a, accounts[0], accounts[1], {"from": accounts[0]} ) diff --git a/tests/unitary/GaugeProxy/test_set_rewards_gauge_proxy.py b/tests/unitary/GaugeProxy/test_set_rewards_gauge_proxy.py index 3cdb3ed6..db7beafa 100644 --- a/tests/unitary/GaugeProxy/test_set_rewards_gauge_proxy.py +++ b/tests/unitary/GaugeProxy/test_set_rewards_gauge_proxy.py @@ -20,7 +20,7 @@ def test_set_rewards(alice, gauge_proxy, gauge_v2, reward_contract, coin_reward) sigs = f"0x{sigs[0]}{sigs[1]}{sigs[2]}{'00' * 20}" gauge_proxy.set_rewards( - gauge_v2, reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}, + gauge_v2, reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice} ) assert gauge_v2.reward_contract() == reward_contract assert gauge_v2.reward_tokens(0) == coin_reward @@ -31,5 +31,5 @@ def test_only_ownership_admin(accounts, gauge_proxy, gauge_v2, reward_contract, with brownie.reverts("Access denied"): gauge_proxy.set_rewards( - gauge_v2, reward_contract, "0x00", [ZERO_ADDRESS] * 8, {"from": accounts[idx]}, + gauge_v2, reward_contract, "0x00", [ZERO_ADDRESS] * 8, {"from": accounts[idx]} ) diff --git a/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py b/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py index a4ba8563..37291bc7 100644 --- a/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py +++ b/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py @@ -55,7 +55,7 @@ def test_claim_for_other_no_reward(accounts, chain, liquidity_gauge_reward, coin def test_claim_two_lp( - accounts, chain, liquidity_gauge_reward, mock_lp_token, coin_reward, no_call_coverage, + accounts, chain, liquidity_gauge_reward, mock_lp_token, coin_reward, no_call_coverage ): # Deposit diff --git a/tests/unitary/LiquidityGaugeRewardWrapper/test_deposit_withdraw.py b/tests/unitary/LiquidityGaugeRewardWrapper/test_deposit_withdraw.py index 9ac5f81c..b5398432 100644 --- a/tests/unitary/LiquidityGaugeRewardWrapper/test_deposit_withdraw.py +++ b/tests/unitary/LiquidityGaugeRewardWrapper/test_deposit_withdraw.py @@ -21,7 +21,7 @@ def setup( def test_deposit( - accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token, + accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token ): balance = mock_lp_token.balanceOf(accounts[0]) reward_gauge_wrapper.deposit(100000, {"from": accounts[0]}) @@ -38,7 +38,7 @@ def test_deposit( def test_deposit_zero( - accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token, + accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token ): balance = mock_lp_token.balanceOf(accounts[0]) liquidity_gauge_reward.deposit(0, {"from": accounts[0]}) @@ -60,7 +60,7 @@ def test_deposit_insufficient_balance(accounts, reward_gauge_wrapper): def test_withdraw( - accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token, + accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token ): balance = mock_lp_token.balanceOf(accounts[0]) @@ -79,7 +79,7 @@ def test_withdraw( def test_withdraw_zero( - accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token, + accounts, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token ): balance = mock_lp_token.balanceOf(accounts[0]) reward_gauge_wrapper.deposit(100000, {"from": accounts[0]}) @@ -97,7 +97,7 @@ def test_withdraw_zero( def test_withdraw_new_epoch( - accounts, chain, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token, + accounts, chain, liquidity_gauge_reward, reward_gauge_wrapper, reward_contract, mock_lp_token ): balance = mock_lp_token.balanceOf(accounts[0]) diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py index 85bc419e..ceaa3615 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py @@ -41,13 +41,13 @@ def reward_contract(alice, coin_a, coin_b): @pytest.fixture(scope="module", autouse=True) def initial_setup( - alice, bob, chain, gauge_v2, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token, + alice, bob, chain, gauge_v2, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.claim_tokens.signature[2:]}{'00' * 20}" gauge_v2.set_rewards( - reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) # Deposit @@ -94,7 +94,7 @@ def test_claim_for_other_no_reward(bob, charlie, chain, gauge_v2, coin_a, coin_b def test_claim_two_lp( - alice, bob, chain, gauge_v2, mock_lp_token, coin_a, coin_b, reward_contract, no_call_coverage, + alice, bob, chain, gauge_v2, mock_lp_token, coin_a, coin_b, reward_contract, no_call_coverage ): # Deposit diff --git a/tests/unitary/LiquidityGaugeV2/test_set_rewards.py b/tests/unitary/LiquidityGaugeV2/test_set_rewards.py index f4d41333..aef9e5f0 100644 --- a/tests/unitary/LiquidityGaugeV2/test_set_rewards.py +++ b/tests/unitary/LiquidityGaugeV2/test_set_rewards.py @@ -51,7 +51,7 @@ def test_multiple_reward_tokens(alice, coin_reward, coin_a, coin_b, reward_contr def test_modify_reward_tokens_less(alice, coin_reward, coin_a, coin_b, reward_contract, gauge_v2): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.getReward.signature[2:]}{'00' * 20}" gauge_v2.set_rewards( - reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) reward_tokens = [coin_a] + [ZERO_ADDRESS] * 7 diff --git a/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py b/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py index 07963296..2a38bbbe 100644 --- a/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py +++ b/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py @@ -75,7 +75,7 @@ def test_modify_no_deposit_no_ts(reward_contract_2, alice, gauge_v2, coin_a): def test_modify_no_deposit( - reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) @@ -93,7 +93,7 @@ def test_modify_no_deposit( def test_modify_deposit( - reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) diff --git a/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py b/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py index 8da1f2c6..4720a147 100644 --- a/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py +++ b/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py @@ -49,7 +49,7 @@ def test_modify_no_deposit_no_ts(reward_contract_2, alice, gauge_v2, coin_a, moc def test_modify_no_deposit( - reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) @@ -66,7 +66,7 @@ def test_modify_no_deposit( def test_modify_deposit( - reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) diff --git a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py index 4434acd6..9aeefb50 100644 --- a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py +++ b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py @@ -44,13 +44,13 @@ def reward_contract(alice, coin_a, coin_b): @pytest.fixture(scope="module", autouse=True) def initial_setup( - alice, bob, chain, gauge_v3, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token, + alice, bob, chain, gauge_v3, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.claim_tokens.signature[2:]}{'00' * 20}" gauge_v3.set_rewards( - reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) # Deposit @@ -110,7 +110,7 @@ def test_claim_for_other_no_reward(bob, charlie, chain, gauge_v3, coin_a, coin_b def test_claim_two_lp( - alice, bob, chain, gauge_v3, mock_lp_token, coin_a, coin_b, reward_contract, no_call_coverage, + alice, bob, chain, gauge_v3, mock_lp_token, coin_a, coin_b, reward_contract, no_call_coverage ): # Deposit diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards.py index f98c0c77..fe4b0967 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards.py @@ -51,7 +51,7 @@ def test_multiple_reward_tokens(alice, coin_reward, coin_a, coin_b, reward_contr def test_modify_reward_tokens_less(alice, coin_reward, coin_a, coin_b, reward_contract, gauge_v3): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.getReward.signature[2:]}{'00' * 20}" gauge_v3.set_rewards( - reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) reward_tokens = [coin_reward] + [ZERO_ADDRESS] * 7 @@ -64,7 +64,7 @@ def test_modify_reward_tokens_different( ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.getReward.signature[2:]}{'00' * 20}" gauge_v3.set_rewards( - reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) reward_tokens = [coin_reward, coin_b, coin_a] + [ZERO_ADDRESS] * 5 diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py index 23ff2b48..9e2b4699 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py @@ -76,7 +76,7 @@ def test_modify_no_deposit_no_ts(reward_contract_2, alice, gauge_v3, coin_a, coi def test_modify_no_deposit( - reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) @@ -95,7 +95,7 @@ def test_modify_no_deposit( def test_modify_deposit( - reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py index 570321fc..f02aa8cd 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py @@ -52,7 +52,7 @@ def test_modify_no_deposit_no_ts(reward_contract_2, alice, gauge_v3, coin_a, coi def test_modify_no_deposit( - reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) @@ -72,7 +72,7 @@ def test_modify_no_deposit( def test_modify_deposit( - reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token, + reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py index 437fe122..e38d9311 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py @@ -41,13 +41,13 @@ def reward_contract(alice, coin_a, coin_b): @pytest.fixture(scope="module", autouse=True) def initial_setup( - alice, bob, chain, gauge_v3, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token, + alice, bob, chain, gauge_v3, reward_contract, coin_reward, coin_a, coin_b, mock_lp_token ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.claim_tokens.signature[2:]}{'00' * 20}" gauge_v3.set_rewards( - reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) # Deposit diff --git a/tests/unitary/LiquidityGaugeWrapper/test_claim_tokens.py b/tests/unitary/LiquidityGaugeWrapper/test_claim_tokens.py index 9c25efbb..0058f440 100644 --- a/tests/unitary/LiquidityGaugeWrapper/test_claim_tokens.py +++ b/tests/unitary/LiquidityGaugeWrapper/test_claim_tokens.py @@ -11,9 +11,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, mock_lp_token, token, minter, gauge_controller, liquidity_gauge, gauge_wrapper, -): +def setup(accounts, mock_lp_token, token, minter, gauge_controller, liquidity_gauge, gauge_wrapper): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapper/test_deposit_withdraw.py b/tests/unitary/LiquidityGaugeWrapper/test_deposit_withdraw.py index d5c28d19..1127d66d 100644 --- a/tests/unitary/LiquidityGaugeWrapper/test_deposit_withdraw.py +++ b/tests/unitary/LiquidityGaugeWrapper/test_deposit_withdraw.py @@ -4,7 +4,7 @@ @pytest.fixture(scope="module", autouse=True) def deposit_setup( - accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token, + accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token ): token.set_minter(minter, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapper/test_transfer.py b/tests/unitary/LiquidityGaugeWrapper/test_transfer.py index 37d8ac36..52d68402 100644 --- a/tests/unitary/LiquidityGaugeWrapper/test_transfer.py +++ b/tests/unitary/LiquidityGaugeWrapper/test_transfer.py @@ -4,9 +4,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token, -): +def setup(accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapper/test_transferFrom.py b/tests/unitary/LiquidityGaugeWrapper/test_transferFrom.py index 07907945..42cfccbb 100644 --- a/tests/unitary/LiquidityGaugeWrapper/test_transferFrom.py +++ b/tests/unitary/LiquidityGaugeWrapper/test_transferFrom.py @@ -4,9 +4,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token, -): +def setup(accounts, gauge_controller, minter, liquidity_gauge, gauge_wrapper, token, mock_lp_token): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapperUnit/test_claim_tokens.py b/tests/unitary/LiquidityGaugeWrapperUnit/test_claim_tokens.py index 46d60d77..6d43729e 100644 --- a/tests/unitary/LiquidityGaugeWrapperUnit/test_claim_tokens.py +++ b/tests/unitary/LiquidityGaugeWrapperUnit/test_claim_tokens.py @@ -11,9 +11,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, mock_lp_token, token, minter, gauge_controller, liquidity_gauge, unit_gauge, -): +def setup(accounts, mock_lp_token, token, minter, gauge_controller, liquidity_gauge, unit_gauge): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapperUnit/test_deposit_withdraw.py b/tests/unitary/LiquidityGaugeWrapperUnit/test_deposit_withdraw.py index 38dc5a3e..2074f63b 100644 --- a/tests/unitary/LiquidityGaugeWrapperUnit/test_deposit_withdraw.py +++ b/tests/unitary/LiquidityGaugeWrapperUnit/test_deposit_withdraw.py @@ -4,7 +4,7 @@ @pytest.fixture(scope="module", autouse=True) def deposit_setup( - accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token, + accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token ): token.set_minter(minter, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapperUnit/test_transfer.py b/tests/unitary/LiquidityGaugeWrapperUnit/test_transfer.py index aac708b3..f2a04180 100644 --- a/tests/unitary/LiquidityGaugeWrapperUnit/test_transfer.py +++ b/tests/unitary/LiquidityGaugeWrapperUnit/test_transfer.py @@ -4,9 +4,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token, -): +def setup(accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapperUnit/test_transferFrom.py b/tests/unitary/LiquidityGaugeWrapperUnit/test_transferFrom.py index 2f65ac25..7d4c95ce 100644 --- a/tests/unitary/LiquidityGaugeWrapperUnit/test_transferFrom.py +++ b/tests/unitary/LiquidityGaugeWrapperUnit/test_transferFrom.py @@ -4,9 +4,7 @@ @pytest.fixture(scope="module", autouse=True) -def setup( - accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token, -): +def setup(accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token): token.set_minter(minter, {"from": accounts[0]}) gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeWrapperUnit/test_vault.py b/tests/unitary/LiquidityGaugeWrapperUnit/test_vault.py index 1ef5a3d6..32a3392b 100644 --- a/tests/unitary/LiquidityGaugeWrapperUnit/test_vault.py +++ b/tests/unitary/LiquidityGaugeWrapperUnit/test_vault.py @@ -6,7 +6,7 @@ @pytest.fixture(scope="module", autouse=True) def deposit_setup( - accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token, vault, + accounts, gauge_controller, minter, liquidity_gauge, unit_gauge, token, mock_lp_token, vault ): token.set_minter(minter, {"from": accounts[0]}) diff --git a/tests/unitary/PoolProxy/test_proxy_burn.py b/tests/unitary/PoolProxy/test_proxy_burn.py index cec23e95..6b327296 100644 --- a/tests/unitary/PoolProxy/test_proxy_burn.py +++ b/tests/unitary/PoolProxy/test_proxy_burn.py @@ -1,8 +1,6 @@ import brownie import pytest - -ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" -ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +from brownie import ETH_ADDRESS, ZERO_ADDRESS burner_mock = """ # @version 0.2.7 @@ -64,5 +62,5 @@ def test_burn_not_exists(accounts, pool_proxy): def test_burn_many_not_exists(accounts, pool_proxy, burner, coin_a): with brownie.reverts("dev: should implement burn()"): pool_proxy.burn_many( - [coin_a, ETH_ADDRESS, accounts[1]] + [ZERO_ADDRESS] * 17, {"from": accounts[0]}, + [coin_a, ETH_ADDRESS, accounts[1]] + [ZERO_ADDRESS] * 17, {"from": accounts[0]} ) diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py b/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py index 1eb09fe6..3028fd5d 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py @@ -9,9 +9,7 @@ @pytest.fixture(scope="module", autouse=True) -def initial_setup( - alice, bob, coin_reward, mock_lp_token, rewards_only_gauge, minter, -): +def initial_setup(alice, bob, coin_reward, mock_lp_token, rewards_only_gauge, minter): # deposit into gauge mock_lp_token.transfer(bob, LP_AMOUNT, {"from": alice}) mock_lp_token.approve(rewards_only_gauge, LP_AMOUNT, {"from": bob}) diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py index b9886995..f6e274a2 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py @@ -58,7 +58,7 @@ def initial_setup( sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.claim_tokens.signature[2:]}{'00' * 20}" rewards_only_gauge.set_rewards( - reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) # Deposit diff --git a/tests/unitary/RewardsOnlyGauge/test_set_rewards.py b/tests/unitary/RewardsOnlyGauge/test_set_rewards.py index 2ba568f6..aa9430af 100644 --- a/tests/unitary/RewardsOnlyGauge/test_set_rewards.py +++ b/tests/unitary/RewardsOnlyGauge/test_set_rewards.py @@ -63,7 +63,7 @@ def test_modify_reward_tokens_less( ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.getReward.signature[2:]}{'00' * 20}" rewards_only_gauge.set_rewards( - reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) reward_tokens = [coin_reward] + [ZERO_ADDRESS] * 7 @@ -76,7 +76,7 @@ def test_modify_reward_tokens_different( ): sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.getReward.signature[2:]}{'00' * 20}" rewards_only_gauge.set_rewards( - reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_reward, coin_a, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) reward_tokens = [coin_reward, coin_b, coin_a] + [ZERO_ADDRESS] * 5 diff --git a/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py b/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py index 210a651a..ee645a6d 100644 --- a/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py +++ b/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py @@ -55,7 +55,7 @@ def initial_setup( sigs = f"0x{'00' * 4}{'00' * 4}{reward_contract.claim_tokens.signature[2:]}{'00' * 20}" rewards_only_gauge.set_rewards( - reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice}, + reward_contract, sigs, [coin_a, coin_reward, coin_b] + [ZERO_ADDRESS] * 5, {"from": alice} ) # Deposit diff --git a/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py b/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py index 8c20b9df..183d1e33 100644 --- a/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py +++ b/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py @@ -20,7 +20,7 @@ def test_admin_only(accounts, vesting_factory, coin_a): def test_approve_fail(accounts, vesting_factory, coin_a): with brownie.reverts("dev: approve failed"): vesting_factory.deploy_vesting_contract( - ZERO_ADDRESS, accounts[1], 10 ** 18, True, 86400 * 365, {"from": accounts[0]}, + ZERO_ADDRESS, accounts[1], 10 ** 18, True, 86400 * 365, {"from": accounts[0]} ) @@ -61,7 +61,7 @@ def test_start_and_duration(VestingEscrowSimple, accounts, chain, vesting_factor start_time = chain.time() + 100 tx = vesting_factory.deploy_vesting_contract( - coin_a, accounts[1], 10 ** 18, True, 86400 * 700, start_time, {"from": accounts[0]}, + coin_a, accounts[1], 10 ** 18, True, 86400 * 700, start_time, {"from": accounts[0]} ) assert len(tx.new_contracts) == 1 From 01f3c84eef313b807c904b78bdba93fa94c062b6 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 14:15:40 +0400 Subject: [PATCH 4/9] chore: move wrappers --- contracts/gauges/{ => wrappers}/LiquidityGaugeRewardWrapper.vy | 0 contracts/gauges/{ => wrappers}/LiquidityGaugeWrapper.vy | 0 contracts/gauges/{ => wrappers}/LiquidityGaugeWrapperUnit.vy | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename contracts/gauges/{ => wrappers}/LiquidityGaugeRewardWrapper.vy (100%) rename contracts/gauges/{ => wrappers}/LiquidityGaugeWrapper.vy (100%) rename contracts/gauges/{ => wrappers}/LiquidityGaugeWrapperUnit.vy (100%) diff --git a/contracts/gauges/LiquidityGaugeRewardWrapper.vy b/contracts/gauges/wrappers/LiquidityGaugeRewardWrapper.vy similarity index 100% rename from contracts/gauges/LiquidityGaugeRewardWrapper.vy rename to contracts/gauges/wrappers/LiquidityGaugeRewardWrapper.vy diff --git a/contracts/gauges/LiquidityGaugeWrapper.vy b/contracts/gauges/wrappers/LiquidityGaugeWrapper.vy similarity index 100% rename from contracts/gauges/LiquidityGaugeWrapper.vy rename to contracts/gauges/wrappers/LiquidityGaugeWrapper.vy diff --git a/contracts/gauges/LiquidityGaugeWrapperUnit.vy b/contracts/gauges/wrappers/LiquidityGaugeWrapperUnit.vy similarity index 100% rename from contracts/gauges/LiquidityGaugeWrapperUnit.vy rename to contracts/gauges/wrappers/LiquidityGaugeWrapperUnit.vy From fac82b9ffb2c2231227571ac84803ee0cf7d427d Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 15:02:25 +0400 Subject: [PATCH 5/9] chore: move deprecated burners to subdirectory --- contracts/README.md | 4 +++- contracts/burners/README.md | 5 +++++ contracts/burners/{ => deprecated}/BTCBurner.vy | 0 contracts/burners/{ => deprecated}/ETHBurner.vy | 0 contracts/burners/{ => deprecated}/EuroBurner.vy | 0 contracts/burners/deprecated/README.md | 3 +++ 6 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 contracts/burners/README.md rename contracts/burners/{ => deprecated}/BTCBurner.vy (100%) rename contracts/burners/{ => deprecated}/ETHBurner.vy (100%) rename contracts/burners/{ => deprecated}/EuroBurner.vy (100%) create mode 100644 contracts/burners/deprecated/README.md diff --git a/contracts/README.md b/contracts/README.md index 8ccd9ef1..83b0c5b3 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -4,8 +4,10 @@ All contract sources are within this directory. ## Subdirectories -* [`gauges`](gauges): Contracts used for measuring provided liquidity +* [`burners`](burners): Contracts used to convert admin fees into 3CRV prior to distribution to the DAO. +* [`gauges`](gauges): Contracts used for measuring provided liquidity. * [`testing`](testing): Contracts used exclusively for testing. Not considered to be a core part of this project. +* [`vests`](vests): Contracts for vesting CRV. ## Contracts diff --git a/contracts/burners/README.md b/contracts/burners/README.md new file mode 100644 index 00000000..e4f97d3d --- /dev/null +++ b/contracts/burners/README.md @@ -0,0 +1,5 @@ +# curve-dao-contracts/contracts/burners/deprecated + +Contracts used to convert admin fees into 3CRV prior to distribution to the DAO. + +View the [documentation](https://curve.readthedocs.io/dao-fees.html#the-burn-process) to learn more about the fee burning process and how to interact with these contracts. diff --git a/contracts/burners/BTCBurner.vy b/contracts/burners/deprecated/BTCBurner.vy similarity index 100% rename from contracts/burners/BTCBurner.vy rename to contracts/burners/deprecated/BTCBurner.vy diff --git a/contracts/burners/ETHBurner.vy b/contracts/burners/deprecated/ETHBurner.vy similarity index 100% rename from contracts/burners/ETHBurner.vy rename to contracts/burners/deprecated/ETHBurner.vy diff --git a/contracts/burners/EuroBurner.vy b/contracts/burners/deprecated/EuroBurner.vy similarity index 100% rename from contracts/burners/EuroBurner.vy rename to contracts/burners/deprecated/EuroBurner.vy diff --git a/contracts/burners/deprecated/README.md b/contracts/burners/deprecated/README.md new file mode 100644 index 00000000..ed74d30b --- /dev/null +++ b/contracts/burners/deprecated/README.md @@ -0,0 +1,3 @@ +# curve-dao-contracts/contracts/burners/deprecated + +Fee burner contracts which are no longer in use. From f23cdcc569248fa9115d2f74ffb6a9f3be39614c Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 15:06:28 +0400 Subject: [PATCH 6/9] chore: move vesting contracts to subdirectory --- contracts/{ => vests}/VestingEscrow.vy | 0 contracts/{ => vests}/VestingEscrowFactory.vy | 0 contracts/{ => vests}/VestingEscrowSimple.vy | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{ => vests}/VestingEscrow.vy (100%) rename contracts/{ => vests}/VestingEscrowFactory.vy (100%) rename contracts/{ => vests}/VestingEscrowSimple.vy (100%) diff --git a/contracts/VestingEscrow.vy b/contracts/vests/VestingEscrow.vy similarity index 100% rename from contracts/VestingEscrow.vy rename to contracts/vests/VestingEscrow.vy diff --git a/contracts/VestingEscrowFactory.vy b/contracts/vests/VestingEscrowFactory.vy similarity index 100% rename from contracts/VestingEscrowFactory.vy rename to contracts/vests/VestingEscrowFactory.vy diff --git a/contracts/VestingEscrowSimple.vy b/contracts/vests/VestingEscrowSimple.vy similarity index 100% rename from contracts/VestingEscrowSimple.vy rename to contracts/vests/VestingEscrowSimple.vy From a7271b46fa52d6641073ab53bb13806ae1ff4812 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 14:15:53 +0400 Subject: [PATCH 7/9] chore: add/update readmes --- README.md | 2 +- contracts/gauges/README.md | 17 ++++++----------- contracts/gauges/wrappers/README.md | 9 +++++++++ contracts/testing/README.md | 8 ++++---- contracts/vests/README.md | 9 +++++++++ 5 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 contracts/gauges/wrappers/README.md create mode 100644 contracts/vests/README.md diff --git a/README.md b/README.md index 79661653..96455b88 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Vyper contracts used in the [Curve](https://www.curve.fi/) Governance DAO. Curve DAO consists of multiple smart contracts connected by [Aragon](https://github.com/aragon/aragonOS). Interaction with Aragon occurs through a [modified implementation](https://github.com/curvefi/curve-aragon-voting) of the [Aragon Voting App](https://github.com/aragon/aragon-apps/tree/master/apps/voting). Aragon's standard one token, one vote method is replaced with a weighting system based on locking tokens. Curve DAO has a token (CRV) which is used for both governance and value accrual. -View the [documentation](doc/readme.pdf) for a more in-depth explanation of how Curve DAO works. +View the [documentation](https://curve.readthedocs.io/dao-overview.html) for a more in-depth explanation of how Curve DAO works. ## Testing and Development diff --git a/contracts/gauges/README.md b/contracts/gauges/README.md index 9456d065..dd5013c2 100644 --- a/contracts/gauges/README.md +++ b/contracts/gauges/README.md @@ -2,17 +2,12 @@ Contracts used for measuring provided liquidity within Curve pools. -## Contracts +You can read the [documentation](https://curve.readthedocs.io/dao-gauges.html) to learn more about Curve gauges. -### Gauges +## Contracts +* [`LiquidityGaugeV3`](LiquidityGaugeV3.vy): Tokenized liquidity gauge further optimized for gas efficiency. * [`LiquidityGaugeV2`](LiquidityGaugeV2.vy): Tokenized liquidity gauge with generalized onward staking and support for multiple reward tokens. -* [`LiquidityGauge`](LiquidityGauge.vy): Measures the amount of liquidity provided by each user -* [`LiquidityGaugeReward`](LiquidityGaugeReward.vy): Measures provided liquidity and stakes using [Synthetix rewards contract](https://github.com/Synthetixio/synthetix/blob/master/contracts/StakingRewards.sol) - -### Wrappers - -Wrappers are used to tokenize deposits in first-gen gauges. - -* [`LiquidityGaugeRewardWrapper`](LiquidityGaugeRewardWrapper.vy): ERC20 wrapper for depositing into[`LiquidityGaugeReward`](LiquidityGaugeReward.vy) -* [`LiquidityGaugeWrapper`](LiquidityGaugeWrapper.vy): ERC20 wrapper for depositing into [`LiquidityGauge`](LiquidityGauge.vy) +* [`LiquidityGauge`](LiquidityGauge.vy): Measures the amount of liquidity provided by each user. +* [`LiquidityGaugeReward`](LiquidityGaugeReward.vy): Measures provided liquidity and stakes using the [Synthetix rewards contract](https://github.com/curvefi/unipool-fork). +* [`RewardsOnlyGauge`](RewardsOnlyGauge.vy): Handles distribution of 3rd-party incentives without receiving CRV emissions. Typically used on sidechains. diff --git a/contracts/gauges/wrappers/README.md b/contracts/gauges/wrappers/README.md new file mode 100644 index 00000000..9e3464d0 --- /dev/null +++ b/contracts/gauges/wrappers/README.md @@ -0,0 +1,9 @@ +# curve-dao-contracts/contracts/gauges/wrappers + +Wrappers are used to tokenize deposits in first-gen gauges. + +## Contracts + +* [`LiquidityGaugeRewardWrapper`](LiquidityGaugeRewardWrapper.vy): ERC20 wrapper for depositing into[`LiquidityGaugeReward`](LiquidityGaugeReward.vy) +* [`LiquidityGaugeWrapper`](LiquidityGaugeWrapper.vy): ERC20 wrapper for depositing into [`LiquidityGauge`](LiquidityGauge.vy) +* [`LiquidityGaugeWrapperUnit`](LiquidityGaugeWrapper.vy): Tokenizes gauge deposits to allow claiming of CRV when deposited as a collateral within the [unit.xyz](https://unit.xyz/) vault. diff --git a/contracts/testing/README.md b/contracts/testing/README.md index 8a8baa84..265a3bcb 100644 --- a/contracts/testing/README.md +++ b/contracts/testing/README.md @@ -4,7 +4,7 @@ Contracts used exclusively for testing. These are not considered part of Curve D ## Contracts -* [`CurvePool`](CurvePool.vy): Curve [pool contract](https://github.com/curvefi/curve-contract) for two plain coins -* [`CurveRewards`](CurveRewards.sol): Synthetix [LP Rewards](https://etherscan.io/address/0xdcb6a51ea3ca5d3fd898fd6564757c7aaec3ca92#code) contract -* [`ERC20`](ERC20.vy): Mintable mock ERC20 -* [`ERC20LP`](ERC20LP.vy): Curve LP ERC20 +* [`CurvePool`](CurvePool.vy): Curve [pool contract](https://github.com/curvefi/curve-contract) for two plain coins. +* [`CurveRewards`](CurveRewards.sol): Synthetix [LP Rewards](https://etherscan.io/address/0xdcb6a51ea3ca5d3fd898fd6564757c7aaec3ca92#code) contract. +* [`ERC20LP`](ERC20LP.vy): Curve LP ERC20. +* [`UnitVault`](UnitVault.vy): Minimal mock of [unit.xyz](https://unit.xyz/) [`Vault`](https://github.com/unitprotocol/core/blob/master/contracts/Vault.sol) contract. diff --git a/contracts/vests/README.md b/contracts/vests/README.md new file mode 100644 index 00000000..c9f13772 --- /dev/null +++ b/contracts/vests/README.md @@ -0,0 +1,9 @@ +# curve-dao-contracts/contracts/vests + +Contracts for vesting CRV. + +## Contracts + +* [`VestingEscrow`](VestingEscrow.vy): Vests CRV tokens for multiple addresses over multiple vesting periods +* [`VestingEscrowFactory`](VestingEscrowFactory.vy): Factory to store CRV and deploy many simplified vesting contracts +* [`VestingEscrowSimple`](VestingEscrowSimple.vy): Simplified vesting contract that holds CRV for a single address From ff5691d8f85ae83dca6eabcab50f518e9b939419 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 17:01:13 +0400 Subject: [PATCH 8/9] test: update minting calls on test ERC20 --- tests/conftest.py | 14 ++++---------- .../test_distribute_fees_stateful.py | 4 ++-- .../LiquidityGaugeReward/test_rewards_ratio.py | 3 +-- .../LiquidityGaugeReward/test_rewards_total.py | 3 +-- .../LiquidityGaugeV3/test_reward_distribution.py | 3 +-- .../test_rewards_total_transferred_in.py | 2 +- .../VotingEscrow/test_deposit_withdraw_voting.py | 2 +- tests/unitary/Burners/test_recover_tokens.py | 4 ++-- tests/unitary/FeeDistribution/test_claim_many.py | 4 ++-- .../FeeDistribution/test_fee_distribution.py | 10 +++++----- .../FeeDistribution/test_kill_fee_distro.py | 6 +++--- .../LiquidityGaugeReward/test_claim_rewards.py | 2 +- .../test_claim_rewards_none.py | 2 +- .../test_claim_tokens.py | 2 +- .../test_claim_historic_rewards.py | 4 ++-- .../test_claim_rewards_multiple.py | 8 ++++---- .../LiquidityGaugeV2/test_claim_rewards_none.py | 2 +- .../test_claim_rewards_transfer.py | 2 +- .../LiquidityGaugeV2/test_claim_rewards_unipool.py | 2 +- .../LiquidityGaugeV2/test_set_rewards_deposit.py | 6 +++--- .../test_set_rewards_no_deposit.py | 4 ++-- .../test_claim_rewards_multiple.py | 8 ++++---- .../LiquidityGaugeV3/test_claim_rewards_none.py | 3 +-- .../test_claim_rewards_transfer.py | 2 +- .../LiquidityGaugeV3/test_claim_rewards_unipool.py | 2 +- tests/unitary/LiquidityGaugeV3/test_deposit_for.py | 3 +-- .../test_mass_exit_reward_claim.py | 2 +- .../LiquidityGaugeV3/test_set_rewards_deposit.py | 6 +++--- .../test_set_rewards_no_deposit.py | 4 ++-- .../LiquidityGaugeV3/test_set_rewards_receiver.py | 4 ++-- .../test_claim_no_reward_contract.py | 2 +- .../test_claim_rewards_multiple.py | 8 ++++---- .../RewardsOnlyGauge/test_claim_rewards_none.py | 3 +-- .../test_claim_rewards_transfer.py | 2 +- .../RewardsOnlyGauge/test_claim_rewards_unipool.py | 2 +- tests/unitary/RewardsOnlyGauge/test_deposit_for.py | 3 +-- .../test_mass_exit_reward_claim.py | 2 +- .../RewardsOnlyGauge/test_set_rewards_deposit.py | 6 +++--- .../test_set_rewards_no_deposit.py | 4 ++-- .../RewardsOnlyGauge/test_set_rewards_receiver.py | 4 ++-- .../child_chain_streamer/test_get_reward.py | 2 +- .../test_notify_reward_amount.py | 6 +++--- .../child_chain_streamer/test_remove_reward.py | 2 +- .../VestingEscrowFactory/test_deploy_escrow.py | 8 +++----- .../VestingEscrowFactory/test_disable_simple.py | 2 -- 45 files changed, 81 insertions(+), 98 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fb9a1c45..554937f9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -37,7 +37,7 @@ def isolation_setup(fn_isolation): # helper functions as fixtures -@pytest.fixture(scope="function") +@pytest.fixture(scope="module") def theoretical_supply(chain, token): def _fn(): epoch = token.mining_epoch() @@ -112,7 +112,7 @@ def gauge_proxy(GaugeProxy, alice, bob): @pytest.fixture(scope="module") -def coin_reward(ERC20, accounts): +def coin_reward(): yield ERC20("YFIIIIII Funance", "YFIIIIII", 18) @@ -203,7 +203,7 @@ def vesting(VestingEscrow, accounts, coin_a, start_time, end_time): contract = VestingEscrow.deploy( coin_a, start_time, end_time, True, accounts[1:5], {"from": accounts[0]} ) - coin_a._mint_for_testing(10 ** 21, {"from": accounts[0]}) + coin_a._mint_for_testing(accounts[0], 10 ** 21) coin_a.approve(contract, 10 ** 21, {"from": accounts[0]}) yield contract @@ -220,8 +220,7 @@ def vesting_factory(VestingEscrowFactory, accounts, vesting_target): @pytest.fixture(scope="module") def vesting_simple(VestingEscrowSimple, accounts, vesting_factory, coin_a, start_time): - coin_a._mint_for_testing(10 ** 21, {"from": accounts[0]}) - coin_a.transfer(vesting_factory, 10 ** 21, {"from": accounts[0]}) + coin_a._mint_for_testing(vesting_factory, 10 ** 21) tx = vesting_factory.deploy_vesting_contract( coin_a, accounts[1], @@ -257,11 +256,6 @@ def burner(alice, bob, receiver, pool_proxy, request): yield Burner.deploy(*args[-idx:]) - # if len(Burner.deploy.abi['inputs']) == 4: - # yield Burner.deploy(receiver, receiver, alice, bob, {'from': alice}) - # else: - # yield Burner.deploy(receiver, alice, bob, {'from': alice}) - # testing contracts diff --git a/tests/integration/FeeDistributor/test_distribute_fees_stateful.py b/tests/integration/FeeDistributor/test_distribute_fees_stateful.py index 30fd5c29..509fcaf7 100644 --- a/tests/integration/FeeDistributor/test_distribute_fees_stateful.py +++ b/tests/integration/FeeDistributor/test_distribute_fees_stateful.py @@ -161,7 +161,7 @@ def rule_transfer_fees(self, st_amount, st_time): chain.sleep(st_time) amount = int(st_amount * 10 ** 18) - tx = self.fee_coin._mint_for_testing(amount, {"from": self.distributor.address}) + tx = self.fee_coin._mint_for_testing(self.distributor.address, amount) if not self.distributor.can_checkpoint_token(): self.distributor.toggle_allow_checkpoint_token() @@ -184,7 +184,7 @@ def rule_transfer_fees_without_checkpoint(self, st_amount, st_time): chain.sleep(st_time) amount = int(st_amount * 10 ** 18) - tx = self.fee_coin._mint_for_testing(amount, {"from": self.distributor.address}) + tx = self.fee_coin._mint_for_testing(self.distributor.address, amount) self.fees[tx.timestamp] = amount self.total_fees += amount diff --git a/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py b/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py index 48f380b3..75b38b6f 100644 --- a/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py +++ b/tests/integration/LiquidityGaugeReward/test_rewards_ratio.py @@ -30,8 +30,7 @@ def test_ratio_equality( liquidity_gauge_reward.deposit(value, {"from": act}) # Fund rewards - coin_reward._mint_for_testing(10 ** 20) - coin_reward.transfer(reward_contract, 10 ** 20) + coin_reward._mint_for_testing(reward_contract, 10 ** 20) reward_contract.notifyRewardAmount(10 ** 20) chain.sleep(2 * 7 * 86400) diff --git a/tests/integration/LiquidityGaugeReward/test_rewards_total.py b/tests/integration/LiquidityGaugeReward/test_rewards_total.py index 2aff0938..3471f6ba 100644 --- a/tests/integration/LiquidityGaugeReward/test_rewards_total.py +++ b/tests/integration/LiquidityGaugeReward/test_rewards_total.py @@ -54,8 +54,7 @@ def rule_notify_reward(self, st_reward): Add rewards only if at least someone has deposits """ if self.total_balances > 0: - self.coin_reward._mint_for_testing(st_reward) - self.coin_reward.transfer(self.reward_contract, st_reward) + self.coin_reward._mint_for_testing(self.reward_contract, st_reward) self.reward_contract.notifyRewardAmount(st_reward) self.rewards_total += st_reward diff --git a/tests/integration/LiquidityGaugeV3/test_reward_distribution.py b/tests/integration/LiquidityGaugeV3/test_reward_distribution.py index f262d9c0..5047127c 100644 --- a/tests/integration/LiquidityGaugeV3/test_reward_distribution.py +++ b/tests/integration/LiquidityGaugeV3/test_reward_distribution.py @@ -58,8 +58,7 @@ def rule_notify_reward(self, st_reward): ) self.flag = True - self.coin_reward._mint_for_testing(st_reward) - self.coin_reward.transfer(self.reward_contract, st_reward) + self.coin_reward._mint_for_testing(self.reward_contract, st_reward) self.reward_contract.notifyRewardAmount(st_reward) self.rewards_total += st_reward diff --git a/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py b/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py index 857d367b..faf97b44 100644 --- a/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py +++ b/tests/integration/RewardsOnlyGauge/test_rewards_total_transferred_in.py @@ -54,7 +54,7 @@ def rule_notify_reward(self, st_reward): """ if self.total_balances > 0: pre_balance = self.coin_reward.balanceOf(self.liquidity_gauge) - self.coin_reward._mint_for_testing(st_reward, {"from": self.liquidity_gauge}) + self.coin_reward._mint_for_testing(self.liquidity_gauge, st_reward) self.rewards_total += st_reward assert self.coin_reward.balanceOf(self.liquidity_gauge) == pre_balance + st_reward diff --git a/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py b/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py index 7d735506..4fb7522f 100644 --- a/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py +++ b/tests/integration/VotingEscrow/test_deposit_withdraw_voting.py @@ -28,7 +28,7 @@ def __init__(self, accounts, token, voting_escrow): self.voting_escrow = voting_escrow for acct in accounts: - token._mint_for_testing(10 ** 40, {"from": acct}) + token._mint_for_testing(acct, 10 ** 40) token.approve(voting_escrow, 2 ** 256 - 1, {"from": acct}) def setup(self): diff --git a/tests/unitary/Burners/test_recover_tokens.py b/tests/unitary/Burners/test_recover_tokens.py index da704a22..938e2117 100644 --- a/tests/unitary/Burners/test_recover_tokens.py +++ b/tests/unitary/Burners/test_recover_tokens.py @@ -2,7 +2,7 @@ def test_recover_balance(burner, alice, receiver, coin_a): - coin_a._mint_for_testing(10 ** 18, {"from": burner}) + coin_a._mint_for_testing(burner, 10 ** 18) burner.recover_balance(coin_a, {"from": alice}) @@ -11,7 +11,7 @@ def test_recover_balance(burner, alice, receiver, coin_a): def test_recover_balance_emergency_owner(burner, bob, receiver, coin_a): - coin_a._mint_for_testing(10 ** 18, {"from": burner}) + coin_a._mint_for_testing(burner, 10 ** 18) burner.recover_balance(coin_a, {"from": bob}) diff --git a/tests/unitary/FeeDistribution/test_claim_many.py b/tests/unitary/FeeDistribution/test_claim_many.py index 42f5814d..fd34d364 100644 --- a/tests/unitary/FeeDistribution/test_claim_many.py +++ b/tests/unitary/FeeDistribution/test_claim_many.py @@ -17,7 +17,7 @@ def test_claim_many(alice, bob, charlie, chain, voting_escrow, fee_distributor, chain.sleep(WEEK * 5) fee_distributor = fee_distributor(t=start_time) - coin_a._mint_for_testing(10 ** 19, {"from": fee_distributor}) + coin_a._mint_for_testing(fee_distributor, 10 ** 19) fee_distributor.checkpoint_token() chain.sleep(WEEK) fee_distributor.checkpoint_token() @@ -50,7 +50,7 @@ def test_claim_many_same_account( chain.sleep(WEEK * 5) fee_distributor = fee_distributor(t=start_time) - coin_a._mint_for_testing(10 ** 19, {"from": fee_distributor}) + coin_a._mint_for_testing(fee_distributor, 10 ** 19) fee_distributor.checkpoint_token() chain.sleep(WEEK) fee_distributor.checkpoint_token() diff --git a/tests/unitary/FeeDistribution/test_fee_distribution.py b/tests/unitary/FeeDistribution/test_fee_distribution.py index 931b7e12..d5a050f1 100644 --- a/tests/unitary/FeeDistribution/test_fee_distribution.py +++ b/tests/unitary/FeeDistribution/test_fee_distribution.py @@ -8,7 +8,7 @@ def test_deposited_after(web3, chain, accounts, voting_escrow, fee_distributor, fee_distributor = fee_distributor() token.approve(voting_escrow.address, amount * 10, {"from": alice}) - coin_a._mint_for_testing(100 * 10 ** 18, {"from": bob}) + coin_a._mint_for_testing(bob, 100 * 10 ** 18) for i in range(5): for j in range(7): @@ -34,7 +34,7 @@ def test_deposited_during(web3, chain, accounts, voting_escrow, fee_distributor, amount = 1000 * 10 ** 18 token.approve(voting_escrow.address, amount * 10, {"from": alice}) - coin_a._mint_for_testing(100 * 10 ** 18, {"from": bob}) + coin_a._mint_for_testing(bob, 100 * 10 ** 18) chain.sleep(WEEK) voting_escrow.create_lock(amount, chain[-1].timestamp + 8 * WEEK, {"from": alice}) @@ -62,7 +62,7 @@ def test_deposited_before(web3, chain, accounts, voting_escrow, fee_distributor, amount = 1000 * 10 ** 18 token.approve(voting_escrow.address, amount * 10, {"from": alice}) - coin_a._mint_for_testing(100 * 10 ** 18, {"from": bob}) + coin_a._mint_for_testing(bob, 100 * 10 ** 18) voting_escrow.create_lock(amount, chain[-1].timestamp + 8 * WEEK, {"from": alice}) chain.sleep(WEEK) @@ -86,7 +86,7 @@ def test_deposited_twice(web3, chain, accounts, voting_escrow, fee_distributor, amount = 1000 * 10 ** 18 token.approve(voting_escrow.address, amount * 10, {"from": alice}) - coin_a._mint_for_testing(100 * 10 ** 18, {"from": bob}) + coin_a._mint_for_testing(bob, 100 * 10 ** 18) voting_escrow.create_lock(amount, chain[-1].timestamp + 4 * WEEK, {"from": alice}) chain.sleep(WEEK) @@ -117,7 +117,7 @@ def test_deposited_parallel(web3, chain, accounts, voting_escrow, fee_distributo token.approve(voting_escrow.address, amount * 10, {"from": alice}) token.approve(voting_escrow.address, amount * 10, {"from": bob}) token.transfer(bob, amount, {"from": alice}) - coin_a._mint_for_testing(100 * 10 ** 18, {"from": charlie}) + coin_a._mint_for_testing(charlie, 100 * 10 ** 18) voting_escrow.create_lock(amount, chain[-1].timestamp + 8 * WEEK, {"from": alice}) voting_escrow.create_lock(amount, chain[-1].timestamp + 8 * WEEK, {"from": bob}) diff --git a/tests/unitary/FeeDistribution/test_kill_fee_distro.py b/tests/unitary/FeeDistribution/test_kill_fee_distro.py index 347d74d8..14a9c54a 100644 --- a/tests/unitary/FeeDistribution/test_kill_fee_distro.py +++ b/tests/unitary/FeeDistribution/test_kill_fee_distro.py @@ -28,7 +28,7 @@ def test_multi_kill(fee_distributor, accounts): def test_killing_xfers_tokens(fee_distributor, accounts, coin_a): - coin_a._mint_for_testing(31337, {"from": fee_distributor.address}) + coin_a._mint_for_testing(fee_distributor, 31337) fee_distributor.kill_me({"from": accounts[0]}) @@ -37,10 +37,10 @@ def test_killing_xfers_tokens(fee_distributor, accounts, coin_a): def test_multi_kill_token_xfer(fee_distributor, accounts, coin_a): - coin_a._mint_for_testing(10000, {"from": fee_distributor.address}) + coin_a._mint_for_testing(fee_distributor, 10000) fee_distributor.kill_me({"from": accounts[0]}) - coin_a._mint_for_testing(30000, {"from": fee_distributor.address}) + coin_a._mint_for_testing(fee_distributor, 30000) fee_distributor.kill_me({"from": accounts[0]}) assert fee_distributor.emergency_return() == accounts[1] diff --git a/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py b/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py index 37291bc7..4eead8ee 100644 --- a/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py +++ b/tests/unitary/LiquidityGaugeReward/test_claim_rewards.py @@ -10,7 +10,7 @@ @pytest.fixture(scope="module", autouse=True) def initial_setup(accounts, coin_reward, reward_contract, mock_lp_token, liquidity_gauge_reward): # Fund - coin_reward._mint_for_testing(REWARD, {"from": accounts[0]}) + coin_reward._mint_for_testing(accounts[0], REWARD) coin_reward.transfer(reward_contract, REWARD, {"from": accounts[0]}) reward_contract.notifyRewardAmount(REWARD, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeReward/test_claim_rewards_none.py b/tests/unitary/LiquidityGaugeReward/test_claim_rewards_none.py index 47c2f146..314157ab 100644 --- a/tests/unitary/LiquidityGaugeReward/test_claim_rewards_none.py +++ b/tests/unitary/LiquidityGaugeReward/test_claim_rewards_none.py @@ -5,7 +5,7 @@ def test_claim_no_deposit(accounts, chain, liquidity_gauge_reward, reward_contract, coin_reward): # Fund - coin_reward._mint_for_testing(REWARD, {"from": accounts[0]}) + coin_reward._mint_for_testing(accounts[0], REWARD) coin_reward.transfer(reward_contract, REWARD, {"from": accounts[0]}) reward_contract.notifyRewardAmount(REWARD, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeRewardWrapper/test_claim_tokens.py b/tests/unitary/LiquidityGaugeRewardWrapper/test_claim_tokens.py index 71166c35..0111455a 100644 --- a/tests/unitary/LiquidityGaugeRewardWrapper/test_claim_tokens.py +++ b/tests/unitary/LiquidityGaugeRewardWrapper/test_claim_tokens.py @@ -23,7 +23,7 @@ def setup( gauge_controller.add_type(b"Liquidity", 10 ** 10, {"from": accounts[0]}) gauge_controller.add_gauge(liquidity_gauge_reward, 0, 10 ** 18, {"from": accounts[0]}) - coin_reward._mint_for_testing(10 ** 20, {"from": accounts[0]}) + coin_reward._mint_for_testing(accounts[0], 10 ** 20) coin_reward.transfer(reward_contract, 10 ** 20, {"from": accounts[0]}) reward_contract.notifyRewardAmount(10 ** 20, {"from": accounts[0]}) diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_historic_rewards.py b/tests/unitary/LiquidityGaugeV2/test_claim_historic_rewards.py index 4c1171a7..549695e9 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_historic_rewards.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_historic_rewards.py @@ -28,7 +28,7 @@ def initial_setup(gauge_v2, mock_lp_token, alice, reward_contract, coin_reward): sigs = f"0x{sigs[0]}{sigs[1]}{sigs[2]}{'00' * 20}" gauge_v2.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) @@ -56,7 +56,7 @@ def test_claim_historic_multiple( sigs = f"0x{sigs[0]}{sigs[1]}{sigs[2]}{'00' * 20}" gauge_v2.set_rewards(reward_contract_2, sigs, [coin_a] + [ZERO_ADDRESS] * 7, {"from": alice}) - coin_a._mint_for_testing(REWARD, {"from": reward_contract_2}) + coin_a._mint_for_testing(reward_contract_2, REWARD) reward_contract_2.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(WEEK) diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py index ceaa3615..1e29a3b7 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_multiple.py @@ -33,8 +33,8 @@ def claim_tokens() -> bool: @pytest.fixture(scope="module") def reward_contract(alice, coin_a, coin_b): contract = compile_source(code).Vyper.deploy(coin_a, coin_b, {"from": alice}) - coin_a._mint_for_testing(REWARD, {"from": contract}) - coin_b._mint_for_testing(REWARD, {"from": contract}) + coin_a._mint_for_testing(contract, REWARD) + coin_b._mint_for_testing(contract, REWARD) yield contract @@ -101,8 +101,8 @@ def test_claim_two_lp( mock_lp_token.approve(gauge_v2, LP_AMOUNT, {"from": alice}) gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_a._mint_for_testing(REWARD, {"from": reward_contract}) - coin_b._mint_for_testing(REWARD, {"from": reward_contract}) + coin_a._mint_for_testing(reward_contract, REWARD) + coin_b._mint_for_testing(reward_contract, REWARD) chain.sleep(WEEK) chain.mine() diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_none.py b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_none.py index 9dbc39f1..8970ed75 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_none.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_none.py @@ -10,7 +10,7 @@ def test_claim_no_deposit(alice, bob, chain, gauge_v2, mock_lp_token, reward_con mock_lp_token.approve(gauge_v2, LP_AMOUNT, {"from": alice}) gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": alice}) + coin_reward._mint_for_testing(alice, REWARD) coin_reward.transfer(reward_contract, REWARD, {"from": alice}) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_transfer.py b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_transfer.py index 700ae98f..918f44d3 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_transfer.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_transfer.py @@ -39,7 +39,7 @@ def initial_setup( gauge_v2.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) # sleep half way through the reward period diff --git a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_unipool.py b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_unipool.py index 7d4a9989..1f12359e 100644 --- a/tests/unitary/LiquidityGaugeV2/test_claim_rewards_unipool.py +++ b/tests/unitary/LiquidityGaugeV2/test_claim_rewards_unipool.py @@ -42,7 +42,7 @@ def initial_setup( gauge_v2.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) diff --git a/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py b/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py index 2a38bbbe..654b736a 100644 --- a/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py +++ b/tests/unitary/LiquidityGaugeV2/test_set_rewards_deposit.py @@ -53,7 +53,7 @@ def test_unset_with_totalsupply(alice, coin_reward, reward_contract, gauge_v2, m def test_unsetting_claims(alice, chain, coin_reward, reward_contract, gauge_v2): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(WEEK) @@ -78,7 +78,7 @@ def test_modify_no_deposit( reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -96,7 +96,7 @@ def test_modify_deposit( reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py b/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py index 4720a147..953e5f24 100644 --- a/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py +++ b/tests/unitary/LiquidityGaugeV2/test_set_rewards_no_deposit.py @@ -52,7 +52,7 @@ def test_modify_no_deposit( reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -69,7 +69,7 @@ def test_modify_deposit( reward_contract, reward_contract_2, alice, gauge_v2, chain, coin_a, coin_reward, mock_lp_token ): gauge_v2.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py index 9aeefb50..bc899dc9 100644 --- a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py +++ b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_multiple.py @@ -36,8 +36,8 @@ def claim_tokens() -> bool: @pytest.fixture(scope="module") def reward_contract(alice, coin_a, coin_b): contract = compile_source(code).Vyper.deploy(coin_a, coin_b, {"from": alice}) - coin_a._mint_for_testing(REWARD * 2, {"from": contract}) - coin_b._mint_for_testing(REWARD * 2, {"from": contract}) + coin_a._mint_for_testing(contract, REWARD * 2) + coin_b._mint_for_testing(contract, REWARD * 2) yield contract @@ -117,8 +117,8 @@ def test_claim_two_lp( mock_lp_token.approve(gauge_v3, LP_AMOUNT, {"from": alice}) gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_a._mint_for_testing(REWARD, {"from": reward_contract}) - coin_b._mint_for_testing(REWARD, {"from": reward_contract}) + coin_a._mint_for_testing(reward_contract, REWARD) + coin_b._mint_for_testing(reward_contract, REWARD) chain.sleep(WEEK) chain.mine() diff --git a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_none.py b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_none.py index 50ed0edc..7e92e417 100644 --- a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_none.py +++ b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_none.py @@ -10,8 +10,7 @@ def test_claim_no_deposit(alice, bob, chain, gauge_v3, mock_lp_token, reward_con mock_lp_token.approve(gauge_v3, LP_AMOUNT, {"from": alice}) gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": alice}) - coin_reward.transfer(reward_contract, REWARD, {"from": alice}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) gauge_v3.set_rewards( diff --git a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_transfer.py b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_transfer.py index d5cd9c01..6c580e8e 100644 --- a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_transfer.py +++ b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_transfer.py @@ -39,7 +39,7 @@ def initial_setup( gauge_v3.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) # sleep half way through the reward period diff --git a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_unipool.py b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_unipool.py index 847e0b23..b7176600 100644 --- a/tests/unitary/LiquidityGaugeV3/test_claim_rewards_unipool.py +++ b/tests/unitary/LiquidityGaugeV3/test_claim_rewards_unipool.py @@ -42,7 +42,7 @@ def initial_setup( gauge_v3.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) diff --git a/tests/unitary/LiquidityGaugeV3/test_deposit_for.py b/tests/unitary/LiquidityGaugeV3/test_deposit_for.py index a76f486a..709b7f05 100644 --- a/tests/unitary/LiquidityGaugeV3/test_deposit_for.py +++ b/tests/unitary/LiquidityGaugeV3/test_deposit_for.py @@ -20,8 +20,7 @@ def test_deposit_for_and_claim_rewards( mock_lp_token.approve(gauge_v3, 2 ** 256 - 1, {"from": alice}) gauge_v3.deposit(LP_AMOUNT, bob, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": alice}) - coin_reward.transfer(reward_contract, REWARD, {"from": alice}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) gauge_v3.set_rewards( diff --git a/tests/unitary/LiquidityGaugeV3/test_mass_exit_reward_claim.py b/tests/unitary/LiquidityGaugeV3/test_mass_exit_reward_claim.py index 480b5c2f..abbf0aa1 100644 --- a/tests/unitary/LiquidityGaugeV3/test_mass_exit_reward_claim.py +++ b/tests/unitary/LiquidityGaugeV3/test_mass_exit_reward_claim.py @@ -42,7 +42,7 @@ def initial_setup( gauge_v3.set_rewards(reward_contract, sigs, [coin_reward] + [ZERO_ADDRESS] * 7, {"from": alice}) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) # sleep half way through the reward period diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py index 9e2b4699..fdf2eb6f 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_deposit.py @@ -53,7 +53,7 @@ def test_unset_with_totalsupply(alice, coin_reward, reward_contract, gauge_v3, m def test_unsetting_claims(alice, chain, coin_reward, reward_contract, gauge_v3): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(WEEK) @@ -79,7 +79,7 @@ def test_modify_no_deposit( reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -98,7 +98,7 @@ def test_modify_deposit( reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py index f02aa8cd..0b7f8630 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_no_deposit.py @@ -55,7 +55,7 @@ def test_modify_no_deposit( reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -75,7 +75,7 @@ def test_modify_deposit( reward_contract, reward_contract_2, alice, gauge_v3, chain, coin_a, coin_reward, mock_lp_token ): gauge_v3.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py b/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py index e38d9311..6b8233ff 100644 --- a/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py +++ b/tests/unitary/LiquidityGaugeV3/test_set_rewards_receiver.py @@ -33,8 +33,8 @@ def claim_tokens() -> bool: @pytest.fixture(scope="module") def reward_contract(alice, coin_a, coin_b): contract = compile_source(code).Vyper.deploy(coin_a, coin_b, {"from": alice}) - coin_a._mint_for_testing(REWARD * 2, {"from": contract}) - coin_b._mint_for_testing(REWARD * 2, {"from": contract}) + coin_a._mint_for_testing(contract, REWARD * 2) + coin_b._mint_for_testing(contract, REWARD * 2) yield contract diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py b/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py index 3028fd5d..09c4b1f8 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_no_reward_contract.py @@ -20,7 +20,7 @@ def initial_setup(alice, bob, coin_reward, mock_lp_token, rewards_only_gauge, mi ) # mint rewards directly into the contract (no notifiaction) - coin_reward._mint_for_testing(REWARD, {"from": rewards_only_gauge}) + coin_reward._mint_for_testing(rewards_only_gauge, REWARD) def test_claim_one_lp(bob, chain, rewards_only_gauge, coin_reward): diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py index f6e274a2..05acd7ae 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_multiple.py @@ -36,8 +36,8 @@ def claim_tokens() -> bool: @pytest.fixture(scope="module") def reward_contract(alice, coin_a, coin_b): contract = compile_source(code).Vyper.deploy(coin_a, coin_b, {"from": alice}) - coin_a._mint_for_testing(REWARD * 2, {"from": contract}) - coin_b._mint_for_testing(REWARD * 2, {"from": contract}) + coin_a._mint_for_testing(contract, REWARD * 2) + coin_b._mint_for_testing(contract, REWARD * 2) yield contract @@ -133,8 +133,8 @@ def test_claim_two_lp( mock_lp_token.approve(rewards_only_gauge, LP_AMOUNT, {"from": alice}) rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_a._mint_for_testing(REWARD, {"from": reward_contract}) - coin_b._mint_for_testing(REWARD, {"from": reward_contract}) + coin_a._mint_for_testing(reward_contract, REWARD) + coin_b._mint_for_testing(reward_contract, REWARD) chain.sleep(WEEK) chain.mine() diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_none.py b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_none.py index 2c35cffa..69a64071 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_none.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_none.py @@ -12,8 +12,7 @@ def test_claim_no_deposit( mock_lp_token.approve(rewards_only_gauge, LP_AMOUNT, {"from": alice}) rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": alice}) - coin_reward.transfer(reward_contract, REWARD, {"from": alice}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) rewards_only_gauge.set_rewards( diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_transfer.py b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_transfer.py index ab768c9d..063ad238 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_transfer.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_transfer.py @@ -41,7 +41,7 @@ def initial_setup( ) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) # sleep half way through the reward period diff --git a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_unipool.py b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_unipool.py index ce73426c..f3e54647 100644 --- a/tests/unitary/RewardsOnlyGauge/test_claim_rewards_unipool.py +++ b/tests/unitary/RewardsOnlyGauge/test_claim_rewards_unipool.py @@ -44,7 +44,7 @@ def initial_setup( ) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) diff --git a/tests/unitary/RewardsOnlyGauge/test_deposit_for.py b/tests/unitary/RewardsOnlyGauge/test_deposit_for.py index dbc110d3..453f7e93 100644 --- a/tests/unitary/RewardsOnlyGauge/test_deposit_for.py +++ b/tests/unitary/RewardsOnlyGauge/test_deposit_for.py @@ -20,8 +20,7 @@ def test_deposit_for_and_claim_rewards( mock_lp_token.approve(rewards_only_gauge, 2 ** 256 - 1, {"from": alice}) rewards_only_gauge.deposit(LP_AMOUNT, bob, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": alice}) - coin_reward.transfer(reward_contract, REWARD, {"from": alice}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) rewards_only_gauge.set_rewards( diff --git a/tests/unitary/RewardsOnlyGauge/test_mass_exit_reward_claim.py b/tests/unitary/RewardsOnlyGauge/test_mass_exit_reward_claim.py index e133a9b4..d3bfc26d 100644 --- a/tests/unitary/RewardsOnlyGauge/test_mass_exit_reward_claim.py +++ b/tests/unitary/RewardsOnlyGauge/test_mass_exit_reward_claim.py @@ -44,7 +44,7 @@ def initial_setup( ) # fund rewards - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) # sleep half way through the reward period diff --git a/tests/unitary/RewardsOnlyGauge/test_set_rewards_deposit.py b/tests/unitary/RewardsOnlyGauge/test_set_rewards_deposit.py index 4b4ca9db..ee16de67 100644 --- a/tests/unitary/RewardsOnlyGauge/test_set_rewards_deposit.py +++ b/tests/unitary/RewardsOnlyGauge/test_set_rewards_deposit.py @@ -67,7 +67,7 @@ def test_unset_with_totalsupply( def test_unsetting_claims(alice, chain, coin_reward, reward_contract, rewards_only_gauge): rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(WEEK) @@ -106,7 +106,7 @@ def test_modify_no_deposit( mock_lp_token, ): rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -136,7 +136,7 @@ def test_modify_deposit( mock_lp_token, ): rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/RewardsOnlyGauge/test_set_rewards_no_deposit.py b/tests/unitary/RewardsOnlyGauge/test_set_rewards_no_deposit.py index c91b61bb..d4f0fe30 100644 --- a/tests/unitary/RewardsOnlyGauge/test_set_rewards_no_deposit.py +++ b/tests/unitary/RewardsOnlyGauge/test_set_rewards_no_deposit.py @@ -76,7 +76,7 @@ def test_modify_no_deposit( mock_lp_token, ): rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) @@ -103,7 +103,7 @@ def test_modify_deposit( mock_lp_token, ): rewards_only_gauge.deposit(LP_AMOUNT, {"from": alice}) - coin_reward._mint_for_testing(REWARD, {"from": reward_contract}) + coin_reward._mint_for_testing(reward_contract, REWARD) reward_contract.notifyRewardAmount(REWARD, {"from": alice}) chain.sleep(86400) diff --git a/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py b/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py index ee645a6d..6b24ba96 100644 --- a/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py +++ b/tests/unitary/RewardsOnlyGauge/test_set_rewards_receiver.py @@ -33,8 +33,8 @@ def claim_tokens() -> bool: @pytest.fixture(scope="module") def reward_contract(alice, coin_a, coin_b): contract = compile_source(code).Vyper.deploy(coin_a, coin_b, {"from": alice}) - coin_a._mint_for_testing(REWARD * 2, {"from": contract}) - coin_b._mint_for_testing(REWARD * 2, {"from": contract}) + coin_a._mint_for_testing(contract, REWARD * 2) + coin_b._mint_for_testing(contract, REWARD * 2) yield contract diff --git a/tests/unitary/Sidechain/child_chain_streamer/test_get_reward.py b/tests/unitary/Sidechain/child_chain_streamer/test_get_reward.py index 7da62e2c..8091d6cc 100644 --- a/tests/unitary/Sidechain/child_chain_streamer/test_get_reward.py +++ b/tests/unitary/Sidechain/child_chain_streamer/test_get_reward.py @@ -7,7 +7,7 @@ @pytest.fixture(scope="module", autouse=True) def local_setup(alice, bob, charlie, coin_reward, child_chain_streamer): - coin_reward._mint_for_testing(100 * 10 ** 18, {"from": alice}) + coin_reward._mint_for_testing(alice, 100 * 10 ** 18) coin_reward.transfer(child_chain_streamer, 100 * 10 ** 18, {"from": alice}) child_chain_streamer.add_reward(coin_reward, charlie, DAY * 7, {"from": alice}) child_chain_streamer.set_receiver(bob, {"from": alice}) diff --git a/tests/unitary/Sidechain/child_chain_streamer/test_notify_reward_amount.py b/tests/unitary/Sidechain/child_chain_streamer/test_notify_reward_amount.py index 08ae341b..cdb105a0 100644 --- a/tests/unitary/Sidechain/child_chain_streamer/test_notify_reward_amount.py +++ b/tests/unitary/Sidechain/child_chain_streamer/test_notify_reward_amount.py @@ -8,7 +8,7 @@ @pytest.fixture(scope="module", autouse=True) def local_setup(alice, bob, charlie, chain, coin_reward, child_chain_streamer): - coin_reward._mint_for_testing(100 * 10 ** 18, {"from": alice}) + coin_reward._mint_for_testing(alice, 100 * 10 ** 18) coin_reward.transfer(child_chain_streamer, 100 * 10 ** 18, {"from": alice}) child_chain_streamer.add_reward(coin_reward, charlie, DAY * 14, {"from": alice}) @@ -35,7 +35,7 @@ def test_increase_reward_amount_mid_distribution( ): child_chain_streamer.notify_reward_amount(coin_reward, {"from": charlie}) chain.mine(timedelta=DAY * 7) # half the rewards have been streamed - coin_reward._mint_for_testing(100 * 10 ** 18, {"from": alice}) # give another 100 + coin_reward._mint_for_testing(alice, 100 * 10 ** 18) # give another 100 # approx 50 will be distributed in this call leaving 150 behind over the course of 14 days coin_reward.transfer(child_chain_streamer, 100 * 10 ** 18, {"from": alice}) @@ -60,7 +60,7 @@ def test_mid_distribution_only_distributor( chain.mine(timedelta=DAY * 7) # bob gets tokens, then sends them to the streamer hoping to call `notify_reward_amount` - coin_reward._mint_for_testing(100 * 10 ** 18, {"from": bob}) + coin_reward._mint_for_testing(bob, 100 * 10 ** 18) coin_reward.transfer(child_chain_streamer, 100 * 10 ** 18, {"from": bob}) with brownie.reverts("Reward period still active"): diff --git a/tests/unitary/Sidechain/child_chain_streamer/test_remove_reward.py b/tests/unitary/Sidechain/child_chain_streamer/test_remove_reward.py index d1023555..55197343 100644 --- a/tests/unitary/Sidechain/child_chain_streamer/test_remove_reward.py +++ b/tests/unitary/Sidechain/child_chain_streamer/test_remove_reward.py @@ -7,7 +7,7 @@ @pytest.fixture(scope="module", autouse=True) def local_setup(alice, charlie, coin_reward, child_chain_streamer): - coin_reward._mint_for_testing(100 * 10 ** 18, {"from": alice}) + coin_reward._mint_for_testing(alice, 100 * 10 ** 18) coin_reward.transfer(child_chain_streamer, 100 * 10 ** 18, {"from": alice}) child_chain_streamer.add_reward(coin_reward, charlie, DAY * 7, {"from": alice}) diff --git a/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py b/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py index 183d1e33..99aa955e 100644 --- a/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py +++ b/tests/unitary/VestingEscrowFactory/test_deploy_escrow.py @@ -1,13 +1,11 @@ import brownie import pytest - -ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +from brownie import ZERO_ADDRESS @pytest.fixture(scope="module", autouse=True) -def initial_funding(coin_a, vesting_factory, accounts): - coin_a._mint_for_testing(10 ** 21, {"from": accounts[0]}) - coin_a.transfer(vesting_factory, 10 ** 21, {"from": accounts[0]}) +def initial_funding(coin_a, vesting_factory): + coin_a._mint_for_testing(vesting_factory, 10 ** 21) def test_admin_only(accounts, vesting_factory, coin_a): diff --git a/tests/unitary/VestingEscrowFactory/test_disable_simple.py b/tests/unitary/VestingEscrowFactory/test_disable_simple.py index fa257968..2abbebfe 100644 --- a/tests/unitary/VestingEscrowFactory/test_disable_simple.py +++ b/tests/unitary/VestingEscrowFactory/test_disable_simple.py @@ -1,7 +1,5 @@ import brownie -ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" - def test_toggle_admin_only(vesting_simple, accounts): with brownie.reverts(): From 1ba3ac5dccc341acab05b397c2a12d4aa3e45b6f Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Sat, 12 Jun 2021 20:14:11 +0400 Subject: [PATCH 9/9] test(fix): reduce max examples on slow test --- tests/integration/FeeDistributor/test_checkpoint_ts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/FeeDistributor/test_checkpoint_ts.py b/tests/integration/FeeDistributor/test_checkpoint_ts.py index e8751721..dad854b7 100644 --- a/tests/integration/FeeDistributor/test_checkpoint_ts.py +++ b/tests/integration/FeeDistributor/test_checkpoint_ts.py @@ -1,5 +1,6 @@ import pytest from brownie.test import given, strategy +from hypothesis import settings WEEK = 86400 * 7 @@ -20,6 +21,7 @@ def distributor(accounts, chain, fee_distributor, voting_escrow, token): st_locktime=strategy("uint256[10]", min_value=1, max_value=52, unique=True), st_sleep=strategy("uint256[10]", min_value=1, max_value=30, unique=True), ) +@settings(max_examples=10) def test_checkpoint_total_supply( accounts, chain, distributor, voting_escrow, st_amount, st_locktime, st_sleep ):