Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
bitzoic committed Nov 12, 2024
1 parent d2539a3 commit e378fe2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
20 changes: 8 additions & 12 deletions examples/src15-offchain-metadata/multi_asset/src/multi_asset.sw
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
contract;

use standards::{
src15::{
SRC15MetadataEvent,
},
src20::{
SetDecimalsEvent,
SetNameEvent,
Expand All @@ -11,9 +14,6 @@ use standards::{
src7::{
Metadata,
},
src15::{
SRC15MetadataEvent,
},
};

use std::{hash::Hash, storage::storage_string::*, string::String};
Expand Down Expand Up @@ -49,7 +49,7 @@ impl EmitSRC15Events for Contract {
fn emit_src15_events(asset: AssetId, svg_image: String, health_attribute: u64) {
// NOTE: There are no checks for if the caller has permissions to emit the metadata
// NOTE: Nothing is stored in storage and there is no method to retrieve the configurables.

// If this asset does not exist, revert
if storage.total_supply.get(asset).try_read().is_none() {
revert(0);
Expand All @@ -61,14 +61,10 @@ impl EmitSRC15Events for Contract {
let metadata_3 = Metadata::String(svg_image);
let metadata_4 = Metadata::Int(health_attribute);

SRC15MetadataEvent::new(asset, metadata_1, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_2, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_3, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_4, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_1, sender).log();
SRC15MetadataEvent::new(asset, metadata_2, sender).log();
SRC15MetadataEvent::new(asset, metadata_3, sender).log();
SRC15MetadataEvent::new(asset, metadata_4, sender).log();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
contract;

use standards::{
src15::{
SRC15MetadataEvent,
},
src20::{
SetDecimalsEvent,
SetNameEvent,
Expand All @@ -11,9 +14,6 @@ use standards::{
src7::{
Metadata,
},
src15::{
SRC15MetadataEvent,
},
};

use std::string::String;
Expand Down Expand Up @@ -49,12 +49,9 @@ impl EmitSRC15Events for Contract {
let metadata_2 = Metadata::String(String::from_ascii_str(from_str_array(SITE_FORUM)));
let metadata_3 = Metadata::Int(ATTR_HEALTH);

SRC15MetadataEvent::new(asset, metadata_1, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_2, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_3, sender)
.log();
SRC15MetadataEvent::new(asset, metadata_1, sender).log();
SRC15MetadataEvent::new(asset, metadata_2, sender).log();
SRC15MetadataEvent::new(asset, metadata_3, sender).log();
}
}

Expand Down
6 changes: 1 addition & 5 deletions standards/src/src15.sw
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ impl SRC15MetadataEvent {
/// assert(my_src15_metadata_event.sender == sender);
/// }
/// ```
pub fn new(
asset: AssetId,
metadata: Metadata,
sender: Identity,
) -> Self {
pub fn new(asset: AssetId, metadata: Metadata, sender: Identity) -> Self {
Self {
asset,
metadata,
Expand Down

0 comments on commit e378fe2

Please sign in to comment.