From 853f5506bf7060450e55c16335713168413c79f2 Mon Sep 17 00:00:00 2001 From: mx819812523 Date: Mon, 20 Jan 2025 11:05:34 +0800 Subject: [PATCH 1/4] lp xp --- apps/rooch_dex/sources/liquid_xp.move | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 apps/rooch_dex/sources/liquid_xp.move diff --git a/apps/rooch_dex/sources/liquid_xp.move b/apps/rooch_dex/sources/liquid_xp.move new file mode 100644 index 0000000000..f1cb0f633f --- /dev/null +++ b/apps/rooch_dex/sources/liquid_xp.move @@ -0,0 +1,28 @@ +module rooch_dex::liquid_xp { + + use std::option; + use std::signer::address_of; + use std::string; + use rooch_framework::account_coin_store; + use moveos_std::object; + use rooch_framework::coin; + + struct LiquidXP has key, store {} + + const DECIMALS: u8 = 0u8; + const TOTAL_SUPPLY: u256 = 210_000_000_000u256; + const LPXP_URL: vector = b" "; + + fun init(signer: &signer) { + let coin_info_obj = coin::register_extend( + string::utf8(b"Rooch Dex Liquid XP"), + string::utf8(b"LPXP"), + option::some(string::utf8(LPXP_URL)), + DECIMALS, + ); + let coin = coin::mint_extend(&mut coin_info_obj, TOTAL_SUPPLY); + object::to_frozen(coin_info_obj); + account_coin_store::deposit(address_of(signer), coin); + } + +} From 6b0d31f75ffd8d5806bff504cbc585211b2e2cfe Mon Sep 17 00:00:00 2001 From: mx819812523 Date: Mon, 20 Jan 2025 11:07:26 +0800 Subject: [PATCH 2/4] fix: icon url character --- apps/rooch_dex/sources/liquid_xp.move | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/rooch_dex/sources/liquid_xp.move b/apps/rooch_dex/sources/liquid_xp.move index f1cb0f633f..2bf7f55df0 100644 --- a/apps/rooch_dex/sources/liquid_xp.move +++ b/apps/rooch_dex/sources/liquid_xp.move @@ -11,7 +11,7 @@ module rooch_dex::liquid_xp { const DECIMALS: u8 = 0u8; const TOTAL_SUPPLY: u256 = 210_000_000_000u256; - const LPXP_URL: vector = b" "; + const LPXP_URL: vector = b" "; fun init(signer: &signer) { let coin_info_obj = coin::register_extend( From 1a07941f3ecbbc34b0f2dd0640c246143301e66e Mon Sep 17 00:00:00 2001 From: mx819812523 Date: Mon, 20 Jan 2025 17:37:30 +0800 Subject: [PATCH 3/4] fix: update coin info function --- apps/rooch_dex/sources/swap.move | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/rooch_dex/sources/swap.move b/apps/rooch_dex/sources/swap.move index 29b2a564b8..2f024b7406 100644 --- a/apps/rooch_dex/sources/swap.move +++ b/apps/rooch_dex/sources/swap.move @@ -15,7 +15,7 @@ module rooch_dex::swap { use moveos_std::tx_context::sender; use moveos_std::object; use moveos_std::account; - use rooch_framework::coin::{CoinInfo, coin_info}; + use rooch_framework::coin::{CoinInfo, coin_info, symbol_by_type, supply_by_type}; use moveos_std::object::{Object, ObjectID}; use rooch_framework::coin_store::{CoinStore, balance, deposit, withdraw}; use rooch_framework::coin_store; @@ -123,8 +123,8 @@ module rooch_dex::swap { let resource_signer = module_signer(); let lp_name: string::String = string::utf8(b"RoochDex-"); - let name_x = coin::symbol(coin_info()); - let name_y = coin::symbol(coin_info()); + let name_x = symbol_by_type(); + let name_y = symbol_by_type(); string::append(&mut lp_name, name_x); string::append_utf8(&mut lp_name, b"-"); string::append(&mut lp_name, name_y); @@ -189,7 +189,7 @@ module rooch_dex::swap { /// Get the total supply of LP Tokens public fun total_lp_supply(): u128 { - (coin::supply(coin_info>()) as u128) + (supply_by_type>() as u128) } /// Get the current reserves of T0 and T1 with the latest updated timestamp From 867f7d95b2d2d5bfeca082fcc90931f9c1c1480c Mon Sep 17 00:00:00 2001 From: mx819812523 Date: Mon, 20 Jan 2025 18:12:35 +0800 Subject: [PATCH 4/4] fix: get signer from module_signer --- apps/rooch_dex/sources/liquid_xp.move | 6 ++++-- apps/rooch_dex/sources/swap.move | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/rooch_dex/sources/liquid_xp.move b/apps/rooch_dex/sources/liquid_xp.move index 2bf7f55df0..0972490588 100644 --- a/apps/rooch_dex/sources/liquid_xp.move +++ b/apps/rooch_dex/sources/liquid_xp.move @@ -3,6 +3,7 @@ module rooch_dex::liquid_xp { use std::option; use std::signer::address_of; use std::string; + use moveos_std::signer::module_signer; use rooch_framework::account_coin_store; use moveos_std::object; use rooch_framework::coin; @@ -13,7 +14,8 @@ module rooch_dex::liquid_xp { const TOTAL_SUPPLY: u256 = 210_000_000_000u256; const LPXP_URL: vector = b" "; - fun init(signer: &signer) { + fun init() { + let signer = module_signer(); let coin_info_obj = coin::register_extend( string::utf8(b"Rooch Dex Liquid XP"), string::utf8(b"LPXP"), @@ -22,7 +24,7 @@ module rooch_dex::liquid_xp { ); let coin = coin::mint_extend(&mut coin_info_obj, TOTAL_SUPPLY); object::to_frozen(coin_info_obj); - account_coin_store::deposit(address_of(signer), coin); + account_coin_store::deposit(address_of(&signer), coin); } } diff --git a/apps/rooch_dex/sources/swap.move b/apps/rooch_dex/sources/swap.move index 2f024b7406..b45e7b75db 100644 --- a/apps/rooch_dex/sources/swap.move +++ b/apps/rooch_dex/sources/swap.move @@ -15,7 +15,7 @@ module rooch_dex::swap { use moveos_std::tx_context::sender; use moveos_std::object; use moveos_std::account; - use rooch_framework::coin::{CoinInfo, coin_info, symbol_by_type, supply_by_type}; + use rooch_framework::coin::{CoinInfo, symbol_by_type, supply_by_type}; use moveos_std::object::{Object, ObjectID}; use rooch_framework::coin_store::{CoinStore, balance, deposit, withdraw}; use rooch_framework::coin_store;