UrbitSecrets

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 => bytes32)) public secrets;

    constructor(address azimuthAddress) {
        azimuth = AzimuthCheck(azimuthAddress);
    }

    function setSecret(uint32 point, bytes32 name, bytes32 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 (bytes32) {
        // 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
  }
}}

Tags:
Factory|addr:0x0cdcfb44afd1cdd37c2a9ce0aaa56dd2d3222357|verified:true|block:23531235|tx:0x0b52a6d71691537aaebee89457f39ff36dbf6d1743ef5430c7adbfbccdca8d93|first_check:1759913140

Submitted on: 2025-10-08 10:45:40

Comments

Log in to comment.

No comments yet.