-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from public-awesome/tasio/royalty-update-fix
Royalty update fix
- Loading branch information
Showing
10 changed files
with
291 additions
and
113 deletions.
There are no files selected for viewing
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
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,2 @@ | ||
pub mod v3_0_0; | ||
pub mod v3_1_0; |
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,15 @@ | ||
use crate::ContractError; | ||
|
||
use cosmwasm_std::{DepsMut, Empty, Env, Event}; | ||
use cw721_base::Extension; | ||
use sg_std::Response; | ||
|
||
pub fn upgrade(deps: DepsMut, _env: &Env, response: Response) -> Result<Response, ContractError> { | ||
let cw17_res = cw721_base::upgrades::v0_17::migrate::<Extension, Empty, Empty, Empty>(deps) | ||
.map_err(|e| ContractError::MigrationError(e.to_string()))?; | ||
|
||
let mut event = Event::new("migrate-3.0.0"); | ||
event = event.add_attributes(cw17_res.attributes); | ||
|
||
Ok(response.add_event(event)) | ||
} |
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,20 @@ | ||
use crate::{ContractError, Sg721Contract}; | ||
|
||
use cosmwasm_std::{DepsMut, Env, Event}; | ||
use cw721_base::Extension; | ||
use sg_std::Response; | ||
|
||
pub fn upgrade(deps: DepsMut, env: &Env, response: Response) -> Result<Response, ContractError> { | ||
let contract = Sg721Contract::<Extension>::default(); | ||
|
||
let royalty_updated_at = env.block.time.minus_seconds(60 * 60 * 24); // 24 hours ago | ||
|
||
contract | ||
.royalty_updated_at | ||
.save(deps.storage, &royalty_updated_at)?; | ||
|
||
let event = Event::new("migrate-3.1.0") | ||
.add_attribute("royalty-updated", royalty_updated_at.to_string()); | ||
|
||
Ok(response.add_event(event)) | ||
} |
Oops, something went wrong.