diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index d25c763..4dbcb68 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -50,7 +50,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v1.0.2" + ref: "v1.0.3" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} @@ -86,7 +86,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v1.0.2" + ref: "v1.0.3" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d2c29f1..b3b3048 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v1.0.2" + ref: "v1.0.3" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27baeea..6dfae93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v1.0.2" + ref: "v1.0.3" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/Cargo.lock b/Cargo.lock index 8ae2a73..5ac9c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1588,7 +1588,7 @@ dependencies = [ [[package]] name = "hyperdrivepy" -version = "1.0.3" +version = "1.0.4" dependencies = [ "ethers", "eyre", diff --git a/crates/hyperdrivepy/Cargo.toml b/crates/hyperdrivepy/Cargo.toml index 83c069b..4342ff2 100644 --- a/crates/hyperdrivepy/Cargo.toml +++ b/crates/hyperdrivepy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hyperdrivepy" edition = "2021" -version = "1.0.3" +version = "1.0.4" authors = [ "Dylan Paiton", "Matt Brown", diff --git a/crates/hyperdrivepy/pyproject.toml b/crates/hyperdrivepy/pyproject.toml index 3bac26b..0a82489 100644 --- a/crates/hyperdrivepy/pyproject.toml +++ b/crates/hyperdrivepy/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "1.0.3" +version = "1.0.4" requires-python = ">=3.7" classifiers = [ "Programming Language :: Rust", diff --git a/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py b/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py index 82b3870..ede5c87 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py @@ -253,7 +253,6 @@ def calculate_open_short( pool_config: types.PoolConfigType, pool_info: types.PoolInfoType, short_amount: str, - spot_price: str, open_vault_share_price: str | None = None, ) -> str: """Gets the amount of base the trader will need to deposit for a short of a given size. @@ -268,8 +267,6 @@ def calculate_open_short( Includes attributes like reserve levels and share prices. short_amount: str (FixedPoint) The amount to of bonds to short. - spot_price: str (FixedPoint) - The pool's current price for bonds. open_vault_share_price: str (FixedPoint) | None, optional Optionally provide the open share price for the short. If this is not provided or is None, then we will use the pool's current share price. @@ -283,7 +280,7 @@ def calculate_open_short( # the underlying rust code uses current market share price if this is 0 # zero value is used because the smart contract will return 0 if the checkpoint hasn't been minted open_vault_share_price = "0" - return _get_interface(pool_config, pool_info).calculate_open_short(short_amount, spot_price, open_vault_share_price) + return _get_interface(pool_config, pool_info).calculate_open_short(short_amount, open_vault_share_price) def calculate_close_short( diff --git a/crates/hyperdrivepy/setup.py b/crates/hyperdrivepy/setup.py index 7f83e0c..7b4bdf8 100644 --- a/crates/hyperdrivepy/setup.py +++ b/crates/hyperdrivepy/setup.py @@ -5,7 +5,7 @@ setup( name="hyperdrivepy", - version="1.0.3", + version="1.0.4", packages=["hyperdrivepy"], package_dir={"": "python"}, rust_extensions=[ diff --git a/crates/hyperdrivepy/src/hyperdrive_state_methods.rs b/crates/hyperdrivepy/src/hyperdrive_state_methods.rs index da82994..d157e29 100644 --- a/crates/hyperdrivepy/src/hyperdrive_state_methods.rs +++ b/crates/hyperdrivepy/src/hyperdrive_state_methods.rs @@ -155,15 +155,11 @@ impl HyperdriveState { pub fn calculate_open_short( &self, short_amount: &str, - spot_price: &str, open_vault_share_price: &str, ) -> PyResult { let short_amount_fp = FixedPoint::from(U256::from_dec_str(short_amount).map_err(|_| { PyErr::new::("Failed to convert short_amount string to U256") })?); - let spot_price_fp = FixedPoint::from(U256::from_dec_str(spot_price).map_err(|_| { - PyErr::new::("Failed to convert spot_price string to U256") - })?); let open_vault_share_price_fp = FixedPoint::from(U256::from_dec_str(open_vault_share_price).map_err(|_| { PyErr::new::( @@ -172,7 +168,7 @@ impl HyperdriveState { })?); let result_fp = self .state - .calculate_open_short(short_amount_fp, spot_price_fp, open_vault_share_price_fp) + .calculate_open_short(short_amount_fp, open_vault_share_price_fp) .unwrap(); let result = U256::from(result_fp).to_string(); return Ok(result); diff --git a/pyproject.toml b/pyproject.toml index a12279d..00a5ce6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "1.0.3" +version = "1.0.4" authors = [ { name = "Dylan Paiton", email = "dylan@delv.tech" }, { name = "Matthew Brown", email = "matt@delv.tech" }, diff --git a/system_tests/wrapper_tests.py b/system_tests/wrapper_tests.py index 37872f2..2c596ad 100644 --- a/system_tests/wrapper_tests.py +++ b/system_tests/wrapper_tests.py @@ -205,18 +205,15 @@ def test_calculate_close_long(): def test_calculate_open_short(): """Test for calculate_open_short.""" short_amount = str(50 * 10**18) - spot_price = hyperdrivepy.calculate_spot_price(POOL_CONFIG, POOL_INFO) open_vault_share_price = str(9 * 10**17) - base_required = hyperdrivepy.calculate_open_short( - POOL_CONFIG, POOL_INFO, short_amount, spot_price, open_vault_share_price - ) + base_required = hyperdrivepy.calculate_open_short(POOL_CONFIG, POOL_INFO, short_amount, open_vault_share_price) assert int(base_required) > 0 base_required_default_vault_share_price = hyperdrivepy.calculate_open_short( - POOL_CONFIG, POOL_INFO, short_amount, spot_price, None + POOL_CONFIG, POOL_INFO, short_amount, None ) assert int(base_required_default_vault_share_price) > 0 assert base_required_default_vault_share_price == hyperdrivepy.calculate_open_short( - POOL_CONFIG, POOL_INFO, short_amount, spot_price, "0" + POOL_CONFIG, POOL_INFO, short_amount, "0" )