diff --git a/pyproject.toml b/pyproject.toml index 998f59b..f972213 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,7 @@ requires-python = ">=3.10" dependencies = [ "vyper>=0.4.0", "snekmate==0.1.0", - "titanoboa", - "plyvel-ci==1.5.1", - # Keep this as a placeholder in the dependencies array + "titanoboa", # Keep this as a placeholder in the dependencies array ] [tool.uv.sources] diff --git a/tests/integration/address_book.py b/tests/integration/address_book.py index 22e7ebc..bbd64c4 100644 --- a/tests/integration/address_book.py +++ b/tests/integration/address_book.py @@ -1,8 +1,3 @@ # yearn vaults 3.0.3 factory -yearn_vault_factory = "0x5577EdcB8A856582297CdBbB07055E6a6E38eb5f" +factory = "0x5577EdcB8A856582297CdBbB07055E6a6E38eb5f" crvusd = "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E" -crvusd_controller_factory = "0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC" -crvusd_fee_collector = "0xa2Bcd1a4Efbd04B63cd03f5aFf2561106ebCCE00" -fee_splitter = "0x22556558419eed2d0a1af2e7fd60e63f3199aca3" -dao_agent = "0x40907540d8a6C65c637785e8f8B742ae6b0b9968" -vault_original = "0xcA78AF7443f3F8FA0148b746Cb18FF67383CDF3f" diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 8634513..2d83225 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -7,13 +7,6 @@ boa.set_etherscan(api_key=os.getenv("ETHERSCAN_API_KEY")) -@pytest.fixture(autouse=True, scope="module") -def better_traces(forked_env): - # contains contracts that are not necessarily called - # but appear in the traces - boa.from_etherscan(ab.vault_original, "vault_original") - - @pytest.fixture(scope="module") def rpc_url(): return os.getenv("ETH_RPC_URL") or "https://rpc.ankr.com/eth" @@ -21,18 +14,16 @@ def rpc_url(): @pytest.fixture(scope="module", autouse=True) def forked_env(rpc_url): - block_to_fork = 20928372 + block_to_fork = 20826753 with boa.swap_env(boa.Env()): boa.fork(url=rpc_url, block_identifier=block_to_fork) - # use this to disable caching - # boa.fork(url=rpc_url, block_identifier=block_to_fork, cache_file=None) boa.env.enable_fast_mode() yield @pytest.fixture(scope="module") def controller_factory(): - return boa.from_etherscan(ab.crvusd_controller_factory, "controller_factory") + return boa.from_etherscan("0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC", "controller_factory") @pytest.fixture(scope="module") @@ -42,49 +33,9 @@ def lens(controller_factory): @pytest.fixture(scope="module") def vault_factory(): - return boa.from_etherscan(ab.yearn_vault_factory, "vault_factory") - - -@pytest.fixture(scope="module") -def fee_splitter(scope="module"): - _factory = boa.load_vyi("tests/integration/interfaces/IFeeSplitter.vyi") - return _factory.at(ab.fee_splitter) + return boa.from_etherscan("0x5577EdcB8A856582297CdBbB07055E6a6E38eb5f", "vault_factory") @pytest.fixture(scope="module") def crvusd(): return boa.from_etherscan(ab.crvusd, "crvusd") - - -@pytest.fixture(scope="module") -def vault(vault_factory): - _vault_abi = boa.load_partial("contracts/yearn/VaultV3.vy") - - _vault_addy = vault_factory.deploy_new_vault( - ab.crvusd, - "Savings crvUSD", - "scrvUSD", - # TODO figure out who's going to be the role manager - ab.dao_agent, - 86400 * 7, # 1 week - ) - - _vault = _vault_abi.at(_vault_addy) - - # give the dao total control over the vault - _vault.set_role(ab.dao_agent, int("11111111111111", 2), sender=ab.dao_agent) - _vault.set_deposit_limit(2**256 - 1, sender=ab.dao_agent) - return _vault - - -@pytest.fixture(scope="module") -def rewards_handler(vault): - return boa.load( - "contracts/RewardsHandler.vy", - ab.crvusd, - vault, - 500, # 5% - 10_000, # 1 - ab.crvusd_controller_factory, - ab.dao_agent, - ) diff --git a/tests/integration/interfaces/IFeeSplitter.vyi b/tests/integration/interfaces/IFeeSplitter.vyi deleted file mode 100644 index 2ace24e..0000000 --- a/tests/integration/interfaces/IFeeSplitter.vyi +++ /dev/null @@ -1,80 +0,0 @@ -# Events - -event SetReceivers: - pass -event LivenessProtectionTriggered: - pass -event FeeDispatched: - receiver: address - weight: uint256 -event OwnershipTransferred: - previous_owner: address - new_owner: address - -# Structs - -struct Receiver: - addr: address - weight: uint256 - -# Functions - -@external -def transfer_ownership(new_owner: address): - ... - -@external -def renounce_ownership(): - ... - -@view -@external -def owner() -> address: - ... - -@external -def update_controllers(): - ... - -@view -@external -def n_controllers() -> uint256: - ... - -@view -@external -def allowed_controllers(arg0: address) -> bool: - ... - -@view -@external -def controllers(arg0: uint256) -> address: - ... - -@external -def dispatch_fees(controllers: DynArray[address, 50]): - ... - -@external -def set_receivers(receivers: DynArray[Receiver, 100]): - ... - -@view -@external -def excess_receiver() -> address: - ... - -@view -@external -def n_receivers() -> uint256: - ... - -@view -@external -def version() -> String[8]: - ... - -@view -@external -def receivers(arg0: uint256) -> Receiver: - ... diff --git a/tests/integration/test_fee_splitter.py b/tests/integration/test_fee_splitter.py deleted file mode 100644 index 15d18d4..0000000 --- a/tests/integration/test_fee_splitter.py +++ /dev/null @@ -1,52 +0,0 @@ -import boa - -import address_book as ab - - -def test_fee_splitter(fee_splitter, rewards_handler, crvusd, vault): - # =============== SETUP =============== - # As the vote has not yet passed to add the rewards_handler as a receiver - # we need to set the receivers manually - - assert crvusd.balanceOf(ab.crvusd_fee_collector) == 0 - assert crvusd.balanceOf(rewards_handler.address) == 0 - - receivers = [ - # dao receives 10% less in this test - (ab.crvusd_fee_collector, 9_000), - # we add the rewards_handler as a receiver - (rewards_handler.address, 1_000), - ] - - fee_splitter.set_receivers(receivers, sender=ab.dao_agent) - - # ============== SOME DEPOSITS JOIN THE VAULT ============== - alice = boa.env.generate_address("alice") - bob = boa.env.generate_address("bob") - - depositors = [alice, bob] - - deposit_amount = 100 * 10**18 - for d in depositors: - boa.deal(crvusd, d, 100_000_000 * 10**18) - crvusd.approve(vault.address, deposit_amount, sender=d) - vault.deposit(deposit_amount, d, sender=d) - - # roughly 1 deposit every two days - boa.env.time_travel(seconds=86400 * 2) - rewards_handler.take_snapshot() - - # ============== DISPATCH FEES ============== - - # we skip the first one as the market is deprecated - controllers = [fee_splitter.controllers(i) for i in range(1, 6)] - - fee_splitter.dispatch_fees(controllers) - - # sanity check that fees have been dispatched correctly - # fee_collector_after = crvusd.balanceOf(ab.crvusd_fee_collector) - # rewards_handler_after = crvusd.balanceOf(rewards_handler.address) - - # assert fee_collector_after/rewards_handler_after == 9_000/1_000 - - rewards_handler.process_rewards() diff --git a/uv.lock b/uv.lock index d6ad5c0..c5f03cb 100644 --- a/uv.lock +++ b/uv.lock @@ -1682,41 +1682,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, ] -[[package]] -name = "plyvel-ci" -version = "1.5.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f6/15/2dd89d1ec81ea44a41e6f35ad1a8a7789e7345831646daf03c6501172396/plyvel-ci-1.5.1.tar.gz", hash = "sha256:c28d861c56911ae70f481864016301e2d526c6c923f6aa9aa3cdf2c053457e29", size = 36869 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/37/f9/1c8307d17bd75700ba019bd953634e2b9c2fdf82ac127588f7bf29d71b80/plyvel_ci-1.5.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2f5cd3033d29d4c125ed06fc8de1231b3a67c5d7b90d8757524e77974e1dea80", size = 522647 }, - { url = "https://files.pythonhosted.org/packages/01/7c/ee51fb15448290b77a4d58a0db645e3d769b18f2013c42dc6ee9676101b4/plyvel_ci-1.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4b4bbd4a8051ca3b0daf4ccf4cfc9827f0c2cf2872abb4f5d8522a216650f337", size = 833393 }, - { url = "https://files.pythonhosted.org/packages/3c/3f/433d4b7d36dc0097cefaaf376ea81945b41779fb1280a5f0349fb8c993ff/plyvel_ci-1.5.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8e8b50a551955be81e3dbbee02458d21216402cc273e62d9a243199470a9a47c", size = 831832 }, - { url = "https://files.pythonhosted.org/packages/db/8a/f5a4d56f43afda0a6aadf1fcc7136e2125b2f2c683f8027ad29d412dd73b/plyvel_ci-1.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81926d0a5bda01538a3606fee03a4b7bfbb157209d3232f41534d50caceca05e", size = 835771 }, - { url = "https://files.pythonhosted.org/packages/b2/fd/fe7c3e6f947707979d77b9dff140f3a08f55b2192367b0649379eb0098a6/plyvel_ci-1.5.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:2783e0714ae3f61ae878be9c00be988865e1565114b5d93f5b961497eaf85652", size = 1368299 }, - { url = "https://files.pythonhosted.org/packages/de/9c/afe60614378d230388df7c8586f02f2536b7a06e0d4c66f8798d9cc504e9/plyvel_ci-1.5.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:30f77c7bffe4d0f6f38f00c89438af05f8a621ea16be73559b7d9f21bf2221c1", size = 1440080 }, - { url = "https://files.pythonhosted.org/packages/cb/c6/efa68e900ca78879b5b1edf36f9c488a4eaf58c606763aa4965a0f6a7e64/plyvel_ci-1.5.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:871c3f20509310909f45c89af46a5718274c9a9596700daead7d050c75a024b7", size = 1388909 }, - { url = "https://files.pythonhosted.org/packages/4c/41/0038fe7e1849a6b4e37bcb9b90df58174818cd5efd9cf7a6aa0315bea7d0/plyvel_ci-1.5.1-cp310-cp310-win32.whl", hash = "sha256:d9b46b6eaf207edbc886da83bdebae3253bc6f1778aea542e8d98cfb70bb55e9", size = 363142 }, - { url = "https://files.pythonhosted.org/packages/d2/57/d7e5ef3eb3d132e664514978fe16d87457462c66d0a0e21c16b98d90ddcb/plyvel_ci-1.5.1-cp310-cp310-win_amd64.whl", hash = "sha256:4480089c4bfde3e8a12eb2dd3790d299a685ba65781dbf6d415e11a7cd3803de", size = 449023 }, - { url = "https://files.pythonhosted.org/packages/eb/7c/70bcba3ed51e37168bc9edf65c51b84c5ae3d7b176ad48b62a16da8dac9b/plyvel_ci-1.5.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:f72cbd63aa8adf3e1ccdd2cf2b918675e7d1c016a0a132341449783d57f3ec49", size = 526052 }, - { url = "https://files.pythonhosted.org/packages/a8/0d/083cd88fc9a2f330665d231c7f7d8547df15dd2f134505b0c8aa77144320/plyvel_ci-1.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:72d86fef8c9048222c954d436ec1cc8235ee5d6ffe42118972ceeccc0acfd953", size = 901881 }, - { url = "https://files.pythonhosted.org/packages/e2/6b/ac64669a94d3234100d02a1c1d2bd55491fa28e5e8106439167a047b4852/plyvel_ci-1.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:de6864e5daf644471541d8455a871120d2a71a455afb873d94f07f58d4669f85", size = 892627 }, - { url = "https://files.pythonhosted.org/packages/09/c5/dd6b67970a417d3cb0c17652611ad400d5588c44c5d108b092e509cffac4/plyvel_ci-1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0bb47903ac084f9f311f6bd263b31b6d1076919bb00c91ab3c85e4cbf8735353", size = 903906 }, - { url = "https://files.pythonhosted.org/packages/f2/39/3e3f25a1bce1203cc6286d70734551b73be6a8edebd1dca923fd3287a6df/plyvel_ci-1.5.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:7e51312381434a651a4f0aa46dc7a8e162cae7b3efc58305198aafd94cd52e7a", size = 1427005 }, - { url = "https://files.pythonhosted.org/packages/bb/8b/f49ef6555d57c7285ad9a455d57d92e91e197049f38b9dc52b22107acc0f/plyvel_ci-1.5.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:e0b73ff47889ad106cd2ad292426d84bad36ce60f96bf7fd9f74f58c740a6c87", size = 1491017 }, - { url = "https://files.pythonhosted.org/packages/f7/3e/42b6cb23d44e51e105388433a7e524bfa712ac7df1f91b202b5f62a8c3cc/plyvel_ci-1.5.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1fbe70ec30669f73891da5adbf68c04d0f252985aeff311793ed2db8c17bec77", size = 1444178 }, - { url = "https://files.pythonhosted.org/packages/e9/3b/137760e2fdefeaa1931fe6a444b44ba9e431995e3b5511a68b08327e95da/plyvel_ci-1.5.1-cp311-cp311-win32.whl", hash = "sha256:2891c2ed6381dc3ee66ebde0e1f6557f27fe919eb535e3f19104a0529f210b8a", size = 363161 }, - { url = "https://files.pythonhosted.org/packages/f5/ce/3a4386cac0352463fe8c579eb5a4333c1acdc1249c4119360d477e359998/plyvel_ci-1.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:10b3e481210855747e07f3e15dd92c83c93903edc49688e8d4648ee13868b5ab", size = 449146 }, - { url = "https://files.pythonhosted.org/packages/5f/0b/f19d9f5a48a638c5e5fd56a4917b31265fea250002697c9715559d4132fa/plyvel_ci-1.5.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:dcb57f7fb1d43da20ae2845e68986595f79f2b093e142728a0e3d1161caca96b", size = 524013 }, - { url = "https://files.pythonhosted.org/packages/00/ce/2d3c2dffab955e380b4eaa0f0d2c01037e1494a0512ada6b3faad6886cf1/plyvel_ci-1.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c067321fc954466e365b82caecc708785bd249ee98a3320aa39dc80007fca618", size = 890112 }, - { url = "https://files.pythonhosted.org/packages/69/de/bd5bc18d77dbf345c8b9f809df84d382c804ca766a1a537c92069e2d1f43/plyvel_ci-1.5.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1b711213a3aead68391ba2a9c21517205cc64baac096afbabd2e62e4e32fd593", size = 880676 }, - { url = "https://files.pythonhosted.org/packages/28/9f/98d2dfd649989c86280def3ab2cbbbbdb36b32900a962ddfb006408480e0/plyvel_ci-1.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a17a93fc5a24f71cbaabd47c8794891b8378b542dd41ef0484781b932ffdc3d", size = 895577 }, - { url = "https://files.pythonhosted.org/packages/37/d7/11e49cc4bcec07d7365acdfe7a60757f20259abcaeba2f101974a7ff679c/plyvel_ci-1.5.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3758f532c2aa57226f07556b2c13e04ae9f099f275a1dee25f79b18d89dc7d73", size = 1421143 }, - { url = "https://files.pythonhosted.org/packages/f3/7c/c081767478ace1791b23e7bca30b5b26a8332924629272c987ad60f28d23/plyvel_ci-1.5.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:e9ed062ad9cac3a47d7e94072bec167c54a23ce5b7bc64a1457a42cd566686f2", size = 1481820 }, - { url = "https://files.pythonhosted.org/packages/89/e7/47fb7834629fe8b115dd80e7fe38e84258a7a555c14167e768196cd0728c/plyvel_ci-1.5.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:21a8e9696be3b31ab60eb91d0667d03c84a69c747d26442901451b809cdd0474", size = 1441356 }, - { url = "https://files.pythonhosted.org/packages/c6/a5/23703cdcad2d3b6a51c6e50fd1e3ecd6e92929e3e0d522fd7deaa31c124f/plyvel_ci-1.5.1-cp312-cp312-win32.whl", hash = "sha256:b765431aad19b85d922df39421198bd08bbd90f0a189d35e01e282ea4437bae5", size = 363563 }, - { url = "https://files.pythonhosted.org/packages/7e/30/f64d0565cac63e23b6f3869539886be60c6ce830312f8abc2c1e8ce54ebc/plyvel_ci-1.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:c177b6e533651f218140d657be9615bb42b94e43c455bf701cbbfee2a90c33ee", size = 448847 }, -] - [[package]] name = "pre-commit" version = "3.8.0" @@ -1760,6 +1725,8 @@ version = "6.0.0" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/18/c7/8c6872f7372eb6a6b2e4708b88419fb46b857f7a2e1892966b851cc79fc9/psutil-6.0.0.tar.gz", hash = "sha256:8faae4f310b6d969fa26ca0545338b21f73c6b15db7c4a8d934a5482faa818f2", size = 508067 } wheels = [ + { url = "https://files.pythonhosted.org/packages/c5/66/78c9c3020f573c58101dc43a44f6855d01bbbd747e24da2f0c4491200ea3/psutil-6.0.0-cp27-none-win32.whl", hash = "sha256:02b69001f44cc73c1c5279d02b30a817e339ceb258ad75997325e0e6169d8b35", size = 249766 }, + { url = "https://files.pythonhosted.org/packages/e1/3f/2403aa9558bea4d3854b0e5e567bc3dd8e9fbc1fc4453c0aa9aafeb75467/psutil-6.0.0-cp27-none-win_amd64.whl", hash = "sha256:21f1fb635deccd510f69f485b87433460a603919b45e2a324ad65b0cc74f8fb1", size = 253024 }, { url = "https://files.pythonhosted.org/packages/0b/37/f8da2fbd29690b3557cca414c1949f92162981920699cd62095a984983bf/psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c588a7e9b1173b6e866756dde596fd4cad94f9399daf99ad8c3258b3cb2b47a0", size = 250961 }, { url = "https://files.pythonhosted.org/packages/35/56/72f86175e81c656a01c4401cd3b1c923f891b31fbcebe98985894176d7c9/psutil-6.0.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ed2440ada7ef7d0d608f20ad89a04ec47d2d3ab7190896cd62ca5fc4fe08bf0", size = 287478 }, { url = "https://files.pythonhosted.org/packages/19/74/f59e7e0d392bc1070e9a70e2f9190d652487ac115bb16e2eff6b22ad1d24/psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fd9a97c8e94059b0ef54a7d4baf13b405011176c3b6ff257c247cae0d560ecd", size = 290455 }, @@ -2441,7 +2408,6 @@ name = "scrvusd" version = "0.1.0" source = { editable = "." } dependencies = [ - { name = "plyvel-ci" }, { name = "snekmate" }, { name = "titanoboa" }, { name = "vyper" }, @@ -2467,7 +2433,6 @@ requires-dist = [ { name = "curve-dao", marker = "extra == 'scripts'", specifier = "==1.0.0" }, { name = "jupyter", marker = "extra == 'scripts'", specifier = "==1.0.0" }, { name = "mamushi", marker = "extra == 'dev'", specifier = "==0.0.4a3" }, - { name = "plyvel-ci", specifier = ">=1.5.1" }, { name = "pre-commit", marker = "extra == 'dev'", specifier = "==3.8.0" }, { name = "pytest", marker = "extra == 'dev'", specifier = "==8.2.2" }, { name = "pytest-xdist", marker = "extra == 'dev'", specifier = "==3.6.1" },