Skip to content
Verified contractExactBUSL-1.1

MaseerTreasury

Address0xc8801e1550ce4b69e6a5e00c6279fec79c370f51
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 20,000 runs
EVM version
cancun
License
BUSL-1.1
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
22,340,796
Creation transaction
0xf0d3f45cba…3d5a9b1bbc

src/MaseerTreasury.sol

// SPDX-License-Identifier: BUSL-1.1
// Copyright (c) 2025 Maseer LTD
//
// This file is subject to the Business Source License 1.1.
// You may not use this file except in compliance with the License.
//
// You may obtain a copy of the License at:
// https://github.com/Maseer-LTD/maseer-one/blob/master/LICENSE
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pragma solidity ^0.8.28;

import {MaseerImplementation} from "./MaseerImplementation.sol";

contract MaseerTreasury is MaseerImplementation {

    // Allocating slots 0-49
    uint256[50] private __gap;

    bytes32 internal constant _ISSUER_SLOT   = keccak256("maseer.treasury.issuer");

    function bestow(address usr) external auth {
        _setIssuer(usr, 1);
    }

    function depose(address usr) external auth {
        _setIssuer(usr, 0);
    }

    function issuer(address usr) external view returns (bool) {
        return _getIssuer(usr) == 1;
    }

    function _setIssuer(address usr, uint256 val) internal {
        bytes32 slot = keccak256(abi.encode(_ISSUER_SLOT, usr));
        _setVal(slot, val);
    }

    function _getIssuer(address usr) internal view returns (uint256) {
        bytes32 slot = keccak256(abi.encode(_ISSUER_SLOT, usr));
        return _uint256Slot(slot);
    }
}

src/MaseerImplementation.sol

// SPDX-License-Identifier: BUSL-1.1
// Copyright (c) 2025 Maseer LTD
//
// This file is subject to the Business Source License 1.1.
// You may not use this file except in compliance with the License.
//
// You may obtain a copy of the License at:
// https://github.com/Maseer-LTD/maseer-one/blob/master/LICENSE
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pragma solidity ^0.8.28;

abstract contract MaseerImplementation {

    bytes32 internal constant _WARD_SLOT = keccak256("maseer.wards");

    error NotAuthorized(address usr);
    error UnrecognizedParam(bytes32 param);

    struct StringData {
        string val;
    }

    modifier auth() {
        if (uint256(_getVal(keccak256(abi.encode(_WARD_SLOT, msg.sender)))) != 1) revert NotAuthorized(msg.sender);
        _;
    }

    function rely(address usr) external auth {
        _rely(usr);
    }

    function deny(address usr) external auth {
        _deny(usr);
    }

    function wards(address usr) external view returns (uint256) {
        return uint256(_getVal(keccak256(abi.encode(_WARD_SLOT, usr))));
    }

    function _rely(address usr) internal {
        _setVal(keccak256(abi.encode(_WARD_SLOT, usr)), bytes32(uint256(1)));
    }

    function _deny(address usr) internal {
        _setVal(keccak256(abi.encode(_WARD_SLOT, usr)), bytes32(uint256(0)));
    }

    function _setVal(bytes32 slot, bytes32 val) internal {
        assembly {
            sstore(slot, val)
        }
    }

    function _setVal(bytes32 slot, uint256 val) internal {
        assembly {
            sstore(slot, val)
        }
    }

    function _setVal(bytes32 slot, address val) internal {
        assembly {
            sstore(slot, val)
        }
    }

    function _setVal(bytes32 slot, bool val) internal {
        assembly {
            sstore(slot, val)
        }
    }

    function _setVal(bytes32 slot, string memory val) internal {
        StringData storage data;
        assembly {
            data.slot := slot
        }
        data.val = val;
    }

    function _getVal(bytes32 slot) internal view returns (bytes32 val) {
        assembly {
            val := sload(slot)
        }
    }

    function _uint256Slot(bytes32 slot) internal view returns (uint256) {
        return uint256(_getVal(slot));
    }

    function _addressSlot(bytes32 slot) internal view returns (address) {
        return address(uint160(uint256(_getVal(slot))));
    }

    function _boolSlot(bytes32 slot) internal view returns (bool) {
        return _getVal(slot) == bytes32(uint256(1)) ? true : false;
    }

    function _stringSlot(bytes32 slot) internal view returns (string memory) {
        StringData storage data;
        assembly {
            data.slot := slot
        }
        return data.val;
    }

    function _b32toString(bytes32 _bytes32) internal pure returns (string memory) {
        uint256 length = 0;
        while (length < 32 && _bytes32[length] != 0) {
            length++;
        }

        bytes memory bytesArray = new bytes(length);
        for (uint256 i = 0; i < length; i++) {
            bytesArray[i] = _bytes32[i];
        }

        return string(bytesArray);
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 20000,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=lib/forge-std/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.