The Mediator of Magical Treaties
Define an object that encapsulates how a set of objects interact, promoting loose coupling in Move.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Enchantment // Diplomacy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module arcane::mediator {
struct Registry has key {
wizards: u64,
warlocks: u64,
}
// Mediator function handling interactions between wizards and warlocks via global state
public fun negotiate_truce(registry_addr: address) acquires Registry {
let registry = borrow_global_mut<Registry>(registry_addr);
registry.wizards = registry.wizards + 1;
registry.warlocks = registry.warlocks + 1;
}
}
Runic Tags:
#behavioral
#mediator
#move
#decoupling