Skip to content

Commit

Permalink
get(asset) for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayStar123 committed Sep 11, 2024
1 parent 6948958 commit 2ebb457
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/src6-vault/multi_asset_vault/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,27 @@ impl SetSRC20Data for Contract {

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

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

storage.decimals.write(decimals);
storage.decimals.get(asset).write(decimals);
SetDecimalsEvent::new(asset, decimals, sender).log();
}
}
Expand Down
10 changes: 5 additions & 5 deletions examples/src6-vault/single_asset_vault/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -224,27 +224,27 @@ impl SetSRC20Data for Contract {

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

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

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

0 comments on commit 2ebb457

Please sign in to comment.