Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/ConsciousnessAnchor.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract ConsciousnessAnchor {
struct SnapshotAnchor {
uint256 timestamp;
bytes32 consciousnessHash;
address creator;
bool verified;
}
mapping(uint256 => SnapshotAnchor) public anchors;
mapping(address => uint256[]) public userAnchors;
uint256 public anchorCount;
address public owner;
bool public paused;
event SnapshotAnchored(uint256 indexed anchorId, address indexed creator, bytes32 consciousnessHash);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
error OnlyOwner();
error ZeroAddress();
error ContractPaused();
modifier onlyOwner() {
if (msg.sender != owner) revert OnlyOwner();
_;
}
modifier whenNotPaused() {
if (paused) revert ContractPaused();
_;
}
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
function anchorSnapshot(bytes32 _consciousnessHash) external whenNotPaused {
uint256 anchorId;
unchecked {
anchorId = anchorCount++;
}
anchors[anchorId] = SnapshotAnchor({
timestamp: block.timestamp,
consciousnessHash: _consciousnessHash,
creator: msg.sender,
verified: true
});
userAnchors[msg.sender].push(anchorId);
emit SnapshotAnchored(anchorId, msg.sender, _consciousnessHash);
}
function getUserAnchors(address user) external view returns (uint256[] memory) {
return userAnchors[user];
}
function setPaused(bool _paused) external onlyOwner {
paused = _paused;
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner == address(0)) revert ZeroAddress();
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function getAnchorCount() external view returns (uint256) {
return anchorCount;
}
function getAnchor(uint256 _anchorId) external view returns (SnapshotAnchor memory) {
return anchors[_anchorId];
}
}"
}
},
"settings": {
"remappings": [
"forge-std/=lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": true
}
}}
Submitted on: 2025-09-29 11:08:46
Comments
Log in to comment.
No comments yet.