Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/Vault.sol": {
"content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
interface IERC20 {\r
function transferFrom(address from, address to, uint256 value) external returns (bool);\r
function transfer(address to, uint256 value) external returns (bool);\r
}\r
\r
contract NewroVault {\r
IERC20 public immutable newroToken; // The original Newro.sol contract\r
address public owner; // Owner (you) who controls withdrawals\r
\r
event Deposited(address indexed from, uint256 amount);\r
event Withdrawn(address indexed to, uint256 amount);\r
\r
modifier onlyOwner() {\r
require(msg.sender == owner, "Not authorized");\r
_;\r
}\r
\r
constructor(address _newroToken) {\r
newroToken = IERC20(_newroToken);\r
owner = msg.sender;\r
}\r
\r
// User deposits Newro into the vault (must approve first in Newro.sol)\r
function deposit(uint256 amount) external {\r
require(amount > 0, "Amount must be > 0");\r
bool success = newroToken.transferFrom(msg.sender, address(this), amount);\r
require(success, "Transfer failed");\r
emit Deposited(msg.sender, amount);\r
}\r
\r
// Owner can release tokens back (later replaced by cross-chain burns)\r
function withdraw(address to, uint256 amount) external onlyOwner {\r
require(amount > 0, "Amount must be > 0");\r
bool success = newroToken.transfer(to, amount);\r
require(success, "Transfer failed");\r
emit Withdrawn(to, amount);\r
}\r
}\r
"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-09-19 11:29:08
Comments
Log in to comment.
No comments yet.