WNativeRelayer
0x5d796c6e479052db44ee6a45dd72e57c800a4c1b
Verification
Verified
v0.8.17+commit.8df45f5f
Type
Contract
2,350 bytes
ABI entries
11
1 read · 5 write
License
mit
Contract information
- Address
- 0x5d796c6e479052db44ee6a45dd72e57c800a4c1b
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.17+commit.8df45f5f
- Optimization
- Enabled
- Creator
- 0x399EfA78cA…Df9EFDf6Ad
- Creation tx
- 0x81f2c4a406…65020f15bc
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (1)
owner() → address
Events (4)
InitializedOwnershipTransferredSetCallerSetWNative
ABI
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"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": true,
"internalType": "address",
"name": "caller",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "isAllowed",
"type": "bool"
}
],
"name": "SetCaller",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newWNative",
"type": "address"
}
],
"name": "SetWNative",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_wnative",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"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": "whitelistedCallers",
"type": "address[]"
},
{
"internalType": "bool",
"name": "isOk",
"type": "bool"
}
],
"name": "setCallerOk",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "../interfaces/IWETH.sol";
import "../libraries/RevertReasonParser.sol";
contract WNativeRelayer is OwnableUpgradeable, ReentrancyGuardUpgradeable {
address private wnative;
mapping(address => bool) private okCallers;
event SetCaller(address indexed caller, bool isAllowed);
event SetWNative(address newWNative);
function initialize(address _wnative) public initializer {
__Ownable_init();
__ReentrancyGuard_init();
wnative = _wnative;
emit SetWNative(_wnative);
}
modifier onlyWhitelistCaller() {
require(okCallers[msg.sender] == true, "WNativeRelayer::onlyWhitelistedCaller:: !okCaller");
_;
}
function setCallerOk(address[] calldata whitelistedCallers, bool isOk) external onlyOwner {
uint256 len = whitelistedCallers.length;
for (uint256 idx = 0; idx < len; idx++) {
okCallers[whitelistedCallers[idx]] = isOk;
emit SetCaller(whitelistedCallers[idx], isOk);
}
}
function withdraw(uint256 _amount) external onlyWhitelistCaller nonReentrant {
IWETH(wnative).withdraw(_amount);
(bool success, ) = msg.sender.call{ value: _amount }("");
require(success, "WNativeRelayer::onlyWhitelistedCaller:: can't withdraw");
}
receive() external payable {}
}
Chain explorer5471msChain node106ms