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/gate/SendAssetsGate.sol": {
"content": "// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2025 [Byzantine Finance]
// The implementation of this contract was inspired by Morpho Vault V2, developed by the Morpho Association in 2025.
pragma solidity ^0.8.0;
import {GateBase} from "./GateBase.sol";
import {ISendAssetsGate} from "../../src/interfaces/IGate.sol";
/**
* @notice Gate that whitelists accounts that can send assets when a deposit is made.
* @dev It checks users who deposit assets to the vault.
*/
contract SendAssetsGate is GateBase, ISendAssetsGate {
constructor(address _initialOwner) GateBase(_initialOwner) {}
/// @notice Check if `account` can supply assets when a deposit is made.
function canSendAssets(address account) external view returns (bool) {
return _whitelistedOrHandlingOnBehalf(account);
}
}
"
},
"src/gate/GateBase.sol": {
"content": "// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2025 [Byzantine Finance]
// The implementation of this contract was inspired by Morpho Vault V2, developed by the Morpho Association in 2025.
pragma solidity ^0.8.0;
import {Ownable2Step, Ownable} from "../../lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
/// @notice Morpho Bundler3 contract interface
/// @dev Must give the address that initiates the transaction to the vault (real msg.sender)
/// @dev Source code here: https://github.com/morpho-org/bundler3/blob/main/src/Bundler3.sol
interface IBundler3 {
function initiator() external view returns (address);
}
/// @notice Bundler Adapter contract interface (must support erc4626 deposits and withdrawals)
/// @dev Must give the Bundler3 contract used by the initiator
/// @dev Very likely the GeneralAdapter1:
/// https://github.com/morpho-org/bundler3/blob/main/src/adapters/GeneralAdapter1.sol
interface IBundlerAdapter {
function BUNDLER3() external view returns (IBundler3);
}
/**
* @title GateBase
* @notice Base contract for ReceiveSharesGate, SendSharesGate, ReceiveAssetsGate and SendAssetsGate.
* @dev This contract is used to manage the whitelist and the bundler adapters.
*/
abstract contract GateBase is Ownable2Step {
/* STORAGE */
mapping(address => bool) public isBundlerAdapter;
mapping(address => bool) public whitelisted;
/* EVENTS */
event SetIsWhitelisted(address indexed account, bool newIsWhitelisted);
event SetIsBundlerAdapter(address indexed account, bool newIsBundlerAdapter);
/* ERRORS */
error ArrayLengthMismatch();
error AlreadySet();
error NotAllowedToRenounceOwnership();
/* CONSTRUCTOR */
constructor(address _owner) Ownable(_owner) {}
/* ROLES FUNCTIONS */
/// @notice Set who is whitelisted.
function setIsWhitelisted(address account, bool newIsWhitelisted) external onlyOwner {
_setIsWhitelisted(account, newIsWhitelisted);
}
/// @notice Set who is whitelisted in batch.
function setIsWhitelistedBatch(address[] memory accounts, bool[] memory newIsWhitelisted) external onlyOwner {
require(accounts.length == newIsWhitelisted.length, ArrayLengthMismatch());
for (uint256 i; i < accounts.length; ++i) {
_setIsWhitelisted(accounts[i], newIsWhitelisted[i]);
}
}
/// @notice Set who is allowed to handle shares and assets on behalf of another account.
function setIsBundlerAdapter(address account, bool newIsBundlerAdapter) external onlyOwner {
isBundlerAdapter[account] = newIsBundlerAdapter;
emit SetIsBundlerAdapter(account, newIsBundlerAdapter);
}
/// @notice Not allowed to renounce ownership.
function renounceOwnership() public view override onlyOwner {
revert NotAllowedToRenounceOwnership();
}
/* INTERNAL FUNCTIONS */
function _setIsWhitelisted(address account, bool newIsWhitelisted) internal {
require(whitelisted[account] != newIsWhitelisted, AlreadySet());
whitelisted[account] = newIsWhitelisted;
emit SetIsWhitelisted(account, newIsWhitelisted);
}
/// @notice Check if `account` is whitelisted or handling on behalf of another account.
function _whitelistedOrHandlingOnBehalf(address account) internal view returns (bool) {
return whitelisted[account]
|| (isBundlerAdapter[account] && whitelisted[IBundlerAdapter(account).BUNDLER3().initiator()]);
}
}
"
},
"src/interfaces/IGate.sol": {
"content": "// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2025 Morpho Association
pragma solidity >=0.5.0;
interface IReceiveSharesGate {
function canReceiveShares(address account) external view returns (bool);
}
interface ISendSharesGate {
function canSendShares(address account) external view returns (bool);
}
interface IReceiveAssetsGate {
function canReceiveAssets(address account) external view returns (bool);
}
interface ISendAssetsGate {
function canSendAssets(address account) external view returns (bool);
}
"
},
"lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This extension of the {Ownable} contract includes a two-step mechanism to transfer
* ownership, where the new owner must call {acceptOwnership} in order to replace the
* old one. This can help prevent common mistakes, such as transfers of ownership to
* incorrect accounts, or to contracts that are unable to interact with the
* permission system.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}
"
},
"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/",
"ds-test/=lib/morpho-blue/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/metamorpho/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/morpho-blue/lib/halmos-cheatcodes/src/",
"metamorpho-v1.1/=lib/metamorpho-v1.1/",
"metamorpho/=lib/metamorpho/",
"morpho-blue-irm/=lib/metamorpho/lib/morpho-blue-irm/src/",
"morpho-blue/=lib/morpho-blue/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/metamorpho/lib/morpho-blue-irm/lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}
}}
Submitted on: 2025-11-04 15:09:11
Comments
Log in to comment.
No comments yet.