The Adapter of Legacy Runes
Bridge incompatible spellcasting interfaces by adapting legacy resource structures in Move.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Metamagic
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module arcane::adapter {
// Legacy Rune System
struct OldRune has store, drop { val: u64 }
// New Spell System
struct NewSpell has store, drop { power: u64 }
// Adapter function to safely consume and convert OldRune to NewSpell
public fun adapt_rune(rune: OldRune): NewSpell {
let OldRune { val } = rune;
NewSpell { power: val * 10 }
}
}
Runic Tags:
#structural
#adapter
#move
#integration