From d8efab77aa9a6e0b3d09172cc89983575b9b5c99 Mon Sep 17 00:00:00 2001 From: leovct Date: Wed, 25 Sep 2024 12:34:05 +0200 Subject: [PATCH] feat: add ethernaut lvl 19 --- src/EthernautCTF/AlienCode.sol | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/EthernautCTF/AlienCode.sol diff --git a/src/EthernautCTF/AlienCode.sol b/src/EthernautCTF/AlienCode.sol new file mode 100644 index 0000000..71a9e95 --- /dev/null +++ b/src/EthernautCTF/AlienCode.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.5.0; + +import '@openzeppelin-05/ownership/Ownable.sol'; + +contract AlienCodex is Ownable { + bool public contact; + bytes32[] public codex; + + modifier contacted() { + assert(contact); + _; + } + + function makeContact() public { + contact = true; + } + + function record(bytes32 _content) public contacted { + codex.push(_content); + } + + function retract() public contacted { + codex.length--; + } + + function revise(uint256 i, bytes32 _content) public contacted { + codex[i] = _content; + } +}