From 628aee4a22a121f0316ec4a2422e272d0c34f986 Mon Sep 17 00:00:00 2001 From: rndquu Date: Fri, 24 Nov 2023 12:43:40 +0300 Subject: [PATCH] refactor: remove duplicated interfaces --- packages/contracts/foundry.toml | 2 +- packages/contracts/src/old/TWAPOracle.sol | 2 +- .../old/UbiquityAlgorithmicDollarManager.sol | 4 +- .../src/old/interfaces/ICurveFactory.sol | 107 ------- .../src/old/interfaces/IMetaPool.sol | 279 ------------------ 5 files changed, 4 insertions(+), 390 deletions(-) delete mode 100644 packages/contracts/src/old/interfaces/ICurveFactory.sol delete mode 100644 packages/contracts/src/old/interfaces/IMetaPool.sol diff --git a/packages/contracts/foundry.toml b/packages/contracts/foundry.toml index a244cd44e..8c5721de8 100644 --- a/packages/contracts/foundry.toml +++ b/packages/contracts/foundry.toml @@ -1,5 +1,5 @@ [profile.default] -src = 'src/dollar' +src = 'src' test = 'test' out = 'out' libs = ['lib'] diff --git a/packages/contracts/src/old/TWAPOracle.sol b/packages/contracts/src/old/TWAPOracle.sol index 32e2ce58b..5655c168d 100644 --- a/packages/contracts/src/old/TWAPOracle.sol +++ b/packages/contracts/src/old/TWAPOracle.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.3; -import "./interfaces/IMetaPool.sol"; +import "../dollar/interfaces/IMetaPool.sol"; contract TWAPOracle { address public immutable pool; diff --git a/packages/contracts/src/old/UbiquityAlgorithmicDollarManager.sol b/packages/contracts/src/old/UbiquityAlgorithmicDollarManager.sol index aa1472f76..82452ee71 100644 --- a/packages/contracts/src/old/UbiquityAlgorithmicDollarManager.sol +++ b/packages/contracts/src/old/UbiquityAlgorithmicDollarManager.sol @@ -7,8 +7,8 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IUbiquityAlgorithmicDollar.sol"; -import "./interfaces/ICurveFactory.sol"; -import "./interfaces/IMetaPool.sol"; +import "../dollar/interfaces/ICurveFactory.sol"; +import "../dollar/interfaces/IMetaPool.sol"; import "./TWAPOracle.sol"; diff --git a/packages/contracts/src/old/interfaces/ICurveFactory.sol b/packages/contracts/src/old/interfaces/ICurveFactory.sol deleted file mode 100644 index 79ad7a5f6..000000000 --- a/packages/contracts/src/old/interfaces/ICurveFactory.sol +++ /dev/null @@ -1,107 +0,0 @@ -// SPDX-License-Identifier: MIT -// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol. SEE BELOW FOR SOURCE. !! -pragma solidity ^0.8.3; - -interface ICurveFactory { - event BasePoolAdded(address base_pool, address implementat); - event MetaPoolDeployed( - address coin, - address base_pool, - uint256 A, - uint256 fee, - address deployer - ); - - function find_pool_for_coins( - address _from, - address _to - ) external view returns (address); - - function find_pool_for_coins( - address _from, - address _to, - uint256 i - ) external view returns (address); - - function get_n_coins( - address _pool - ) external view returns (uint256, uint256); - - function get_coins(address _pool) external view returns (address[2] memory); - - function get_underlying_coins( - address _pool - ) external view returns (address[8] memory); - - function get_decimals( - address _pool - ) external view returns (uint256[2] memory); - - function get_underlying_decimals( - address _pool - ) external view returns (uint256[8] memory); - - function get_rates(address _pool) external view returns (uint256[2] memory); - - function get_balances( - address _pool - ) external view returns (uint256[2] memory); - - function get_underlying_balances( - address _pool - ) external view returns (uint256[8] memory); - - function get_A(address _pool) external view returns (uint256); - - function get_fees(address _pool) external view returns (uint256, uint256); - - function get_admin_balances( - address _pool - ) external view returns (uint256[2] memory); - - function get_coin_indices( - address _pool, - address _from, - address _to - ) external view returns (int128, int128, bool); - - function add_base_pool( - address _base_pool, - address _metapool_implementation, - address _fee_receiver - ) external; - - function deploy_metapool( - address _base_pool, - string memory _name, - string memory _symbol, - address _coin, - uint256 _A, - uint256 _fee - ) external returns (address); - - function commit_transfer_ownership(address addr) external; - - function accept_transfer_ownership() external; - - function set_fee_receiver( - address _base_pool, - address _fee_receiver - ) external; - - function convert_fees() external returns (bool); - - function admin() external view returns (address); - - function future_admin() external view returns (address); - - function pool_list(uint256 arg0) external view returns (address); - - function pool_count() external view returns (uint256); - - function base_pool_list(uint256 arg0) external view returns (address); - - function base_pool_count() external view returns (uint256); - - function fee_receiver(address arg0) external view returns (address); -} diff --git a/packages/contracts/src/old/interfaces/IMetaPool.sol b/packages/contracts/src/old/interfaces/IMetaPool.sol deleted file mode 100644 index 20a72d9c4..000000000 --- a/packages/contracts/src/old/interfaces/IMetaPool.sol +++ /dev/null @@ -1,279 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol. SEE BELOW FOR SOURCE. !! -pragma solidity ^0.8.3; - -interface IMetaPool { - event Transfer( - address indexed sender, - address indexed receiver, - uint256 value - ); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); - event TokenExchange( - address indexed buyer, - int128 sold_id, - uint256 tokens_sold, - int128 bought_id, - uint256 tokens_bought - ); - event TokenExchangeUnderlying( - address indexed buyer, - int128 sold_id, - uint256 tokens_sold, - int128 bought_id, - uint256 tokens_bought - ); - event AddLiquidity( - address indexed provider, - uint256[2] token_amounts, - uint256[2] fees, - uint256 invariant, - uint256 token_supply - ); - event RemoveLiquidity( - address indexed provider, - uint256[2] token_amounts, - uint256[2] fees, - uint256 token_supply - ); - event RemoveLiquidityOne( - address indexed provider, - uint256 token_amount, - uint256 coin_amount, - uint256 token_supply - ); - event RemoveLiquidityImbalance( - address indexed provider, - uint256[2] token_amounts, - uint256[2] fees, - uint256 invariant, - uint256 token_supply - ); - event CommitNewAdmin(uint256 indexed deadline, address indexed admin); - event NewAdmin(address indexed admin); - event CommitNewFee( - uint256 indexed deadline, - uint256 fee, - uint256 admin_fee - ); - event NewFee(uint256 fee, uint256 admin_fee); - event RampA( - uint256 old_A, - uint256 new_A, - uint256 initial_time, - uint256 future_time - ); - event StopRampA(uint256 A, uint256 t); - - function initialize( - string memory _name, - string memory _symbol, - address _coin, - uint256 _decimals, - uint256 _A, - uint256 _fee, - address _admin - ) external; - - function decimals() external view returns (uint256); - - function transfer(address _to, uint256 _value) external returns (bool); - - function transferFrom( - address _from, - address _to, - uint256 _value - ) external returns (bool); - - function approve(address _spender, uint256 _value) external returns (bool); - - function get_previous_balances() external view returns (uint256[2] memory); - - function get_balances() external view returns (uint256[2] memory); - - function get_twap_balances( - uint256[2] memory _first_balances, - uint256[2] memory _last_balances, - uint256 _time_elapsed - ) external view returns (uint256[2] memory); - - function get_price_cumulative_last() - external - view - returns (uint256[2] memory); - - function admin_fee() external view returns (uint256); - - function A() external view returns (uint256); - - function A_precise() external view returns (uint256); - - function get_virtual_price() external view returns (uint256); - - function calc_token_amount( - uint256[2] memory _amounts, - bool _is_deposit - ) external view returns (uint256); - - function calc_token_amount( - uint256[2] memory _amounts, - bool _is_deposit, - bool _previous - ) external view returns (uint256); - - function add_liquidity( - uint256[2] memory _amounts, - uint256 _min_mint_amount - ) external returns (uint256); - - function add_liquidity( - uint256[2] memory _amounts, - uint256 _min_mint_amount, - address _receiver - ) external returns (uint256); - - function get_dy( - int128 i, - int128 j, - uint256 dx - ) external view returns (uint256); - - function get_dy( - int128 i, - int128 j, - uint256 dx, - uint256[2] memory _balances - ) external view returns (uint256); - - function get_dy_underlying( - int128 i, - int128 j, - uint256 dx - ) external view returns (uint256); - - function get_dy_underlying( - int128 i, - int128 j, - uint256 dx, - uint256[2] memory _balances - ) external view returns (uint256); - - function exchange( - int128 i, - int128 j, - uint256 dx, - uint256 min_dy - ) external returns (uint256); - - function exchange( - int128 i, - int128 j, - uint256 dx, - uint256 min_dy, - address _receiver - ) external returns (uint256); - - function exchange_underlying( - int128 i, - int128 j, - uint256 dx, - uint256 min_dy - ) external returns (uint256); - - function exchange_underlying( - int128 i, - int128 j, - uint256 dx, - uint256 min_dy, - address _receiver - ) external returns (uint256); - - function remove_liquidity( - uint256 _burn_amount, - uint256[2] memory _min_amounts - ) external returns (uint256[2] memory); - - function remove_liquidity( - uint256 _burn_amount, - uint256[2] memory _min_amounts, - address _receiver - ) external returns (uint256[2] memory); - - function remove_liquidity_imbalance( - uint256[2] memory _amounts, - uint256 _max_burn_amount - ) external returns (uint256); - - function remove_liquidity_imbalance( - uint256[2] memory _amounts, - uint256 _max_burn_amount, - address _receiver - ) external returns (uint256); - - function calc_withdraw_one_coin( - uint256 _burn_amount, - int128 i - ) external view returns (uint256); - - function calc_withdraw_one_coin( - uint256 _burn_amount, - int128 i, - bool _previous - ) external view returns (uint256); - - function remove_liquidity_one_coin( - uint256 _burn_amount, - int128 i, - uint256 _min_received - ) external returns (uint256); - - function remove_liquidity_one_coin( - uint256 _burn_amount, - int128 i, - uint256 _min_received, - address _receiver - ) external returns (uint256); - - function ramp_A(uint256 _future_A, uint256 _future_time) external; - - function stop_ramp_A() external; - - function admin_balances(uint256 i) external view returns (uint256); - - function withdraw_admin_fees() external; - - function admin() external view returns (address); - - function coins(uint256 arg0) external view returns (address); - - function balances(uint256 arg0) external view returns (uint256); - - function fee() external view returns (uint256); - - function block_timestamp_last() external view returns (uint256); - - function initial_A() external view returns (uint256); - - function future_A() external view returns (uint256); - - function initial_A_time() external view returns (uint256); - - function future_A_time() external view returns (uint256); - - function name() external view returns (string memory); - - function symbol() external view returns (string memory); - - function balanceOf(address arg0) external view returns (uint256); - - function allowance( - address arg0, - address arg1 - ) external view returns (uint256); - - function totalSupply() external view returns (uint256); -}