IssueToken

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": {
    "@openzeppelin/contracts/token/ERC20/ERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys a `value` amount of tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 value) public virtual {
        _burn(_msgSender(), value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, deducting from
     * the caller's allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `value`.
     */
    function burnFrom(address account, uint256 value) public virtual {
        _spendAllowance(account, _msgSender(), value);
        _burn(account, value);
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.20;

import {IERC20Permit} from "./IERC20Permit.sol";
import {ERC20} from "../ERC20.sol";
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
import {EIP712} from "../../../utils/cryptography/EIP712.sol";
import {Nonces} from "../../../utils/Nonces.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {
    bytes32 private constant PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Permit deadline has expired.
     */
    error ERC2612ExpiredSignature(uint256 deadline);

    /**
     * @dev Mismatched signature.
     */
    error ERC2612InvalidSigner(address signer, address owner);

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @inheritdoc IERC20Permit
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        if (block.timestamp > deadline) {
            revert ERC2612ExpiredSignature(deadline);
        }

        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        if (signer != owner) {
            revert ERC2612InvalidSigner(signer, owner);
        }

        _approve(owner, spender, value);
    }

    /**
     * @inheritdoc IERC20Permit
     */
    function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {
        return super.nonces(owner);
    }

    /**
     * @inheritdoc IERC20Permit
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {
        return _domainSeparatorV4();
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
"
    },
    "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
"
    },
    "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC721/IERC721.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
     *   {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}
"
    },
    "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

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

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}
"
    },
    "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
"
    },
    "contracts/ExecutivePeerTreasury.sol": {
      "content": "// SPDX-License-Identifier: Unlicensed\r
// Copyright 2017-2025 US Fintech LLC\r
// \r
// Permission to use, copy, modify, or distribute this software is strictly prohibited\r
// without prior written consent from US Fintech LLC.\r
// \r
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\r
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\r
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY\r
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,\r
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
// OFFICIAL DEL NORTE NETWORK COMPONENT\r
// ExecutivePeerTreasury is a contract that allows for the transfer of ETH and ERC20 tokens between different contracts.\r
// Designed by Ken Silverman as part of his ElasticTreasury (HUB and SPOKE), PeerTreasury and Controller-based eco-system.   \r
// Permission to change metadata stored on blockchain explorers exclusively reserved to US Fintech, LLC.\r
pragma solidity 0.8.30;\r
\r
import "../interfaces/IController.sol";\r
import "./TreasuryConstants.sol";\r
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";\r
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\r
\r
// Earlier versions Compiled by Maleeha Naveed. May 5th, 2025\r
// ExecutivePeerTreasury is a contract that allows for the transfer of ETH and ERC20 tokens between different contracts.\r
/// @author Ken Silverman \r
// - first decentralized RWA management architect, est. 2017.\r
contract ExecutivePeerTreasury is TreasuryConstants {\r
\r
    using SafeERC20 for IERC20;\r
    \r
    event PeerTreasuryReceivedETH(address indexed sender, uint256 amount);\r
    event PeerTreasuryReceivedTokens(address indexed sender, address indexed token, uint256 amount);\r
    event PeerTreasuryTransferredETH(address indexed to, uint256 amount);\r
    event PeerTreasuryTransferredTokens(address indexed to, address indexed token, uint256 amount);\r
    event ExecutiveWithdrawalEvent(address indexed adminCaller, address indexed receiver, uint256 amt, string note, address tokenOrZero);\r
\r
\r
    struct TreasuryEntry {\r
        uint256 totalReceived;\r
        uint256 totalWithdrawn;\r
    }\r
\r
    struct Withdrawal{\r
        address to;\r
        address asset;\r
        uint256 amt;\r
        string note;\r
    }\r
\r
    address public immutable peerTreasuryController;\r
\r
    mapping(address => TreasuryEntry) private tokenPeerTreasury;\r
    address[] internal knownTokens; // <-- Needed for enumeration\r
\r
    TreasuryEntry private ethPeerTreasury;\r
    Withdrawal[] private withdrawals; // Track all executive withdrawals\r
\r
    modifier onlyTreasuryAdmin() {\r
        require(\r
            IController(peerTreasuryController).isOfficialDoubleEntityFast(KECCAK_TREASURY_ADMIN, msg.sender, KECCAK_SMART_CONTRACT, msg.sender, false),\r
            "Unauthorized"\r
        );\r
        _;\r
    }\r
\r
    constructor(address _controller, string memory _contractName) {\r
        peerTreasuryController = _controller;\r
        IController(_controller).init(address(this), _contractName);\r
    }\r
\r
    // EMERGENCY withdraw for admin controlled DIRECT withdrawals to a PERSON (not a smart contract)\r
    // this can ONLY happen for example, when the company wants to send some USDC or ETH from the Sales contract\r
    // to an EXECUTIVE of the company for the purposes of exchanging to USDC, as an example.\r
    // Such USDC can be spent on a capital expense or manually passed into the vesting pool.\r
    // ONLY HUBS can do this. For example, only contracts GENERATING or expected to RECEIVE\r
    // ETH or tokens from an external event (not from a HUB)  should be declared as HUBS.\r
    // EXCEPTIONS: send tokens to a launchpad or other noted entity can be a SC.\r
    function executiveWithdrawETH(address personAddress, uint256 amt, string memory note) external onlyTreasuryAdmin {\r
        require(address(this).balance >= amt, "Insufficient ETH balance");\r
        (bool success, ) = payable(personAddress).call{value: amt}("");\r
        require(success, "ETH transfer failed");\r
        withdrawals.push(Withdrawal(personAddress,address(0),amt,note));\r
        emit ExecutiveWithdrawalEvent(msg.sender, personAddress, amt, note, address(0));\r
    }\r
\r
    function executiveWithdrawTokens(address personAddress, uint256 amt, address tokenSCAddress, string calldata note) external onlyTreasuryAdmin {\r
        require(tokenSCAddress != address(0), "Invalid tok addr");\r
        IERC20 token = IERC20(tokenSCAddress);\r
        require(token.balanceOf(address(this)) >= amt, "Insuffic tok bal");\r
        IERC20(tokenSCAddress).safeTransfer(personAddress, amt);\r
        withdrawals.push(Withdrawal(personAddress,tokenSCAddress,amt,note));\r
        emit ExecutiveWithdrawalEvent(msg.sender, personAddress, amt, note, tokenSCAddress);\r
    }\r
\r
    /// @notice Receive ETH from any source and track it\r
    function peerTreasuryReceiveETH() virtual external payable {\r
        require(msg.value > 0, "No ETH sent");\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", msg.sender), "Sender is not an official SmartContract");\r
        ethPeerTreasury.totalReceived += msg.value;\r
        emit PeerTreasuryReceivedETH(msg.sender, msg.value);\r
    }\r
\r
    /// @notice Transfer ETH to another peer contract (OfficialEntity SmartContract)\r
    function peerTreasuryTransferETH(address payable to, uint256 amount) virtual public onlyTreasuryAdmin {\r
        require(address(this).balance >= amount, "Insufficient contract ETH balance");\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", to), "Recipient not an official SmartContract");\r
\r
        ethPeerTreasury.totalWithdrawn += amount;\r
        ExecutivePeerTreasury(to).peerTreasuryReceiveETH{value: amount}();\r
        emit PeerTreasuryTransferredETH(to, amount);\r
    }\r
\r
    /// @notice Receive ERC20 tokens and track source\r
    function peerTreasuryReceiveTokens(address token, uint256 amount) virtual external {\r
        require(amount > 0, "Zero amount");\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", msg.sender), "Sender not official SC");\r
        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\r
\r
        // Track the token if it's the first time we're seeing it\r
        if (tokenPeerTreasury[token].totalReceived == 0 && tokenPeerTreasury[token].totalWithdrawn == 0) {\r
            knownTokens.push(token);\r
        }\r
\r
        tokenPeerTreasury[token].totalReceived += amount;\r
        emit PeerTreasuryReceivedTokens(msg.sender, token, amount);\r
    }\r
\r
    /// @notice Transfer ERC20 tokens to another peer contract (OfficialEntity SmartContract)\r
    function peerTreasuryTransferTokens(address token, address to, uint256 amount) virtual public onlyTreasuryAdmin {\r
        require(IERC20(token).balanceOf(address(this)) >= amount, "Insuffic token bal");\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", to), "recipient not official SC");\r
        tokenPeerTreasury[token].totalWithdrawn += amount;\r
         // Get current allowance and reset to zero using decrease\r
        uint256 currentAllowance = IERC20(token).allowance(address(this), to);\r
        if (currentAllowance > 0) {\r
            IERC20(token).safeDecreaseAllowance(to, currentAllowance);\r
        }\r
        // Set new allowance using increase\r
        IERC20(token).safeIncreaseAllowance(to, amount);\r
        ExecutivePeerTreasury(to).peerTreasuryReceiveTokens(token, amount);\r
        emit PeerTreasuryTransferredTokens(to, token, amount);\r
    }\r
\r
    /// @notice Check ETH available (total received - total withdrawn)\r
    /// @return The signed balance (can be negative if more was withdrawn than received - which is OK!)\r
    /// obviously the first lateral movement will be a withdrawal from a peerTreasury source\r
    function peerETHAvailable() external view returns (int256) {\r
        // Convert to int256 before subtraction to allow negative results\r
        return int256(ethPeerTreasury.totalReceived) - int256(ethPeerTreasury.totalWithdrawn);\r
    }\r
\r
    /// @notice Check token available (total received - total withdrawn)\r
    /// @return The signed balance (can be negative if more was withdrawn than received)\r
    /// obviously the first lateral movement will be a withdrawal from a peerTreasury source\r
    function peerTokenAvailable(address token) external view returns (int256) {\r
        TreasuryEntry storage e = tokenPeerTreasury[token];\r
        // Convert to int256 before subtraction to allow negative results\r
        return int256(e.totalReceived) - int256(e.totalWithdrawn);\r
    }\r
\r
    struct TreasurySnapshot {\r
        address token;\r
        uint256 totalReceived;\r
        uint256 totalWithdrawn;\r
    }\r
\r
\r
    /// @notice Return all known peer treasury token entries\r
   function getPeerTreasuries() external view returns (TreasurySnapshot[] memory) {\r
        uint256 len = knownTokens.length;\r
        TreasurySnapshot[] memory result = new TreasurySnapshot[](len);\r
        for (uint256 i = 0; i < len; i++) {\r
            address token = knownTokens[i];\r
            TreasuryEntry storage entry = tokenPeerTreasury[token];\r
\r
            result[i] = TreasurySnapshot({\r
                token: token,\r
                totalReceived: entry.totalReceived,\r
                totalWithdrawn: entry.totalWithdrawn\r
            });\r
        }\r
        return result;\r
    }\r
\r
    /// @notice Return individual peer treasury entry for a token\r
    function getPeerTreasury(address token) external view returns (uint256 received, uint256 withdrawn) {\r
        TreasuryEntry storage entry = tokenPeerTreasury[token];\r
        return (entry.totalReceived, entry.totalWithdrawn);\r
    }\r
\r
    /// @notice Return ETH treasury data\r
    function getPeerTreasuryETH() external view returns (uint256 received, uint256 withdrawn) {\r
        return (ethPeerTreasury.totalReceived, ethPeerTreasury.totalWithdrawn);\r
    }\r
\r
    function getAllWithdrawals() external view returns(Withdrawal[] memory){\r
        return withdrawals;\r
    }\r
\r
    \r
    \r
    // SAFE DIRECT METHODS\r
    /// @notice DIRECT TOKEN TRANSFER - Transfer tokens directly without approve/transferFrom pattern\r
    /// @param token Token contract address\r
    /// @param to Recipient PeerTreasury contract\r
    /// @param amount Amount to transfer\r
    function peerTreasuryTransferTokensDirect(address token, address to, uint256 amount) virtual public onlyTreasuryAdmin {\r
        require(IERC20(token).balanceOf(address(this)) >= amount, "Low token bal");\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", to), "rcpnt !ofcl SC");\r
        // Update withdrawal tracking\r
        tokenPeerTreasury[token].totalWithdrawn += amount;\r
        // Direct transfer - handles USDT properly\r
        IERC20(token).safeTransfer(to, amount);\r
        // Notify receiver for tracking (no actual transfer needed)\r
        ExecutivePeerTreasury(to).peerTreasuryNotifyReceived(token, amount);\r
        emit PeerTreasuryTransferredTokens(to, token, amount);\r
    }\r
\r
    /// @notice NOTIFICATION METHOD - Update counters when tokens received via direct transfer\r
    /// @param token Token contract address  \r
    /// @param amount Amount received\r
    function peerTreasuryNotifyReceived(address token, uint256 amount) virtual public {\r
        require(IController(peerTreasuryController).isOfficialEntity("SmartContract", msg.sender), "sender !ofcl SC");\r
        // Update received tracking (same as peerTreasuryReceiveTokens but no transferFrom)\r
        tokenPeerTreasury[token].totalReceived += amount;\r
        // tokenPeerTreasury[token].currentBalance += amount;\r
        emit PeerTreasuryReceivedTokens(msg.sender, token, amount);\r
    }\r
\r
    \r
}\r
"
    },
    "contracts/TreasuryConstants.sol": {
      "content": "// SPDX-License-Identifier: UNLICENSED\r
// Copyright 2025 US Fintech LLC\r
// \r
// Permission to use, copy, modify, or distribute this software is strictly prohibited\r
// without prior written consent from either copyright holder.\r
// \r
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\r
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\r
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY\r
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,\r
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
\r
pragma solidity 0.8.30;\r
\r
/// @title TreasuryConstants\r
/// @notice Shared constants for treasury contracts to avoid diamond inheritance conflicts\r
/// @dev This abstract contract provides keccak256 hashes for entity type strings used across treasury contracts\r
/// @author Ken Silverman\r
abstract contract TreasuryConstants {\r
    /// @notice Pre-computed keccak256 hash of "TreasuryAdmin" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_TREASURY_ADMIN = keccak256(bytes("TreasuryAdmin"));\r
    \r
    /// @notice Pre-computed keccak256 hash of "SmartContract" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_SMART_CONTRACT = keccak256(bytes("SmartContract"));\r
    \r
    /// @notice Pre-computed keccak256 hash of "TokenAdmin" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_TOKEN_ADMIN = keccak256(bytes("TokenAdmin"));\r
\r
    /// @notice Pre-computed keccak256 hash of "TokenAdmin" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_REGISTRAR = keccak256(bytes("Registrar"));\r
    \r
    /// @notice Pre-computed keccak256 hash of "SwappableToken" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_SWAPPABLE_TOKEN = keccak256(bytes("SwappableToken"));\r
\r
    /// @notice Pre-computed keccak256 hash of "PLATFORM_CHAIN_TREASURY" for gas-optimized entity checks\r
    bytes32 public constant KECCAK_PLATFORM_CHAIN_TREASURY = keccak256(bytes("PLATFORM_CHAIN_TREASURY"));\r
}\r
\r
"
    },
    "interfaces/IController.sol": {
      "content": "// SPDX-License-Identifier: UNLICENSED
// Copyright 2025 US Fintech LLC and DelNorte Holdings.
// 
// Permission to use, copy, modify, or distribute this software is strictly prohibited
// without prior written consent from both copyright holders.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// OFFICIAL DEL NORTE NETWORK COMPONENT 
// Provides immediate membership access to platform at different levels. 
// Required Non US or accredited US registration to swap for DTV token. Registration available within 180 days per terms.delnorte.io . 
// Minimally tesed Conroller Tree for world-wide government administration of, well, anything, including property ownership.
// Designed by Ken Silverman as part of his ElasticTreasury (HUB and SPOKE), PeerTreasury and Controller model. 
// @author Ken Silverman
// This deployment is for Del Norte Holdings, Delaware and US Fintech, LLC NY.  
// Permission to change metadata stored on blockchain explorers and elsewhere granted to:
// Del Norte Holdings, DE only and/or US Fintech, LLC NY independently
pragma solidity 0.8.30;

interface IController {
    struct OfficialEntityStruct {
        string fullNameOfEntityOrLabel;
        string nationalIdOfEntity;
        address pubAddress;
        uint256 blockNumber;
        uint256 blockTimestamp;
        bool active;
        uint256 value;  // Associated value (0-1,000,000 for absolute, or basis points for %, type(uint256).max = no value)
    }

    struct ChainedEntityStruct {
        address entityAddress;
        address parent;
        uint8 type1;     // 0 = 'V' (value/absolute), 1 = 'P' (percentage in basis points)
        uint256 val1;    // Value for type1 (absolute amount or percentage in basis points)
        uint8 type2;     // 0 = 'V' (value/absolute), 1 = 'P' (percentage in basis points)
        uint256 val2;    // Value for type2 (absolute amount or percentage in basis points)
        bool active;
        uint256 blockNumber;
        uint256 blockTimestamp;
        string entityName;  // Human-readable name
        string entityID;    // Additional identifier (tax ID, registration #, etc)
    }

    struct CalculatedEntityAmount {
        address entityAddress;
        uint256 type1Amount;  // Calculated amount for type1 (e.g., transfer fee)
        uint256 type2Amount;  // Calculated amount for type2 (e.g., activation fee)
    }

    // Official Entity Functions
    function addOfficialEntity(string memory, address, string memory, string memory) external returns (bool);
    function addOfficialEntityWithValue(string memory, address, string memory, string memory, uint256) external returns (bool);
    function removeOfficialEntity(string memory, address) external returns (bool);
    function isOfficialEntity(string memory, address) external view returns (bool);
    function isOfficialEntityFast(bytes32, address) external view returns (bool);
    function isOfficialDoubleEntityFast(bytes32, address, bytes32, address, bool) external view returns (bool);
    function isOfficialTripleEntityFast(bytes32, address, bytes32, address, bytes32, address, bool) external view returns (bool);
    function isOfficialQuadrupleEntityFast(bytes32, address,  bytes32, address, bytes32, address, bytes32, address, bool) external view returns (bool);
    function getOfficialEntity(string calldata, address) external view returns (OfficialEntityStruct memory);
    function getAllOfficialEntities(string calldata, bool) external view returns (OfficialEntityStruct[] memory);
    function init(address, string calldata) external;
    
    // Chained Entity Functions
    function addChainedEntity(string memory, address, address, uint8, uint256, uint8, uint256, string memory, string memory) external returns (bool);
    function removeChainedEntity(string calldata, address, bool) external returns (bool);
    function isChainedEntity(string calldata, address) external view returns (bool);
    function isChainedEntityFast(bytes32, address) external view returns (bool);
    function getChainedEntity(string calldata, address) external view returns (ChainedEntityStruct memory);
    function getActiveChainedEntities(string calldata) external view returns (ChainedEntityStruct[] memory);
    function calculateChainedAmounts(string calldata, uint256, bool, uint256, uint8) external view returns (CalculatedEntityAmount[] memory, uint256, uint256);
    
    // Constants
    function BASIS_POINTS_DIVISOR() external view returns (uint256);
}
"
    },
    "interfaces/IIssueTokenContentManager.sol": {
      "content": "// SPDX-License-Identifier: UNLICENSED\r
// Copyright 2025 US Fintech LLC\r
pragma solidity 0.8.30;\r
\r
/**\r
 * @title IIssueTokenContentManager\r
 * @notice Interface for IssueTokenContentManager - keeps IssueToken deployment size minimal\r
 * @dev This interface allows IssueToken to reference ContentManager without including its bytecode\r
 */\r
interface IIssueTokenContentManager {\r
    \r
    // Structs (for return types)\r
    struct TokenInfoHistory {\r
        string baseUrl;\r
        bytes32 contentHash;\r
        uint256 timestamp;\r
    }\r
    \r
    struct NFTTransaction {\r
        address nftAddress;\r
        uint256 tokenId;\r
        uint8 transactionType;\r
        uint8 isOwned;\r
        bool isActive;\r
        uint256 blockNumber;\r
        uint256 blockTimestamp;\r
    }\r
    \r
    struct OfficialString {\r
        string content;\r
        bytes32 contentHash;\r
        uint256 timestamp;\r
        bool isActive;\r
    }\r
    \r
    // Token Info Functions\r
    function tokenInfoUrl() external view returns (string memory);\r
    function getTokenInfoBaseUrl() external view returns (string memory);\r
    function getOfficialTokenInfoURL() external view returns (string memory);\r
    function setOfficialTokenInfoBaseUrl(string memory _newTokenInfoBaseUrl, bytes32 _newContentHash) external;\r
    function getBaseUrlHistory() external view returns (TokenInfoHistory[] memory);\r
    function confirmHash(bytes32 hash) external view returns (uint256 trailNumber, uint256 timestamp);\r
    \r
    // NFT Management Functions\r
    function addNFTTransaction(address nftAddress, uint256 tokenId, uint8 transactionType, bool isActive) external;\r
    function getAllNFTAddresses() external view returns (address[] memory);\r
    function getNFTTransactions(address nftAddress) external view returns (NFTTransaction[] memory);\r
    function getNFTStatus(address nftAddress) external view returns (bool isActive, uint8 lastTransactionType);\r
    function getActiveNFTs() external view returns (address[] memory);\r
    function getOfficiallyOwnedNFTs(address tokenAddress, bool updateOwnershipStatus) external returns (NFTTransaction[] memory);\r
    \r
    // Official String Functions\r
    function addOfficialString(string memory content) external;\r
    function isOfficialString(string memory content) external view returns (OfficialString memory);\r
    function makeOfficialStringInactive(string memory content) external;\r
    function getAllOfficialStringHashes() external view returns (bytes32[] memory);\r
}\r
\r
"
    },
    "contracts/IssueToken.sol": {
      "content": "// SPDX-License-Identifier: UNLICENSED\r
// Copyright 2025 EXCLUSIVE RIGHTS TO US Fintech LLC, a New York Company.\r
// DelNorte Holdings use restricted to use with Government-based minted or governemnt authorized NFTs.\r
// \r
// Permission to use, copy, modify, or distribute this software is strictly prohibited\r
// without prior written consent from either copyright holder.\r
// \r
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\r
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\r
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY\r
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,\r
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
// OFFICIAL DEL NORTE NETWORK COMPONENT \r
// Provides immediate membership access to platform at different levels. \r
// Required Non US or accredited US registration if token is gated. \r
// ISSUER is responsible for ensuring the TOKEN is registered as a security as necessary \r
// and that the NFTs pointed to by the token are valid and compliant with all laws and regulations.\r
// This token is minimally tested. Use at your own risk.   \r
// Designed by Ken Silverman as part of his ElasticTreasury (HUB and SPOKE), ExecutivePeerTreasury and Controller network. \r
// @dev This deployment is for the US Fintech LLC DataCloud OS platform, home of EquityMint.org minted assets only.\r
//  Any governement-backed NFT pointed tokens are restricted to use by Del Norte Holdings, DE only.\r
//  or Trueviewchain Inc. a Panama entity and Del Norte El Salvador S.A  a subsidiary of Del Norte Holdings, Delaware USA.  \r
// Permission to change metadata stored on blockchain explorers granted to US Fintech LLC, US only.\r
// Deployment allowable only through Equity Mint platform, built on Data Cloud OS, a US Fintech platform \r
// Deployment permitted therefrom by separate corporate project entities at their own risk and jurisdictional accountability.\r
pragma solidity 0.8.30;\r
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";\r
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";\r
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";\r
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";\r
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";\r
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\r
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";\r
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";\r
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";\r
import "./ExecutivePeerTreasury.sol";\r
import "../interfaces/IIssueTokenContentManager.sol";\r
\r
/// @author Ken Silverman\r
/// @notice Issue Token can hold one or more Asset NFTs \r
//  The ISSUE TOKEN can also be used to represent a single Asset NFT or a collection of Asset NFTs.\r
//  The Asset NFTs are tracked in the NFTRecords mapping.\r
//  The NFTRecords mapping is a mapping of the Asset NFT contract address to the NFTRecord struct.\r
//  The NFTRecord struct contains the Asset NFT contract address, a boolean indicating if the Asset NFT was ever added,\r
//  and an array of NFTTransaction structs.\r
//  The NFTTransaction struct contains the Asset NFT contract address, the token ID, the transaction type, the ownership status,\r
//  the active status, the block number, and the block timestamp.\r
//  from a specified AssetManager contract address.  this token may beowned by x users as set by the CFO controlling\r
//  this issue instance, based on their own jurisidicational law.\r
//  Minimum holding times are enforced by not whitelinting, \r
//  but rather using the ReleaseManager tied to this token through the Controller.\r
//  Those who are registered inside this token are not restricted from purchasing and selling immediately, \r
//  and therefore must meet the jurisdictional requirements of the issuer.\r
// In all cases the URL manager is responsible for supplying accurate detail as to the purpose of this token.\r
// To ensure there is no fraud, the exact deployer managed domain path PLUS THIS TOKEN contract address\r
//  as URL/0x[tokenAddress] is the only OFFICIAL descriptor of this token's purpose.\r
//  The domain alone is NOT sufficient if https://deployerDomain/tokenAddress provides no information. \r
// this prevents fake implementations of this contract to have meaning. \r
// HOWEVER it is up to YOU to CHECK the URL at https://deployerDomain/tokenAddress to ensure it is accurate. \r
// you can do so by getting the full URL from contentManager.getOfficialTokenInfoURL() and checking it. \r
contract IssueToken is ERC20, ERC20Permit, ERC20Burnable, ExecutivePeerTreasury {\r
    using SafeERC20 for IERC20;\r
    \r
    struct WhitelistEntry {\r
        address user;\r
        string note;\r
        bool isUS;\r
    }\r
\r
    // NFT Transaction Types (first 11 defined)\r
    // 0 = purchased - NFT purchased by this token's treasury\r
    // 1 = owned - NFT already owned at token inception\r
    // 2 = transferred - NFT transferred to/from treasury\r
    // 3 = leased - NFT is leased to/from another party\r
    // 4 = servicing - NFT is being serviced or under maintenance\r
    // 5 = other - Other transaction type\r
    // 6 = ended - NFT relationship ended\r
    // 7 = representing - NFT represents this token's value/assets\r
    // 8 = contracted - NFT under contract (sale/lease pending)\r
    // 9 = sold - NFT sold by treasury\r
    // 10 = donated - NFT donated to/from treasury\r
    // 11-255 = Reserved for future use\r
    \r
    // Ownership verification status\r
    // 0 = NO - Verified we don't own this NFT\r
    // 1 = YES - Verified we own this NFT on-chain\r
    // NFT and TokenInfo functionality moved to IssueTokenContentManager\r
\r
    uint256 public MAX_SUPPLY;\r
    uint256 public MAX_DECIMALS;\r
    string public tokenDescription;\r
    string public constant FEE_CHAIN_TYPE = "PLATFORM_CHAIN_TREASURY"; // Fixed chained entity type for this token\r
    \r
    // Keccak hashes for fast lookups  (TreasuryAdmin and SmartContract already in ExecutivePeerTreasury)\r
    \r
    bool public gatingActive = true;\r
    bool public isActivated = false;  // Token must be activated before transfers\r
    address public stableCoinContractAddress; /

Tags:
ERC20, ERC721, ERC165, Multisig, Burnable, Non-Fungible, Swap, Upgradeable, Multi-Signature, Factory|addr:0x7d616b05225b0da477de217b909015d7d469cffd|verified:true|block:23743576|tx:0x3e47828b87e4a13afb0b2bf57d750e701a6e6ae8cf76dae5865c3a459c4564d4|first_check:1762511028

Submitted on: 2025-11-07 11:23:49

Comments

Log in to comment.

No comments yet.