diff --git a/Cargo.lock b/Cargo.lock index 43e7acf34..82bd11558 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -763,6 +763,7 @@ version = "0.0.0" dependencies = [ "common_errors", "common_structs", + "energy-factory", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", diff --git a/legacy-contracts/factory-legacy/Cargo.toml b/legacy-contracts/factory-legacy/Cargo.toml index bff8b6fa4..f1dee1bb8 100644 --- a/legacy-contracts/factory-legacy/Cargo.toml +++ b/legacy-contracts/factory-legacy/Cargo.toml @@ -24,4 +24,7 @@ path = "../../common/common_structs" path = "../../common/common_errors" [dependencies.token_merge_helper] -path = "../../common/modules/token_merge_helper" \ No newline at end of file +path = "../../common/modules/token_merge_helper" + +[dependencies.energy-factory] +path = "../../locked-asset/energy-factory" \ No newline at end of file diff --git a/legacy-contracts/factory-legacy/src/migration.rs b/legacy-contracts/factory-legacy/src/migration.rs index 393f82a59..653b93aa0 100644 --- a/legacy-contracts/factory-legacy/src/migration.rs +++ b/legacy-contracts/factory-legacy/src/migration.rs @@ -1,23 +1,7 @@ multiversx_sc::imports!(); use common_structs::UnlockEpochAmountPairs; - -mod energy_factory_proxy { - use common_structs::UnlockEpochAmountPairs; - - multiversx_sc::imports!(); - - #[multiversx_sc::proxy] - pub trait EnergyFactoryProxy { - #[endpoint(updateEnergyAfterOldTokenUnlock)] - fn update_energy_after_old_token_unlock( - &self, - original_caller: ManagedAddress, - initial_epoch_amount_pairs: UnlockEpochAmountPairs, - final_epoch_amount_pairs: UnlockEpochAmountPairs, - ); - } -} +use energy_factory::migration::ProxyTrait as _; #[multiversx_sc::module] pub trait LockedTokenMigrationModule: @@ -54,7 +38,7 @@ pub trait LockedTokenMigrationModule: fn new_factory_proxy_builder( &self, sc_address: ManagedAddress, - ) -> energy_factory_proxy::Proxy; + ) -> energy_factory::Proxy; #[storage_mapper("newFactoryAddress")] fn new_factory_address(&self) -> SingleValueMapper; diff --git a/legacy-contracts/factory-legacy/wasm/Cargo.lock b/legacy-contracts/factory-legacy/wasm/Cargo.lock index 50cc43b0b..84827ca96 100644 --- a/legacy-contracts/factory-legacy/wasm/Cargo.lock +++ b/legacy-contracts/factory-legacy/wasm/Cargo.lock @@ -44,12 +44,29 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "energy-factory" +version = "0.0.0" +dependencies = [ + "common_structs", + "legacy_token_decode_module", + "math", + "mergeable", + "multiversx-sc", + "multiversx-sc-modules", + "sc_whitelist_module", + "simple-lock", + "unwrappable", + "utils", +] + [[package]] name = "factory-legacy" version = "0.0.0" dependencies = [ "common_errors", "common_structs", + "energy-factory", "multiversx-sc", "multiversx-sc-modules", "token_merge_helper", @@ -82,6 +99,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "legacy_token_decode_module" +version = "0.0.0" +dependencies = [ + "common_structs", + "multiversx-sc", + "utils", +] + [[package]] name = "math" version = "0.0.0" @@ -210,6 +236,23 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "sc_whitelist_module" +version = "0.0.0" +dependencies = [ + "common_errors", + "multiversx-sc", +] + +[[package]] +name = "simple-lock" +version = "0.0.0" +dependencies = [ + "common_structs", + "multiversx-sc", + "multiversx-sc-modules", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -253,3 +296,13 @@ version = "0.0.0" dependencies = [ "multiversx-sc", ] + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "common_structs", + "fixed-supply-token", + "mergeable", + "multiversx-sc", +]