From c931dd4dfc8b580e5476af7dbf85054958174604 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 2 Aug 2024 03:15:30 +0400 Subject: [PATCH] feat: pass through burn_from_address and mint_to_address --- .../tokenfactory/schema/execute_msg.json | 12 +++++++++ contracts/tokenfactory/src/contract.rs | 27 +++++++++++++++---- contracts/tokenfactory/src/msg.rs | 2 ++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/contracts/tokenfactory/schema/execute_msg.json b/contracts/tokenfactory/schema/execute_msg.json index 4137274..ba6258e 100644 --- a/contracts/tokenfactory/schema/execute_msg.json +++ b/contracts/tokenfactory/schema/execute_msg.json @@ -64,6 +64,12 @@ }, "denom": { "type": "string" + }, + "mint_to_address": { + "type": [ + "string", + "null" + ] } } } @@ -86,6 +92,12 @@ "amount": { "$ref": "#/definitions/Uint128" }, + "burn_from_address": { + "type": [ + "string", + "null" + ] + }, "denom": { "type": "string" } diff --git a/contracts/tokenfactory/src/contract.rs b/contracts/tokenfactory/src/contract.rs index c66085b..96f7d7b 100644 --- a/contracts/tokenfactory/src/contract.rs +++ b/contracts/tokenfactory/src/contract.rs @@ -33,11 +33,28 @@ pub fn execute( denom, new_admin_address, } => NeutronMsg::submit_change_admin(denom, new_admin_address).into(), - ExecuteMsg::MintTokens { denom, amount } => { - NeutronMsg::submit_mint_tokens(denom, amount, env.contract.address).into() - } - ExecuteMsg::BurnTokens { denom, amount } => { - NeutronMsg::submit_burn_tokens(denom, amount).into() + ExecuteMsg::MintTokens { + denom, + amount, + mint_to_address, + } => NeutronMsg::submit_mint_tokens( + denom, + amount, + mint_to_address.unwrap_or(env.contract.address.into()), + ) + .into(), + ExecuteMsg::BurnTokens { + denom, + amount, + burn_from_address, + } => { + // TODO: update neutron-sdk `submit_burn_tokens` + NeutronMsg::BurnTokens { + denom, + amount, + burn_from_address: burn_from_address.unwrap_or_default(), + } + .into() } ExecuteMsg::SetBeforeSendHook { denom, diff --git a/contracts/tokenfactory/src/msg.rs b/contracts/tokenfactory/src/msg.rs index e163c28..64da292 100644 --- a/contracts/tokenfactory/src/msg.rs +++ b/contracts/tokenfactory/src/msg.rs @@ -18,10 +18,12 @@ pub enum ExecuteMsg { MintTokens { denom: String, amount: Uint128, + mint_to_address: Option, }, BurnTokens { denom: String, amount: Uint128, + burn_from_address: Option, }, SendTokens { recipient: String,