-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79f13a8
commit 7da1754
Showing
6 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[package] | ||
name = "burn-to-mint" | ||
authors = ["Michael Scotto <m@noreply.publicawsome.com>"] | ||
description = "Burn to mint utility functions" | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
repository = { workspace = true } | ||
license = { workspace = true } | ||
|
||
exclude = [ | ||
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. | ||
"contract.wasm", | ||
"hash.txt", | ||
] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
cosmwasm-schema = { workspace = true } | ||
cosmwasm-std = { workspace = true, features = ["staking"] } | ||
base-factory = { workspace = true } | ||
cw2 = { workspace = true } | ||
cw721 = { workspace = true } | ||
cw721-base = { workspace = true, features = ["library"] } | ||
cw-storage-plus = { workspace = true } | ||
cw-utils = { workspace = true } | ||
schemars = { workspace = true } | ||
serde = { workspace = true } | ||
sg1 = { workspace = true } | ||
sg2 = { workspace = true } | ||
sg4 = { workspace = true } | ||
sg721 = { workspace = true } | ||
sg721-base = { workspace = true, features = ["library"] } | ||
sg-std = { workspace = true } | ||
thiserror = { workspace = true } | ||
url = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use cosmwasm_schema::cw_serde; | ||
use cosmwasm_std::StdError; | ||
use std::env; | ||
|
||
// use crate::error::ContractError; | ||
// use crate::msg::{ConfigResponse, ExecuteMsg, TokenUriMsg}; | ||
// use crate::state::{increment_token_index, Config, COLLECTION_ADDRESS, CONFIG, STATUS}; | ||
pub mod msg; | ||
|
||
use msg::TokenUriMsg; | ||
|
||
#[cfg(not(feature = "library"))] | ||
use cosmwasm_std::{from_binary, to_binary, CosmosMsg, DepsMut, Env, MessageInfo, WasmMsg}; | ||
|
||
use cw721::Cw721ReceiveMsg; | ||
use sg_std::Response; | ||
|
||
#[cw_serde] | ||
pub struct BurnToMint(); | ||
|
||
pub fn execute_burn_to_mint<T>( | ||
info: MessageInfo, | ||
env: Env, | ||
msg: Cw721ReceiveMsg, | ||
execute_mint_msg: T, | ||
) -> Result<Response, StdError> { | ||
let mut res = Response::new(); | ||
let burn_msg = cw721::Cw721ExecuteMsg::Burn { | ||
token_id: msg.token_id, | ||
}; | ||
let cosmos_burn_msg = CosmosMsg::Wasm(WasmMsg::Execute { | ||
contract_addr: info.sender.to_string(), | ||
msg: to_binary(&burn_msg)?, | ||
funds: vec![], | ||
}); | ||
res = res.add_message(cosmos_burn_msg); | ||
let execute_msg = to_binary(&execute_mint_msg)?; | ||
// let execute_mint_msg = to_binary(&execute_mint_msg)?; | ||
let cosmos_mint_msg = CosmosMsg::Wasm(WasmMsg::Execute { | ||
contract_addr: env.contract.address.to_string(), | ||
msg: to_binary(&execute_msg)?, | ||
funds: vec![], | ||
}); | ||
let res = res.add_message(cosmos_mint_msg); | ||
Ok(res) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use cosmwasm_schema::cw_serde; | ||
|
||
#[cw_serde] | ||
pub struct TokenUriMsg { | ||
pub token_uri: String, | ||
} |