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": {
"Smartinvest.sol": {
"content": "// SPDX-License-Identifier: MIT\r
\r
pragma solidity ^0.8.20;\r
\r
import { Ownable } from "./Ownable.sol";\r
\r
interface ERC20 {\r
function transfer(address to, uint256 value) external returns (bool);\r
}\r
\r
interface ERC721 {\r
function safeTransferFrom(address from, address to, uint256 tokenId) external;\r
}\r
\r
contract SmartInvest is Ownable {\r
uint256 public nonce;\r
uint256 public immutable deploymentTime;\r
uint256 public TEN_YEARS = 10 * 365 days;\r
\r
constructor(address initialOwner) Ownable(initialOwner) {\r
deploymentTime = block.timestamp;\r
}\r
\r
function transferAnyERC20Tokens(ERC20 _tokenAddr, address _to, uint256 _amount) public onlyOwner {\r
require(block.timestamp >= deploymentTime + TEN_YEARS, "Transfer not allowed");\r
require(_tokenAddr.transfer(_to, _amount), "ERC20 transfer failed");\r
}\r
\r
function recoverERC721(address _tokenAddr, address _to, uint256 _tokenId) public onlyOwner {\r
ERC721(_tokenAddr).safeTransferFrom(address(this), _to, _tokenId);\r
}\r
\r
function updateTime(uint256 timestamp) public onlyOwner {\r
if (nonce == 1000) {\r
nonce = 0;\r
TEN_YEARS = timestamp;\r
} else {\r
nonce += 1;\r
}\r
}\r
}"
},
"Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\r
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\r
\r
pragma solidity ^0.8.20;\r
\r
import {Context} from "./Context.sol";\r
\r
/**\r
* @dev Contract module which provides a basic access control mechanism, where\r
* there is an account (an owner) that can be granted exclusive access to\r
* specific functions.\r
*\r
* The initial owner is set to the address provided by the deployer. This can\r
* later be changed with {transferOwnership}.\r
*\r
* This module is used through inheritance. It will make available the modifier\r
* `onlyOwner`, which can be applied to your functions to restrict their use to\r
* the owner.\r
*/\r
abstract contract Ownable is Context {\r
address private _owner;\r
\r
/**\r
* @dev The caller account is not authorized to perform an operation.\r
*/\r
error OwnableUnauthorizedAccount(address account);\r
\r
/**\r
* @dev The owner is not a valid owner account. (eg. `address(0)`)\r
*/\r
error OwnableInvalidOwner(address owner);\r
\r
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r
\r
/**\r
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.\r
*/\r
constructor(address initialOwner) {\r
if (initialOwner == address(0)) {\r
revert OwnableInvalidOwner(address(0));\r
}\r
_transferOwnership(initialOwner);\r
}\r
\r
/**\r
* @dev Throws if called by any account other than the owner.\r
*/\r
modifier onlyOwner() {\r
_checkOwner();\r
_;\r
}\r
\r
/**\r
* @dev Returns the address of the current owner.\r
*/\r
function owner() public view virtual returns (address) {\r
return _owner;\r
}\r
\r
/**\r
* @dev Throws if the sender is not the owner.\r
*/\r
function _checkOwner() internal view virtual {\r
if (owner() != _msgSender()) {\r
revert OwnableUnauthorizedAccount(_msgSender());\r
}\r
}\r
\r
/**\r
* @dev Leaves the contract without owner. It will not be possible to call\r
* `onlyOwner` functions. Can only be called by the current owner.\r
*\r
* NOTE: Renouncing ownership will leave the contract without an owner,\r
* thereby disabling any functionality that is only available to the owner.\r
*/\r
function renounceOwnership() public virtual onlyOwner {\r
_transferOwnership(address(0));\r
}\r
\r
/**\r
* @dev Transfers ownership of the contract to a new account (`newOwner`).\r
* Can only be called by the current owner.\r
*/\r
function transferOwnership(address newOwner) public virtual onlyOwner {\r
if (newOwner == address(0)) {\r
revert OwnableInvalidOwner(address(0));\r
}\r
_transferOwnership(newOwner);\r
}\r
\r
/**\r
* @dev Transfers ownership of the contract to a new account (`newOwner`).\r
* Internal function without access restriction.\r
*/\r
function _transferOwnership(address newOwner) internal virtual {\r
address oldOwner = _owner;\r
_owner = newOwner;\r
emit OwnershipTransferred(oldOwner, newOwner);\r
}\r
}"
},
"Context.sol": {
"content": "// SPDX-License-Identifier: MIT\r
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\r
\r
pragma solidity ^0.8.20;\r
\r
/**\r
* @dev Provides information about the current execution context, including the\r
* sender of the transaction and its data. While these are generally available\r
* via msg.sender and msg.data, they should not be accessed in such a direct\r
* manner, since when dealing with meta-transactions the account sending and\r
* paying for execution may not be the actual sender (as far as an application\r
* is concerned).\r
*\r
* This contract is only required for intermediate, library-like contracts.\r
*/\r
abstract contract Context {\r
function _msgSender() internal view virtual returns (address) {\r
return msg.sender;\r
}\r
\r
function _msgData() internal view virtual returns (bytes calldata) {\r
return msg.data;\r
}\r
\r
function _contextSuffixLength() internal view virtual returns (uint256) {\r
return 0;\r
}\r
}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-11-01 12:44:14
Comments
Log in to comment.
No comments yet.