Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- GroWithdrawFilter
- Optimization enabled
- true
- Compiler version
- v0.8.3+commit.8d00100c
- Optimization runs
- 999
- EVM Version
- istanbul
- Verified at
- 2025-12-09T06:45:12.614797Z
/Users/ovdbigge/argent/contracts5/contracts/infrastructure/dapp/GroWithdrawFilter.sol
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.3;
import "./BaseFilter.sol";
/**
* @title GroWithdrawFilter
* @notice Filter used for withdrawals from Gro Protocol
* @author Olivier VDB - <olivier@argent.xyz>
*/
contract GroWithdrawFilter is BaseFilter {
bytes4 private constant WITHDRAW1 = bytes4(keccak256("withdrawByStablecoin(bool,uint256,uint256,uint256)"));
bytes4 private constant WITHDRAW2 = bytes4(keccak256("withdrawByLPToken(bool,uint256,uint256[])"));
bytes4 private constant WITHDRAW_ALL1 = bytes4(keccak256("withdrawAllSingle(bool,uint256,uint256)"));
bytes4 private constant WITHDRAW_ALL2 = bytes4(keccak256("withdrawAllBalanced(bool,uint256[])"));
function isValid(address /*_wallet*/, address _spender, address _to, bytes calldata _data) external view override returns (bool valid) {
// disable ETH transfer
if (_data.length < 4) {
return false;
}
bytes4 methodId = getMethod(_data);
return (_spender == _to && (methodId == WITHDRAW1 || methodId == WITHDRAW_ALL1 || methodId == WITHDRAW2 || methodId == WITHDRAW_ALL2));
}
}
/contracts/infrastructure/dapp/BaseFilter.sol
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.3;
import "./IFilter.sol";
abstract contract BaseFilter is IFilter {
function getMethod(bytes memory _data) internal pure returns (bytes4 method) {
// solhint-disable-next-line no-inline-assembly
assembly {
method := mload(add(_data, 0x20))
}
}
}
/contracts/infrastructure/dapp/IFilter.sol
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.3;
interface IFilter {
function isValid(address _wallet, address _spender, address _to, bytes calldata _data) external view returns (bool valid);
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":999,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"/Users/ovdbigge/argent/contracts5/contracts/infrastructure/dapp/GroWithdrawFilter.sol":"GroWithdrawFilter"}}
Contract ABI
[{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"valid","internalType":"bool"}],"name":"isValid","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"_spender","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"bytes","name":"_data","internalType":"bytes"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506102bc806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e0274e1d14610030575b600080fd5b61004361003e3660046101e9565b610057565b604051901515815260200160405180910390f35b6000600482101561006a575060006101b0565b60006100ab84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101b992505050565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161480156101ac57506001600160e01b031981167f9793869b00000000000000000000000000000000000000000000000000000000148061014457506001600160e01b031981167f6a4a345800000000000000000000000000000000000000000000000000000000145b8061017857506001600160e01b031981167fda70fd7b00000000000000000000000000000000000000000000000000000000145b806101ac57506001600160e01b031981167fe2ee334300000000000000000000000000000000000000000000000000000000145b9150505b95945050505050565b6020015190565b803573ffffffffffffffffffffffffffffffffffffffff811681146101e457600080fd5b919050565b600080600080600060808688031215610200578081fd5b610209866101c0565b9450610217602087016101c0565b9350610225604087016101c0565b9250606086013567ffffffffffffffff80821115610241578283fd5b818801915088601f830112610254578283fd5b813581811115610262578384fd5b896020828501011115610273578384fd5b969995985093965060200194939250505056fea2646970667358221220df8493f74aa371a2e0e60703de05306178e8fe571e1ff22859f81ee2effc142664736f6c63430008030033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e0274e1d14610030575b600080fd5b61004361003e3660046101e9565b610057565b604051901515815260200160405180910390f35b6000600482101561006a575060006101b0565b60006100ab84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101b992505050565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161480156101ac57506001600160e01b031981167f9793869b00000000000000000000000000000000000000000000000000000000148061014457506001600160e01b031981167f6a4a345800000000000000000000000000000000000000000000000000000000145b8061017857506001600160e01b031981167fda70fd7b00000000000000000000000000000000000000000000000000000000145b806101ac57506001600160e01b031981167fe2ee334300000000000000000000000000000000000000000000000000000000145b9150505b95945050505050565b6020015190565b803573ffffffffffffffffffffffffffffffffffffffff811681146101e457600080fd5b919050565b600080600080600060808688031215610200578081fd5b610209866101c0565b9450610217602087016101c0565b9350610225604087016101c0565b9250606086013567ffffffffffffffff80821115610241578283fd5b818801915088601f830112610254578283fd5b813581811115610262578384fd5b896020828501011115610273578384fd5b969995985093965060200194939250505056fea2646970667358221220df8493f74aa371a2e0e60703de05306178e8fe571e1ff22859f81ee2effc142664736f6c63430008030033