Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,20 @@ Now, let’s move forward and add abilities to the `Calculator` struct that we d
module metaschool::calculator {
use std::signer;

// Rsource with key ability
// Resource with key ability
struct Calculator has key {
result: u64,
}

// Function acquires the Calculator resource
// Function acquires the Calculator resource
fun create_calculator(account: &signer) acquires Calculator {

// We check if the signer address already has a Calculator resource
// associated to it
// We check if the signer address already has a Calculator resource
// associated to it
if (exists<Calculator>(signer::address_of(account))){

// Here, we are using borrow_global_mut to fetch the Calculator resource
// associated with the signer address
// Here, we are using borrow_global_mut to fetch the Calculator resource
// associated with the signer address
let calculator = borrow_global_mut<Calculator>(signer::address_of(account));
calculator.result = 0;
}
Expand Down