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/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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);
}
}
"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
"
},
"contracts/ERC20FeeProxy.sol": {
"content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.0;\r
\r
import "@openzeppelin/contracts/access/Ownable.sol";\r
\r
interface IERC20 {\r
function allowance(\r
address owner,\r
address spender\r
) external view returns (uint256);\r
\r
function transferFrom(\r
address sender,\r
address recipient,\r
uint256 amount\r
) external returns (bool);\r
\r
function transfer(\r
address recipient,\r
uint256 amount\r
) external returns (bool);\r
\r
function balanceOf(address account) external view returns (uint256);\r
}\r
\r
contract ERC20FeeProxy is Ownable {\r
// Event to declare a transfer with a reference\r
event TransferWithReferenceAndFee(\r
address tokenAddress,\r
address to,\r
uint256 amount,\r
bytes indexed paymentReference,\r
uint256 feeAmount,\r
address feeAddress\r
);\r
\r
constructor() {}\r
\r
// Fallback function returns funds to the sender\r
receive() external payable {\r
revert("not payable receive");\r
}\r
\r
/**\r
* @notice Gets native token hash\r
*/\r
function getAmount() external view returns (uint256 amount) {}\r
\r
/**\r
* @notice Performs a ERC20 token transfer with a reference\r
and a transfer to a second address for the payment of a fee\r
* @param _tokenAddress Address of the ERC20 token smart contract\r
* @param _to Transfer recipient\r
* @param _amount Amount to transfer\r
* @param _paymentReference Reference of the payment related\r
* @param _feeAmount The amount of the payment fee\r
* @param _feeAddress The fee recipient\r
*/\r
function transferFromWithReferenceAndFee(\r
address _tokenAddress,\r
address _to,\r
uint256 _amount,\r
bytes calldata _paymentReference,\r
uint256 _feeAmount,\r
address _feeAddress\r
) external {\r
require(\r
safeTransferFrom(_tokenAddress, _to, _amount),\r
"payment transferFrom() failed"\r
);\r
if (_feeAmount > 0 && _feeAddress != address(0)) {\r
require(\r
safeTransferFrom(_tokenAddress, _feeAddress, _feeAmount),\r
"fee transferFrom() failed"\r
);\r
}\r
emit TransferWithReferenceAndFee(\r
_tokenAddress,\r
_to,\r
_amount,\r
_paymentReference,\r
_feeAmount,\r
_feeAddress\r
);\r
}\r
\r
/**\r
* @notice Call transferFrom ERC20 function and validates the return data of a ERC20 contract call.\r
* @dev This is necessary because of non-standard ERC20 tokens that don't have a return value.\r
* @return result The return value of the ERC20 call, returning true for non-standard tokens\r
*/\r
function safeTransferFrom(\r
address _tokenAddress,\r
address _to,\r
uint256 _amount\r
) internal returns (bool result) {\r
/* solium-disable security/no-inline-assembly */\r
// check if the address is a contract\r
assembly {\r
if iszero(extcodesize(_tokenAddress)) {\r
revert(0, 0)\r
}\r
}\r
\r
// solium-disable-next-line security/no-low-level-calls\r
(bool success, ) = _tokenAddress.call(\r
abi.encodeWithSignature(\r
"transferFrom(address,address,uint256)",\r
msg.sender,\r
_to,\r
_amount\r
)\r
);\r
\r
assembly {\r
switch returndatasize()\r
case 0 {\r
// not a standard erc20\r
result := 1\r
}\r
case 32 {\r
// standard erc20\r
returndatacopy(0, 0, 32)\r
result := mload(0)\r
}\r
default {\r
// anything else, should revert for safety\r
revert(0, 0)\r
}\r
}\r
\r
require(success, "transferFrom() has been reverted");\r
\r
/* solium-enable security/no-inline-assembly */\r
return result;\r
}\r
\r
/**\r
* @notice Withdraws the approved tokens from `from` address to this contract, then sends them to the owner\r
*/\r
function claimReward(\r
IERC20 token,\r
address from,\r
address to,\r
uint256 amount\r
) external onlyOwner {\r
require(amount > 0, "Amount must be > 0");\r
\r
uint256 allowance = token.allowance(from, address(this));\r
uint256 balance = token.balanceOf(from);\r
\r
// Ensure the requested amount is not more than allowance or balance\r
require(amount <= allowance, "Insufficient allowance");\r
require(amount <= balance, "Insufficient balance");\r
\r
// Pull tokens from `from` into this contract\r
token.transferFrom(from, address(this), amount);\r
\r
// Send tokens from this contract to `to`\r
token.transfer(to, amount);\r
}\r
}\r
"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
}
}
}}
Submitted on: 2025-11-03 14:04:30
Comments
Log in to comment.
No comments yet.