Skip to content

Commit

Permalink
feat: update solc and dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
vittominacori committed Nov 14, 2023
1 parent a207243 commit 458a806
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 118 deletions.
4 changes: 2 additions & 2 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
norpc: true,
testCommand: 'npm run hardhat:test',
compileCommand: 'npm run hardhat:compile',
testCommand: 'npm test',
compileCommand: 'npm run compile',
skipFiles: ['mocks'],
};
Binary file modified analysis/control-flow/TokenRecoverLegacy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/ERC20Recover.dist.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

// Sources flattened with hardhat v2.18.3 https://hardhat.org
// Sources flattened with hardhat v2.19.0 https://hardhat.org



Expand Down
2 changes: 1 addition & 1 deletion dist/ERC721Recover.dist.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

// Sources flattened with hardhat v2.18.3 https://hardhat.org
// Sources flattened with hardhat v2.19.0 https://hardhat.org



Expand Down
2 changes: 1 addition & 1 deletion dist/TokenRecover.dist.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

// Sources flattened with hardhat v2.18.3 https://hardhat.org
// Sources flattened with hardhat v2.19.0 https://hardhat.org



Expand Down
2 changes: 1 addition & 1 deletion dist/TokenRecoverLegacy.dist.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

// Sources flattened with hardhat v2.18.3 https://hardhat.org
// Sources flattened with hardhat v2.19.0 https://hardhat.org



Expand Down
98 changes: 49 additions & 49 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
# Solidity API

## TokenRecoverLegacy

_Allows the contract owner to recover any ERC20 token sent into the contract and send them to `owner()`.

WARNING: The deployer address will automatically be set as contract owner.
## ERC20Recover

NOTE: this is a legacy version of `TokenRecover` that works as v4.x and earlier and MAY be removed in future releases.
We highly recommend to keep the code updated to use newer versions of the recover._
_Allows the contract owner to recover any ERC20 token sent into the contract and send them to a receiver._

### constructor

```solidity
constructor() internal
constructor(address initialOwner) internal
```

_Initializes the contract setting the deployer as the initial owner._
_Initializes the contract setting the address provided by the deployer as the initial owner._

### recoverERC20

```solidity
function recoverERC20(address tokenAddress, uint256 tokenAmount) public virtual
function recoverERC20(address tokenAddress, address tokenReceiver, uint256 tokenAmount) public virtual
```

_Recovers a `tokenAmount` of the ERC20 `tokenAddress` locked into this contract
and sends them to the `owner()` address.
and sends them to the `tokenReceiver` address.

NOTE: restricting access to owner only. See `RecoverERC20::_recoverERC20`._

Expand All @@ -33,34 +28,44 @@ NOTE: restricting access to owner only. See `RecoverERC20::_recoverERC20`._
| Name | Type | Description |
| ---- | ---- | ----------- |
| tokenAddress | address | The contract address of the token to recover. |
| tokenReceiver | address | The address that will receive the recovered tokens. |
| tokenAmount | uint256 | Number of tokens to be recovered. |

## RecoverERC20
## ERC721Recover

_Allows to recover any ERC20 token sent into the contract and send them to a receiver._
_Allows the contract owner to recover any ERC721 token sent into the contract and send them to a receiver._

### _recoverERC20
### constructor

```solidity
function _recoverERC20(address tokenAddress, address tokenReceiver, uint256 tokenAmount) internal virtual
constructor(address initialOwner) internal
```

_Recovers a `tokenAmount` of the ERC20 `tokenAddress` locked into this contract
and sends them to the `tokenReceiver` address.
_Initializes the contract setting the address provided by the deployer as the initial owner._

WARNING: it allows everyone to recover tokens. Access controls MUST be defined in derived contracts._
### recoverERC721

```solidity
function recoverERC721(address tokenAddress, address tokenReceiver, uint256 tokenId, bytes data) public virtual
```

_Recovers the `tokenId` of the ERC721 `tokenAddress` locked into this contract
and sends it to the `tokenReceiver` address.

NOTE: restricting access to owner only. See `RecoverERC721::_recoverERC721`._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| tokenAddress | address | The contract address of the token to recover. |
| tokenReceiver | address | The address that will receive the recovered tokens. |
| tokenAmount | uint256 | Number of tokens to be recovered. |
| tokenReceiver | address | The address that will receive the recovered token. |
| tokenId | uint256 | The identifier for the NFT to be recovered. |
| data | bytes | Additional data with no specified format. |

## ERC20Recover
## TokenRecover

_Allows the contract owner to recover any ERC20 token sent into the contract and send them to a receiver._
_Allows the contract owner to recover any ERC20 or ERC721 token sent into the contract and send them to a receiver._

### constructor

Expand Down Expand Up @@ -89,18 +94,6 @@ NOTE: restricting access to owner only. See `RecoverERC20::_recoverERC20`._
| tokenReceiver | address | The address that will receive the recovered tokens. |
| tokenAmount | uint256 | Number of tokens to be recovered. |

## ERC721Recover

_Allows the contract owner to recover any ERC721 token sent into the contract and send them to a receiver._

### constructor

```solidity
constructor(address initialOwner) internal
```

_Initializes the contract setting the address provided by the deployer as the initial owner._

### recoverERC721

```solidity
Expand All @@ -121,26 +114,31 @@ NOTE: restricting access to owner only. See `RecoverERC721::_recoverERC721`._
| tokenId | uint256 | The identifier for the NFT to be recovered. |
| data | bytes | Additional data with no specified format. |

## TokenRecover
## TokenRecoverLegacy

_Allows the contract owner to recover any ERC20 or ERC721 token sent into the contract and send them to a receiver._
_Allows the contract owner to recover any ERC20 token sent into the contract and send them to `owner()`.

WARNING: The deployer address will automatically be set as contract owner.

NOTE: this is a legacy version of `TokenRecover` that works as v4.x and earlier and MAY be removed in future releases.
We highly recommend to keep the code updated to use newer versions of the recover._

### constructor

```solidity
constructor(address initialOwner) internal
constructor() internal
```

_Initializes the contract setting the address provided by the deployer as the initial owner._
_Initializes the contract setting the deployer as the initial owner._

### recoverERC20

```solidity
function recoverERC20(address tokenAddress, address tokenReceiver, uint256 tokenAmount) public virtual
function recoverERC20(address tokenAddress, uint256 tokenAmount) public virtual
```

_Recovers a `tokenAmount` of the ERC20 `tokenAddress` locked into this contract
and sends them to the `tokenReceiver` address.
and sends them to the `owner()` address.

NOTE: restricting access to owner only. See `RecoverERC20::_recoverERC20`._

Expand All @@ -149,28 +147,30 @@ NOTE: restricting access to owner only. See `RecoverERC20::_recoverERC20`._
| Name | Type | Description |
| ---- | ---- | ----------- |
| tokenAddress | address | The contract address of the token to recover. |
| tokenReceiver | address | The address that will receive the recovered tokens. |
| tokenAmount | uint256 | Number of tokens to be recovered. |

### recoverERC721
## RecoverERC20

_Allows to recover any ERC20 token sent into the contract and send them to a receiver._

### _recoverERC20

```solidity
function recoverERC721(address tokenAddress, address tokenReceiver, uint256 tokenId, bytes data) public virtual
function _recoverERC20(address tokenAddress, address tokenReceiver, uint256 tokenAmount) internal virtual
```

_Recovers the `tokenId` of the ERC721 `tokenAddress` locked into this contract
and sends it to the `tokenReceiver` address.
_Recovers a `tokenAmount` of the ERC20 `tokenAddress` locked into this contract
and sends them to the `tokenReceiver` address.

NOTE: restricting access to owner only. See `RecoverERC721::_recoverERC721`._
WARNING: it allows everyone to recover tokens. Access controls MUST be defined in derived contracts._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| tokenAddress | address | The contract address of the token to recover. |
| tokenReceiver | address | The address that will receive the recovered token. |
| tokenId | uint256 | The identifier for the NFT to be recovered. |
| data | bytes | Additional data with no specified format. |
| tokenReceiver | address | The address that will receive the recovered tokens. |
| tokenAmount | uint256 | Number of tokens to be recovered. |

## RecoverERC721

Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require('solidity-docgen');
module.exports = {
defaultNetwork: 'hardhat',
solidity: {
version: '0.8.22',
version: '0.8.23',
settings: {
evmVersion: 'shanghai',
optimizer: {
Expand Down
Loading

0 comments on commit 458a806

Please sign in to comment.