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/Secrets.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
interface AzimuthCheck {
function isOwner(uint32 point, address _address) external view returns (bool);
function canManage(uint32 point, address _address) external view returns (bool);
}
contract UrbitSecrets {
event SecretAdded(uint32 indexed by, bytes32 name);
event SecretRemoved(uint32 indexed by, bytes32 name);
// general state
AzimuthCheck public immutable azimuth;
// a mapping of urbit point to name of secret to actual secret
mapping(uint32 => mapping(bytes32 => bytes)) public secrets;
constructor(address azimuthAddress) {
azimuth = AzimuthCheck(azimuthAddress);
}
function setSecret(uint32 point, bytes32 name, bytes calldata secret) public {
// check if the address owns the point by calling azimuth.isOwner and azimuth.canManage.
// If allowed mutate the contract state with the given name and secret
require(
azimuth.isOwner(point, msg.sender) || azimuth.canManage(point, msg.sender),
"Not authorized to set secret for this point"
);
secrets[point][name] = secret;
emit SecretAdded(point, name);
}
function getSecret(uint32 point, bytes32 name) public view returns (bytes memory) {
// check if the address owns the point by calling azimuth.isOwner and azimuth.canManage.
// If allowed check the contract state, get the map under the given point and return the secret
require(
azimuth.isOwner(point, msg.sender) || azimuth.canManage(point, msg.sender),
"Not authorized to get secret for this point"
);
return secrets[point][name];
}
function removeSecret(uint32 point, bytes32 name) public {
require(
azimuth.isOwner(point, msg.sender) || azimuth.canManage(point, msg.sender),
"Not authorized to remove secret for this point"
);
delete secrets[point][name];
emit SecretRemoved(point, name);
}
}
"
}
},
"settings": {
"remappings": [
"@forge-std/=lib/forge-std/src/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"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-10-08 10:52:11
Comments
Log in to comment.
No comments yet.