ApprovalProxy
0x7ec9672678509a574f6305f112a7e3703845a98b
Verification
Verified
v0.8.25+commit.b61c2a91
Type
Contract
2,618 bytes
ABI entries
24
3 read · 8 write
License
none
Contract information
- Address
- 0x7ec9672678509a574f6305f112a7e3703845a98b
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.25+commit.b61c2a91
- Optimization
- Enabled
- Creator
- 0x4e59b44847…26c0B4956C
- Creation tx
- 0x112e741650…a7c0f9ba9e
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (3)
owner() → address
ownershipHandoverExpiresAt(address) → uint256
router() → address
Events (4)
OwnershipHandoverCanceledOwnershipHandoverRequestedOwnershipTransferredRouterUpdated
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"internalType": "address",
"name": "_router",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "AlreadyInitialized",
"type": "error"
},
{
"inputs": [],
"name": "ArrayLengthsMismatch",
"type": "error"
},
{
"inputs": [],
"name": "NativeTransferFailed",
"type": "error"
},
{
"inputs": [],
"name": "NewOwnerIsZeroAddress",
"type": "error"
},
{
"inputs": [],
"name": "NoHandoverRequest",
"type": "error"
},
{
"inputs": [],
"name": "RefundToCannotBeZeroAddress",
"type": "error"
},
{
"inputs": [],
"name": "Unauthorized",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "pendingOwner",
"type": "address"
}
],
"name": "OwnershipHandoverCanceled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "pendingOwner",
"type": "address"
}
],
"name": "OwnershipHandoverRequested",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "oldOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newRouter",
"type": "address"
}
],
"name": "RouterUpdated",
"type": "event"
},
{
"inputs": [],
"name": "cancelOwnershipHandover",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pendingOwner",
"type": "address"
}
],
"name": "completeOwnershipHandover",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "result",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pendingOwner",
"type": "address"
}
],
"name": "ownershipHandoverExpiresAt",
"outputs": [
{
"internalType": "uint256",
"name": "result",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "requestOwnershipHandover",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "router",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_router",
"type": "address"
}
],
"name": "setRouter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "calls",
"type": "bytes"
},
{
"internalType": "address",
"name": "refundTo",
"type": "address"
},
{
"internalType": "bytes32",
"name": "request_id",
"type": "bytes32"
}
],
"name": "transferAndMulticall",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {Ownable} from "solady/auth/Ownable.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
import {IRouter} from "./libs/IRouter.sol";
contract ApprovalProxy is Ownable {
using SafeTransferLib for address;
event RouterUpdated(address newRouter);
error ArrayLengthsMismatch();
error RefundToCannotBeZeroAddress();
error NativeTransferFailed();
address public router;
constructor(address _owner, address _router) {
_initializeOwner(_owner);
router = _router;
}
// allow refund eth
receive() external payable {}
function withdraw() external onlyOwner {
_send(msg.sender, address(this).balance);
}
function setRouter(address _router) external onlyOwner {
router = _router;
emit RouterUpdated(_router);
}
function transferAndMulticall(
address[] calldata tokens,
uint256[] calldata amounts,
bytes calldata calls,
address refundTo,
bytes32 request_id
) external payable returns (bytes memory) {
// Revert if array lengths do not match
if ((tokens.length != amounts.length)) {
revert ArrayLengthsMismatch();
}
// Transfer the tokens to the router
for (uint256 i = 0; i < tokens.length; i++) {
tokens[i].safeTransferFrom(msg.sender, router, amounts[i]);
}
// Call multicall on the router
// @dev msg.sender for the calls to targets will be the router
return IRouter(router).safeMultiCall{value: msg.value}(
calls,
refundTo,
request_id
);
}
function _send(address to, uint256 value) internal {
bool success;
assembly {
// Save gas by avoiding copying the return data to memory.
// Provide at most 100k gas to the internal call, which is
// more than enough to cover common use-cases of logic for
// receiving native tokens (eg. SCW payable fallbacks).
success := call(100000, to, value, 0, 0, 0, 0)
}
if (!success) {
revert NativeTransferFailed();
}
}
}
Chain explorer5297msChain node78ms