-
I am reading through guide 3.1 from the Sway Book, which is documenting smart contracts. In one of the code snippets, the following function is introduced: #[storage(read, write)]
fn receive_funds() {
if msg_asset_id() == BASE_ASSET_ID {
// If we received `BASE_ASSET_ID` then keep track of the balance.
// Otherwise, we're receiving other native assets and don't care
// about our balance of tokens.
storage.balance += msg_amount();
}
} However, I can't see a definition for a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
OTOH maybe it was left out to try to avoid introducing too many new concepts at once. @mohammadfawaz @Braqzen |
Beta Was this translation helpful? Give feedback.
storage.balance
is referring to a storage variable as per this section. It looks like it might be good to update the earlier example you're referring to to include a storage declaration:OTOH maybe it was left out to try to avoid introducing too many new concepts at once. @mohammadfawaz @Braqzen