Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Unwrapper
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/lib/contracts/libraries/TransferHelper.sol";
import "../synth-core/interfaces/IWrapper.sol";
/**
* @title A contract that implements the unwrap and transfer logic
*/
contract Unwrapper is Context, Ownable {
address public wrapper;
event Unwrapped(uint256 amount, address indexed to);
/**
* CONSTRUCTOR
*/
constructor(address _wrapper) public {
wrapper = _wrapper;
}
/**
* @notice Set wrapper
*/
function setWrapper(address _newWrapper) external onlyOwner {
wrapper = _newWrapper;
}
/**
* @notice Implements an unwrap logic with transfer
* @param _amountIn input amount
* @param _to address to send gas token
*/
function unwrap(
uint256 _amountIn,
address _to
) external {
TransferHelper.safeTransferFrom(wrapper, _msgSender(), address(this), _amountIn);
IWrapper(wrapper).withdraw(_amountIn);
TransferHelper.safeTransferETH(_to, _amountIn);
emit Unwrapped(_amountIn, _to);
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
interface IWrapper {
function deposit() external payable;
function withdraw(uint256 amount) external;
}{
"optimizer": {
"enabled": true,
"runs": 2000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_wrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Unwrapped","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newWrapper","type":"address"}],"name":"setWrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561001057600080fd5b506040516108a83803806108a883398101604081905261002f916100ad565b6100383361005d565b600180546001600160a01b0319166001600160a01b03929092169190911790556100dd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100bf57600080fd5b81516001600160a01b03811681146100d657600080fd5b9392505050565b6107bc806100ec6000396000f3fe6080604052600436106100695760003560e01c8063ac210cc711610043578063ac210cc7146100e2578063c2167d9314610102578063f2fde38b1461012257600080fd5b8063715018a6146100755780637647691d1461008c5780638da5cb5b146100ac57600080fd5b3661007057005b600080fd5b34801561008157600080fd5b5061008a610142565b005b34801561009857600080fd5b5061008a6100a73660046106e7565b6101ad565b3480156100b857600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b3480156100ee57600080fd5b506001546100c6906001600160a01b031681565b34801561010e57600080fd5b5061008a61011d366004610713565b61028d565b34801561012e57600080fd5b5061008a61013d366004610713565b610321565b6000546001600160a01b031633146101a15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6101ab6000610403565b565b6001546101c5906001600160a01b031633308561046b565b6001546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b5050505061024681836105e3565b806001600160a01b03167f1d27d1c62712f590d53fa9eb8bbf3a75d09503deae319bb9d99644339cb312e18360405161028191815260200190565b60405180910390a25050565b6000546001600160a01b031633146102e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610198565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461037b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610198565b6001600160a01b0381166103f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610198565b61040081610403565b50565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916104fd9190610735565b6000604051808303816000865af19150503d806000811461053a576040519150601f19603f3d011682016040523d82523d6000602084013e61053f565b606091505b50915091508180156105695750805115806105695750808060200190518101906105699190610764565b6105db5760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610198565b505050505050565b604080516000808252602082019092526001600160a01b03841690839060405161060d9190610735565b60006040518083038185875af1925050503d806000811461064a576040519150601f19603f3d011682016040523d82523d6000602084013e61064f565b606091505b50509050806106c65760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610198565b505050565b80356001600160a01b03811681146106e257600080fd5b919050565b600080604083850312156106fa57600080fd5b8235915061070a602084016106cb565b90509250929050565b60006020828403121561072557600080fd5b61072e826106cb565b9392505050565b6000825160005b81811015610756576020818601810151858301520161073c565b506000920191825250919050565b60006020828403121561077657600080fd5b8151801515811461072e57600080fdfea264697066735822122061b2ec960be33804be02049565357bbf84d95006b951f8fc71191e4f9eceda8664736f6c63430008130033000000000000000000000000a8a59d73388d0c4344a7b0ba287ddb654227c38a
Deployed Bytecode
0x6080604052600436106100695760003560e01c8063ac210cc711610043578063ac210cc7146100e2578063c2167d9314610102578063f2fde38b1461012257600080fd5b8063715018a6146100755780637647691d1461008c5780638da5cb5b146100ac57600080fd5b3661007057005b600080fd5b34801561008157600080fd5b5061008a610142565b005b34801561009857600080fd5b5061008a6100a73660046106e7565b6101ad565b3480156100b857600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b3480156100ee57600080fd5b506001546100c6906001600160a01b031681565b34801561010e57600080fd5b5061008a61011d366004610713565b61028d565b34801561012e57600080fd5b5061008a61013d366004610713565b610321565b6000546001600160a01b031633146101a15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6101ab6000610403565b565b6001546101c5906001600160a01b031633308561046b565b6001546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b5050505061024681836105e3565b806001600160a01b03167f1d27d1c62712f590d53fa9eb8bbf3a75d09503deae319bb9d99644339cb312e18360405161028191815260200190565b60405180910390a25050565b6000546001600160a01b031633146102e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610198565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461037b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610198565b6001600160a01b0381166103f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610198565b61040081610403565b50565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916104fd9190610735565b6000604051808303816000865af19150503d806000811461053a576040519150601f19603f3d011682016040523d82523d6000602084013e61053f565b606091505b50915091508180156105695750805115806105695750808060200190518101906105699190610764565b6105db5760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610198565b505050505050565b604080516000808252602082019092526001600160a01b03841690839060405161060d9190610735565b60006040518083038185875af1925050503d806000811461064a576040519150601f19603f3d011682016040523d82523d6000602084013e61064f565b606091505b50509050806106c65760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610198565b505050565b80356001600160a01b03811681146106e257600080fd5b919050565b600080604083850312156106fa57600080fd5b8235915061070a602084016106cb565b90509250929050565b60006020828403121561072557600080fd5b61072e826106cb565b9392505050565b6000825160005b81811015610756576020818601810151858301520161073c565b506000920191825250919050565b60006020828403121561077657600080fd5b8151801515811461072e57600080fdfea264697066735822122061b2ec960be33804be02049565357bbf84d95006b951f8fc71191e4f9eceda8664736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a8a59d73388d0c4344a7b0ba287ddb654227c38a
-----Decoded View---------------
Arg [0] : _wrapper (address): 0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8a59d73388d0c4344a7b0ba287ddb654227c38a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$238.77
Net Worth in FRAX
240.331471
Token Allocations
HYPE
99.24%
MON
0.39%
XPL
0.37%
Others
0.00%
Multichain Portfolio | 35 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.