https://examples.near.org/rust-status-message
You can deploy your smart contract using:
near deploy --wasmFile res/status_message.wasm --accountId YOUR_ACCOUNT_NAME
And we are calling the contract function set_status using:
near call YOUR_ACCOUNT_NAME set_status '{"message": "aloha friend"}' --accountId YOUR_ACCOUNT_NAME
The function is here:
#[near_bindgen]
impl StatusMessage {
pub fn set_status(&mut self, message: String) {
env::log(b"A");
let account_id = env::signer_account_id();
self.records.insert(&account_id, &message);
}
pub fn get_status(&self, account_id: String) -> Option<String> {
env::log(b"A");
return self.records.get(&account_id);
}
}
How does near protocol distinguish between contract?
What if some other contracts have set_status function, which contract function it will call. Also what if I redeploy the contract and run the function. Which contract function will it call?
