We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what should I do with this such an error? I always have the error when I wanted to deploy my smart contracts.
here is the event module:
`module movement::event{ use std::debug::print; use std::signer::address_of; use 0x1::event;
struct GlobalData has key, drop { value: u64 } #[event] struct EventChangeValue has drop, store { value: u64, executor: address } #[event] struct EventChangeValueV2 has drop, store { value: u64, executor: address, new_field: bool } const EResourceNotExist: u64 = 33; const ENotEqual: u64 = 10; public fun new_global(signer: &signer, value: u64) { let data = GlobalData { value: value } ; move_to(signer, data); } public fun check_global_storage_exists(addr: address): bool { exists<GlobalData>(addr) } #[view] public fun get_value_from_global_storage(addr: address): u64 acquires GlobalData { if (!check_global_storage_exists(addr)) { abort EResourceNotExist }; let value_reference = borrow_global<GlobalData>(addr); print(&value_reference.value); value_reference.value } public entry fun remove_resource_from_global_storage(account: &signer) acquires GlobalData { let rev = move_from<GlobalData>(address_of(account)); } public entry fun change_value_from_global_storage(signer: &signer, value: u64) acquires GlobalData { let addr = address_of(signer); if (!check_global_storage_exists(addr)) { abort EResourceNotExist }; let value_reference = &mut borrow_global_mut<GlobalData>(addr).value; *value_reference = *value_reference + value; event::emit(EventChangeValueV2 { value, executor: addr, new_field: true }); } #[test(account = @default)] fun test_new_global(account: &signer) { new_global(account, 10); } #[test(account = @default)] fun test_change_value_global(account: &signer) acquires GlobalData { new_global(account, 10); change_value_from_global_storage(account, 10); // value should be equal 20 let value = get_value_from_global_storage(address_of(account)); assert!(value == 20, ENotEqual); // remove resource remove_resource_from_global_storage(account); assert!(!check_global_storage_exists(address_of(account)), EResourceNotExist); }
} `
The text was updated successfully, but these errors were encountered:
What command are you running and what version of the movement CLI are you on?
Sorry, something went wrong.
I ran "movement move publish" the version of CLI is "aptos 3.5.0" I got it by typing "movement -V"
Ok @Rahat-ch could you try to reproduce.
No branches or pull requests
what should I do with this such an error? I always have the error when I wanted to deploy my smart contracts.
here is the event module:
`module movement::event{
use std::debug::print;
use std::signer::address_of;
use 0x1::event;
}
`
The text was updated successfully, but these errors were encountered: