The Decorator
Layering curses upon an existing geas without altering its core essence.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Enchantment // Layering
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// IMMUTABLE DECENTRALIZED PACT //
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IGeas {
function getPotency() external view returns (uint256);
}
contract BaseGeas is IGeas {
function getPotency() external pure override returns (uint256) {
return 100;
}
}
abstract contract GeasModifier is IGeas {
IGeas public baseGeas;
constructor(address _geas) {
baseGeas = IGeas(_geas);
}
}
contract BloodCurse is GeasModifier {
constructor(address _geas) GeasModifier(_geas) {}
function getPotency() external view override returns (uint256) {
return baseGeas.getPotency() + 50;
}
}
contract VoidTaint is GeasModifier {
constructor(address _geas) GeasModifier(_geas) {}
function getPotency() external view override returns (uint256) {
return baseGeas.getPotency() * 2;
}
}
The Decorator allows for the dynamic wrapping of a smart contract with additional layers of curses and taints. Each layer wraps the previous, amplifying the total potency of the geas on the decentralized ledger.
Runic Tags:
#solidity
#structural
#decorator