Skip to content

Commit

Permalink
add sotrage writes to set_src20_data
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayStar123 committed Sep 16, 2024
1 parent 29986f1 commit 17809b0
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions examples/src20-native-asset/multi_asset/src/multi_asset.sw
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,32 @@ impl SetSRC20Data for Contract {
}
let sender = msg_sender().unwrap();

SetNameEvent::new(asset, name, sender).log();
SetSymbolEvent::new(asset, symbol, sender).log();
match name {
Some(unwrapped_name) => {
storage.name.get(asset).write_slice(unwrapped_name);
SetNameEvent::new(asset, name, sender).log();
},
None => {
let _ = storage.name.get(asset).clear();
SetNameEvent::new(asset, name, sender).log();
}
}

match symbol {
Some(unwrapped_symbol) => {
storage.symbol.get(asset).write_slice(unwrapped_symbol);
SetSymbolEvent::new(asset, symbol, sender).log();
},
None => {
let _ = storage.symbol.get(asset).clear();
SetSymbolEvent::new(asset, symbol, sender).log();
}
}

storage.decimals.get(asset).write(decimals);
SetDecimalsEvent::new(asset, decimals, sender).log();

storage.total_supply.get(asset).write(supply);
TotalSupplyEvent::new(asset, supply, sender).log();
}
}

0 comments on commit 17809b0

Please sign in to comment.