BNTYRegistry

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/BNTYRegistry.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title BNTYRegistry
 * @dev Central registry for the BNTY recruiting bounty system
 */
contract BNTYRegistry is Ownable {

    // Council fee in basis points (e.g., 500 = 5%)
    uint256 public councilFeeBps;

    // Council split is hardcoded to 25%
    uint256 public constant COUNCIL_SPLIT_BPS = 2500; // 25%

    // Role mappings
    mapping(address => bool) public councilMembers;
    mapping(address => bool) public bountyHunters;
    mapping(address => bool) public bondDealers;

    // Arrays for enumeration
    address[] public councilMembersList;
    address[] public bountyHuntersList;
    address[] public bondDealersList;

    // Contract addresses
    address public bountyContract;
    address public bountyHunterContract;
    address public facilitatorContract;
    address public holdingContract;
    address public usdcToken;

    // Events
    event CouncilMemberAdded(address indexed member);
    event CouncilMemberRemoved(address indexed member);
    event BountyHunterAdded(address indexed hunter);
    event BountyHunterRemoved(address indexed hunter);
    event BondDealerAdded(address indexed dealer);
    event BondDealerRemoved(address indexed dealer);
    event ContractAddressUpdated(string contractType, address contractAddress);
    event CouncilFeeUpdated(uint256 newFeeBps);

    constructor(uint256 _councilFeeBps) Ownable(msg.sender) {
        require(_councilFeeBps <= 10000, "Fee cannot exceed 100%");
        councilFeeBps = _councilFeeBps;
    }

    // Council Management
    function addCouncilMember(address _member) external onlyOwner {
        require(_member != address(0), "Invalid address");
        require(!councilMembers[_member], "Already a council member");

        councilMembers[_member] = true;
        councilMembersList.push(_member);
        emit CouncilMemberAdded(_member);
    }

    function removeCouncilMember(address _member) external onlyOwner {
        require(councilMembers[_member], "Not a council member");

        councilMembers[_member] = false;
        _removeFromArray(councilMembersList, _member);
        emit CouncilMemberRemoved(_member);
    }

    // Bounty Hunter Management
    function addBountyHunter(address _hunter) external {
        require(msg.sender == facilitatorContract, "Only facilitator can add");
        require(_hunter != address(0), "Invalid address");
        require(!bountyHunters[_hunter], "Already a bounty hunter");

        bountyHunters[_hunter] = true;
        bountyHuntersList.push(_hunter);
        emit BountyHunterAdded(_hunter);
    }

    function removeBountyHunter(address _hunter) external {
        require(msg.sender == facilitatorContract, "Only facilitator can remove");
        require(bountyHunters[_hunter], "Not a bounty hunter");

        bountyHunters[_hunter] = false;
        _removeFromArray(bountyHuntersList, _hunter);
        emit BountyHunterRemoved(_hunter);
    }

    // Bond Dealer Management
    function addBondDealer(address _dealer) external onlyOwner {
        require(_dealer != address(0), "Invalid address");
        require(!bondDealers[_dealer], "Already a bond dealer");

        bondDealers[_dealer] = true;
        bondDealersList.push(_dealer);
        emit BondDealerAdded(_dealer);
    }

    function removeBondDealer(address _dealer) external onlyOwner {
        require(bondDealers[_dealer], "Not a bond dealer");

        bondDealers[_dealer] = false;
        _removeFromArray(bondDealersList, _dealer);
        emit BondDealerRemoved(_dealer);
    }

    // Contract Address Management
    function setBountyContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Invalid address");
        bountyContract = _contract;
        emit ContractAddressUpdated("Bounty", _contract);
    }

    function setBountyHunterContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Invalid address");
        bountyHunterContract = _contract;
        emit ContractAddressUpdated("BountyHunter", _contract);
    }

    function setFacilitatorContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Invalid address");
        facilitatorContract = _contract;
        emit ContractAddressUpdated("Facilitator", _contract);
    }

    function setHoldingContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Invalid address");
        holdingContract = _contract;
        emit ContractAddressUpdated("Holding", _contract);
    }

    function setUsdcToken(address _token) external onlyOwner {
        require(_token != address(0), "Invalid address");
        usdcToken = _token;
        emit ContractAddressUpdated("USDC", _token);
    }

    // Fee Management
    function setCouncilFee(uint256 _feeBps) external onlyOwner {
        require(_feeBps <= 10000, "Fee cannot exceed 100%");
        councilFeeBps = _feeBps;
        emit CouncilFeeUpdated(_feeBps);
    }

    // View Functions
    function isCouncilMember(address _addr) external view returns (bool) {
        return councilMembers[_addr];
    }

    function isBountyHunter(address _addr) external view returns (bool) {
        return bountyHunters[_addr];
    }

    function isBondDealer(address _addr) external view returns (bool) {
        return bondDealers[_addr];
    }

    function getCouncilMembersCount() external view returns (uint256) {
        return councilMembersList.length;
    }

    function getBountyHuntersCount() external view returns (uint256) {
        return bountyHuntersList.length;
    }

    function getBondDealersCount() external view returns (uint256) {
        return bondDealersList.length;
    }

    // Internal helper
    function _removeFromArray(address[] storage arr, address _addr) internal {
        for (uint256 i = 0; i < arr.length; i++) {
            if (arr[i] == _addr) {
                arr[i] = arr[arr.length - 1];
                arr.pop();
                break;
            }
        }
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
"
    }
  },
  "settings": {
    "remappings": [
      "@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": false,
      "runs": 200
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "prague",
    "viaIR": false
  }
}}

Tags:
Multisig, Multi-Signature, Factory|addr:0x7708b7083c90ebc422ae8ef965bd8619a7d5ea75|verified:true|block:23608395|tx:0xf0f57ead29f647c68caf7c42b3feabec7b995435da0fdc4e56928e0674338f93|first_check:1760865476

Submitted on: 2025-10-19 11:17:58

Comments

Log in to comment.

No comments yet.