Skip to content

Commit

Permalink
Merge pull request #263 from public-awesome/no-cost-manual-renew
Browse files Browse the repository at this point in the history
allow no-cost manual renewal
  • Loading branch information
jhernandezb authored Oct 1, 2024
2 parents 481b02e + fed1b89 commit 179edd1
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 26 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["packages/*", "contracts/*"]
resolver = "2"

[workspace.package]
version = "2.2.0"
version = "2.2.1"
edition = "2021"
homepage = "https://stargaze.zone"
repository = "https://github.com/public-awesome/names"
Expand Down
31 changes: 31 additions & 0 deletions contract_code_ids.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name_marketplace.wasm:
code_id:4289, 4320, 4399
contract_address:
stars1vs72epl4v9cd53wyeh57lk9595txf2w7k4764qhr5fxyt50xcksq8kyc9w
stars1xg2dhc22makmn93e72agwa86clshha2jwtm0l2kgduqfl5qaplmqngrln4
stars1m4nkl9a7grq0es95aggz75pdt033nk4aghvkr74ywx9f4mm69qhsrsqjkw

name_minter.wasm:
code_id: 4290
contract_address:stars15689t72jjnpd0y78vnrcw0ssz0y7hx5v0etq6gysygw66kcz6u0q9duh0g
stars1evwy29sv74rtzl7gpp2slgml3732dp00eagq0jmsg0h7eutglluq49u0h7
stars17m20l2xfrlceygdmjfjqf0xwua7jnqrvn4c0jdjfskdavkuykhrq8zdvfn

sg721_name.wasm:
code_id: 4291
{
"image": "ipfs://example.com",
"collection_name": "Name Tokens",
"sg721_names_addr": "stars1k4kxtwjp94c4uz3fdfpr965zxferz4d8e7lw232umnns48hzgkvq2fm9j4"
stars1wgd2sqfk6tya6lhx37fcstwehjvlw22rn69d9fvlwypea6vg87gsl9pal6
}


whitelist_updatable.wasm:
code_id:4177
contract_address:

whitelist_updatable_flatrate.wasm:
tx:
code_id: 4178
contract_address:
2 changes: 1 addition & 1 deletion contracts/marketplace/schema/name-marketplace.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "name-marketplace",
"contract_version": "2.2.0",
"contract_version": "2.2.1",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
28 changes: 16 additions & 12 deletions contracts/marketplace/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,29 +541,33 @@ pub fn execute_renew(
.querier
.query_wasm_smart::<NameMinterParams>(name_minter, &SgNameMinterQueryMsg::Params {})?;

let (renewal_price, _valid_bid) = get_renewal_price_and_bid(
let (renewal_price, valid_bid) = get_renewal_price_and_bid(
deps.as_ref(),
&env.block.time,
&sudo_params,
&ask.token_id,
name_minter_params.base_price.u128(),
)?;
let mut final_price = renewal_price;
if let Some(_bid) = valid_bid {
let payment = may_pay(&info, NATIVE_DENOM)?;

let payment = may_pay(&info, NATIVE_DENOM)?;
ask.renewal_fund += payment;

ask.renewal_fund += payment;

ensure!(
ask.renewal_fund >= renewal_price,
ContractError::InsufficientRenewalFunds {
expected: coin(renewal_price.u128(), NATIVE_DENOM),
actual: coin(ask.renewal_fund.u128(), NATIVE_DENOM),
}
);
ensure!(
ask.renewal_fund >= renewal_price,
ContractError::InsufficientRenewalFunds {
expected: coin(renewal_price.u128(), NATIVE_DENOM),
actual: coin(ask.renewal_fund.u128(), NATIVE_DENOM),
}
);
} else {
final_price = Uint128::zero();
}

let mut response = Response::new();

response = renew_name(deps, &env, &sudo_params, ask, renewal_price, response)?;
response = renew_name(deps, &env, &sudo_params, ask, final_price, response)?;

Ok(response)
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/name-minter/schema/name-minter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "name-minter",
"contract_version": "2.2.0",
"contract_version": "2.2.1",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
2 changes: 1 addition & 1 deletion contracts/sg721-name/schema/sg721-name.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "sg721-name",
"contract_version": "2.2.0",
"contract_version": "2.2.1",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down

0 comments on commit 179edd1

Please sign in to comment.