Commit 7612c21b authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into 07-21-feat_Better_clean_script

parents f0310fdf 15460387
......@@ -5,37 +5,26 @@ import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
import { Transactor } from "./Transactor.sol";
/**
* @title AssetReceiver
* @notice AssetReceiver is a minimal contract for receiving funds assets in the form of either
* ETH, ERC20 tokens, or ERC721 tokens. Only the contract owner may withdraw the assets.
*/
/// @title AssetReceiver
/// @notice AssetReceiver is a minimal contract for receiving funds assets in the form of either
/// ETH, ERC20 tokens, or ERC721 tokens. Only the contract owner may withdraw the assets.
contract AssetReceiver is Transactor {
/**
* @notice Emitted when ETH is received by this address.
*
* @param from Address that sent ETH to this contract.
* @param amount Amount of ETH received.
*/
/// @notice Emitted when ETH is received by this address.
/// @param from Address that sent ETH to this contract.
/// @param amount Amount of ETH received.
event ReceivedETH(address indexed from, uint256 amount);
/**
* @notice Emitted when ETH is withdrawn from this address.
*
* @param withdrawer Address that triggered the withdrawal.
* @param recipient Address that received the withdrawal.
* @param amount ETH amount withdrawn.
*/
/// @notice Emitted when ETH is withdrawn from this address.
/// @param withdrawer Address that triggered the withdrawal.
/// @param recipient Address that received the withdrawal.
/// @param amount ETH amount withdrawn.
event WithdrewETH(address indexed withdrawer, address indexed recipient, uint256 amount);
/**
* @notice Emitted when ERC20 tokens are withdrawn from this address.
*
* @param withdrawer Address that triggered the withdrawal.
* @param recipient Address that received the withdrawal.
* @param asset Address of the token being withdrawn.
* @param amount ERC20 amount withdrawn.
*/
/// @notice Emitted when ERC20 tokens are withdrawn from this address.
/// @param withdrawer Address that triggered the withdrawal.
/// @param recipient Address that received the withdrawal.
/// @param asset Address of the token being withdrawn.
/// @param amount ERC20 amount withdrawn.
event WithdrewERC20(
address indexed withdrawer,
address indexed recipient,
......@@ -43,14 +32,11 @@ contract AssetReceiver is Transactor {
uint256 amount
);
/**
* @notice Emitted when ERC20 tokens are withdrawn from this address.
*
* @param withdrawer Address that triggered the withdrawal.
* @param recipient Address that received the withdrawal.
* @param asset Address of the token being withdrawn.
* @param id Token ID being withdrawn.
*/
/// @notice Emitted when ERC20 tokens are withdrawn from this address.
/// @param withdrawer Address that triggered the withdrawal.
/// @param recipient Address that received the withdrawal.
/// @param asset Address of the token being withdrawn.
/// @param id Token ID being withdrawn.
event WithdrewERC721(
address indexed withdrawer,
address indexed recipient,
......@@ -58,56 +44,40 @@ contract AssetReceiver is Transactor {
uint256 id
);
/**
* @param _owner Initial contract owner.
*/
/// @param _owner Initial contract owner.
constructor(address _owner) Transactor(_owner) {}
/**
* @notice Make sure we can receive ETH.
*/
/// @notice Make sure we can receive ETH.
receive() external payable {
emit ReceivedETH(msg.sender, msg.value);
}
/**
* @notice Withdraws full ETH balance to the recipient.
*
* @param _to Address to receive the ETH balance.
*/
/// @notice Withdraws full ETH balance to the recipient.
/// @param _to Address to receive the ETH balance.
function withdrawETH(address payable _to) external onlyOwner {
withdrawETH(_to, address(this).balance);
}
/**
* @notice Withdraws partial ETH balance to the recipient.
*
* @param _to Address to receive the ETH balance.
* @param _amount Amount of ETH to withdraw.
*/
/// @notice Withdraws partial ETH balance to the recipient.
/// @param _to Address to receive the ETH balance.
/// @param _amount Amount of ETH to withdraw.
function withdrawETH(address payable _to, uint256 _amount) public onlyOwner {
// slither-disable-next-line reentrancy-unlimited-gas
(bool success, ) = _to.call{ value: _amount }("");
emit WithdrewETH(msg.sender, _to, _amount);
}
/**
* @notice Withdraws full ERC20 balance to the recipient.
*
* @param _asset ERC20 token to withdraw.
* @param _to Address to receive the ERC20 balance.
*/
/// @notice Withdraws full ERC20 balance to the recipient.
/// @param _asset ERC20 token to withdraw.
/// @param _to Address to receive the ERC20 balance.
function withdrawERC20(ERC20 _asset, address _to) external onlyOwner {
withdrawERC20(_asset, _to, _asset.balanceOf(address(this)));
}
/**
* @notice Withdraws partial ERC20 balance to the recipient.
*
* @param _asset ERC20 token to withdraw.
* @param _to Address to receive the ERC20 balance.
* @param _amount Amount of ERC20 to withdraw.
*/
/// @notice Withdraws partial ERC20 balance to the recipient.
/// @param _asset ERC20 token to withdraw.
/// @param _to Address to receive the ERC20 balance.
/// @param _amount Amount of ERC20 to withdraw.
function withdrawERC20(
ERC20 _asset,
address _to,
......@@ -119,13 +89,10 @@ contract AssetReceiver is Transactor {
emit WithdrewERC20(msg.sender, _to, address(_asset), _amount);
}
/**
* @notice Withdraws ERC721 token to the recipient.
*
* @param _asset ERC721 token to withdraw.
* @param _to Address to receive the ERC721 token.
* @param _id Token ID of the ERC721 token to withdraw.
*/
/// @notice Withdraws ERC721 token to the recipient.
/// @param _asset ERC721 token to withdraw.
/// @param _to Address to receive the ERC721 token.
/// @param _id Token ID of the ERC721 token to withdraw.
function withdrawERC721(
ERC721 _asset,
address _to,
......
......@@ -3,50 +3,38 @@ pragma solidity ^0.8.0;
import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
/**
* @title Transactor
* @notice Transactor is a minimal contract that can send transactions.
*/
/// @title Transactor
/// @notice Transactor is a minimal contract that can send transactions.
contract Transactor is Owned {
/**
* @param _owner Initial contract owner.
*/
/// @param _owner Initial contract owner.
constructor(address _owner) Owned(_owner) {}
/**
* Sends a CALL to a target address.
*
* @param _target Address to call.
* @param _data Data to send with the call.
* @param _value ETH value to send with the call.
*
* @return Boolean success value.
* @return Bytes data returned by the call.
*/
/// @notice Sends a CALL to a target address.
/// @param _target Address to call.
/// @param _data Data to send with the call.
/// @param _value ETH value to send with the call.
/// @return success_ Boolean success value.
/// @return data_ Bytes data returned by the call.
function CALL(
address _target,
bytes memory _data,
uint256 _value
) external payable onlyOwner returns (bool, bytes memory) {
return _target.call{ value: _value }(_data);
) external payable onlyOwner returns (bool success_, bytes memory data_) {
(success_, data_) = _target.call{ value: _value }(_data);
}
/**
* Sends a DELEGATECALL to a target address.
*
* @param _target Address to call.
* @param _data Data to send with the call.
*
* @return Boolean success value.
* @return Bytes data returned by the call.
*/
/// @notice Sends a DELEGATECALL to a target address.
/// @param _target Address to call.
/// @param _data Data to send with the call.
/// @return success_ Boolean success value.
/// @return data_ Bytes data returned by the call.
function DELEGATECALL(address _target, bytes memory _data)
external
payable
onlyOwner
returns (bool, bytes memory)
returns (bool success_, bytes memory data_)
{
// slither-disable-next-line controlled-delegatecall
return _target.delegatecall(_data);
(success_, data_) = _target.delegatecall(_data);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment