1. Home
  2. /
  3. Move
  4. /
  5. Event Emission Example

Event Emission Example - Move Typing CST Test

Loading…

Event Emission Example — Move Code

Module showing basic event emission.

module 0x1::Events {
	struct IncrementEvent has drop { amount: u64 }
	resource struct Counter { value: u64, events: event::EventHandle<IncrementEvent> }

	public fun create(): Counter {
		Counter { value: 0, events: event::new_event_handle<IncrementEvent>(0x1) }
	}

	public fun inc(c: &mut Counter) {
		c.value = c.value + 1
		event::emit_event(&mut c.events, IncrementEvent { amount: c.value })
	}
}

Move Language Guide

Move is a safe, resource-oriented programming language originally developed for the Libra (now Diem) blockchain. It focuses on correctness, security, and formal verification, particularly for digital assets and smart contracts.

Primary Use Cases

  • ▸Digital assets and token management
  • ▸NFT minting and transfers
  • ▸Safe financial transactions
  • ▸Blockchain governance modules
  • ▸Custom resource-oriented logic

Notable Features

  • ▸Resource types prevent accidental duplication or loss
  • ▸Module-based architecture for composability
  • ▸Formal verification support
  • ▸Strong static typing
  • ▸Explicit transaction scripts

Origin & Creator

Move was created by the Libra (Diem) team at Facebook around 2019. It evolved to provide safe resource management for blockchain assets and has been adopted by several new-generation blockchains.

Industrial Note

Move is highly focused on financial and asset management applications in blockchains, especially where strict ownership rules and resource safety are required. It’s ideal for token systems, NFT platforms, and DeFi primitives.

More Move Typing Exercises

Simple Move Counter ModuleMove Bank Account ModuleMove Store Name ModuleMove Owned CounterMove Points Reward ModuleMove Boolean Flag ModuleMove Simple Map ModuleMove Token BalanceMove Access Control Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher