diff --git a/token-swap/program/sim/Cargo.toml b/token-swap/program/sim/Cargo.toml index 23c19ebf86c..0c12e61a95e 100644 --- a/token-swap/program/sim/Cargo.toml +++ b/token-swap/program/sim/Cargo.toml @@ -7,4 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pyo3 = "0.12.3" +pyo3 = { version = "0.15.1", features = ["auto-initialize"] } diff --git a/token-swap/program/sim/src/lib.rs b/token-swap/program/sim/src/lib.rs index 2f61d0240b2..7181c0f5b1d 100644 --- a/token-swap/program/sim/src/lib.rs +++ b/token-swap/program/sim/src/lib.rs @@ -139,17 +139,15 @@ impl StableSwapModel { fn call0(&self, py: Python, method_name: &str) -> Result { let sim = PyModule::from_code(py, &self.py_src, FILE_NAME, MODULE_NAME).unwrap(); let model = sim - .call1( - "Curve", - ( - self.amp_factor, - self.balances.to_vec(), - self.n_coins, - self.fee, - self.target_prices.to_vec(), - self.pool_tokens, - ), - ) + .getattr("Curve")? + .call1(( + self.amp_factor, + self.balances.to_vec(), + self.n_coins, + self.fee, + self.target_prices.to_vec(), + self.pool_tokens, + )) .unwrap() .to_object(py); let py_ret = model.as_ref(py).call_method0(method_name); @@ -164,17 +162,15 @@ impl StableSwapModel { ) -> Result { let sim = PyModule::from_code(py, &self.py_src, FILE_NAME, MODULE_NAME).unwrap(); let model = sim - .call1( - "Curve", - ( - self.amp_factor, - self.balances.to_vec(), - self.n_coins, - self.fee, - self.target_prices.to_vec(), - self.pool_tokens, - ), - ) + .getattr("Curve")? + .call1(( + self.amp_factor, + self.balances.to_vec(), + self.n_coins, + self.fee, + self.target_prices.to_vec(), + self.pool_tokens, + )) .unwrap() .to_object(py); let py_ret = model.as_ref(py).call_method1(method_name, args);