Skip to content

Commit

Permalink
feat: update ci and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vittominacori committed May 10, 2024
1 parent 738e6ce commit 6d1f5cf
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 269 deletions.
7 changes: 4 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Setup

runs:
using: composite
steps:
steps:
- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v4.0.2
with:
node-version: 20

- name: Setup Cache
uses: actions/cache@v4
uses: actions/cache@v4.0.2
id: cache
with:
path: '**/node_modules'
Expand All @@ -18,3 +18,4 @@ runs:
- name: Install dependencies
run: npm ci
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Setup Code
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Setup Environment
uses: ./.github/actions/setup
Expand All @@ -32,8 +32,8 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Setup Code
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Setup Environment
uses: ./.github/actions/setup

Expand All @@ -50,16 +50,16 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Setup Code
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Setup Environment
uses: ./.github/actions/setup

- name: Run Coverage
run: npm run coverage

- name: Post to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v4.3.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -70,13 +70,13 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Setup Code
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Setup Environment
uses: ./.github/actions/setup

- name: Run Slither
uses: crytic/slither-action@v0.3.2
uses: crytic/slither-action@v0.4.0
with:
node-version: 20

Expand All @@ -86,7 +86,9 @@ jobs:
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- name: Setup Code
uses: actions/checkout@v4.1.4

- name: Run CodeSpell
uses: codespell-project/actions-codespell@v2.0
with:
Expand Down
2 changes: 1 addition & 1 deletion dist/ERC1363.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.22.2 https://hardhat.org
// Sources flattened with hardhat v2.22.3 https://hardhat.org



Expand Down
184 changes: 92 additions & 92 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,16 @@ _Called after validating a `onApprovalReceived`. Implement this method to make y
| value | uint256 | The amount of tokens to be spent. |
| data | bytes | Additional data with no specified format. |

## ERC1363

_Implementation of the ERC-1363 interface.

Extension of ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction._

### supportsInterface

```solidity
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
```
## IERC1363

_Returns true if this contract implements the interface defined by
`interfaceId`. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
to learn more about how these ids are created.
_Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].

This function call must use less than 30 000 gas._
An extension interface for ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction._

### transferAndCall

```solidity
function transferAndCall(address to, uint256 value) public virtual returns (bool)
function transferAndCall(address to, uint256 value) external returns (bool)
```

_Moves a `value` amount of tokens from the caller's account to `to` and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -156,7 +143,7 @@ _Moves a `value` amount of tokens from the caller's account to `to` and then cal
### transferAndCall

```solidity
function transferAndCall(address to, uint256 value, bytes data) public virtual returns (bool)
function transferAndCall(address to, uint256 value, bytes data) external returns (bool)
```

_Moves a `value` amount of tokens from the caller's account to `to` and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -178,7 +165,7 @@ _Moves a `value` amount of tokens from the caller's account to `to` and then cal
### transferFromAndCall

```solidity
function transferFromAndCall(address from, address to, uint256 value) public virtual returns (bool)
function transferFromAndCall(address from, address to, uint256 value) external returns (bool)
```

_Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -200,7 +187,7 @@ _Moves a `value` amount of tokens from `from` to `to` using the allowance mechan
### transferFromAndCall

```solidity
function transferFromAndCall(address from, address to, uint256 value, bytes data) public virtual returns (bool)
function transferFromAndCall(address from, address to, uint256 value, bytes data) external returns (bool)
```

_Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -223,7 +210,7 @@ _Moves a `value` amount of tokens from `from` to `to` using the allowance mechan
### approveAndCall

```solidity
function approveAndCall(address spender, uint256 value) public virtual returns (bool)
function approveAndCall(address spender, uint256 value) external returns (bool)
```

_Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls `IERC1363Spender::onApprovalReceived` on `spender`._
Expand All @@ -244,7 +231,7 @@ _Sets a `value` amount of tokens as the allowance of `spender` over the caller's
### approveAndCall

```solidity
function approveAndCall(address spender, uint256 value, bytes data) public virtual returns (bool)
function approveAndCall(address spender, uint256 value, bytes data) external returns (bool)
```

_Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls `IERC1363Spender::onApprovalReceived` on `spender`._
Expand All @@ -263,16 +250,90 @@ _Sets a `value` amount of tokens as the allowance of `spender` over the caller's
| ---- | ---- | ----------- |
| [0] | bool | A boolean value indicating the operation succeeded unless throwing. |

## IERC1363
## IERC1363Receiver

_Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
_Interface for any contract that wants to support `transferAndCall` or `transferFromAndCall` from ERC-1363 token contracts._

An extension interface for ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction._
### onTransferReceived

```solidity
function onTransferReceived(address operator, address from, uint256 value, bytes data) external returns (bytes4)
```

_Whenever ERC-1363 tokens are transferred to this contract via `IERC1363::transferAndCall` or `IERC1363::transferFromAndCall` by `operator` from `from`, this function is called.

NOTE: To accept the transfer, this must return
`bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`
(i.e. 0x88a7ca5c, or its own function selector)._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| operator | address | The address which called `transferAndCall` or `transferFromAndCall` function. |
| from | address | The address which are tokens transferred from. |
| value | uint256 | The amount of tokens transferred. |
| data | bytes | Additional data with no specified format. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes4 | `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` if transfer is allowed unless throwing. |

## IERC1363Spender

_Interface for any contract that wants to support `approveAndCall` from ERC-1363 token contracts._

### onApprovalReceived

```solidity
function onApprovalReceived(address owner, uint256 value, bytes data) external returns (bytes4)
```

_Whenever an ERC-1363 tokens `owner` approves this contract via `IERC1363::approveAndCall` to spend their tokens, this function is called.

NOTE: To accept the approval, this must return
`bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
(i.e. 0x7b04a2d0, or its own function selector)._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| owner | address | The address which called `approveAndCall` function and previously owned the tokens. |
| value | uint256 | The amount of tokens to be spent. |
| data | bytes | Additional data with no specified format. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes4 | `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` if approval is allowed unless throwing. |

## ERC1363

_Implementation of the ERC-1363 interface.

Extension of ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction._

### supportsInterface

```solidity
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
```

_Returns true if this contract implements the interface defined by
`interfaceId`. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
to learn more about how these ids are created.

This function call must use less than 30 000 gas._

### transferAndCall

```solidity
function transferAndCall(address to, uint256 value) external returns (bool)
function transferAndCall(address to, uint256 value) public virtual returns (bool)
```

_Moves a `value` amount of tokens from the caller's account to `to` and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -293,7 +354,7 @@ _Moves a `value` amount of tokens from the caller's account to `to` and then cal
### transferAndCall

```solidity
function transferAndCall(address to, uint256 value, bytes data) external returns (bool)
function transferAndCall(address to, uint256 value, bytes data) public virtual returns (bool)
```

_Moves a `value` amount of tokens from the caller's account to `to` and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -315,7 +376,7 @@ _Moves a `value` amount of tokens from the caller's account to `to` and then cal
### transferFromAndCall

```solidity
function transferFromAndCall(address from, address to, uint256 value) external returns (bool)
function transferFromAndCall(address from, address to, uint256 value) public virtual returns (bool)
```

_Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -337,7 +398,7 @@ _Moves a `value` amount of tokens from `from` to `to` using the allowance mechan
### transferFromAndCall

```solidity
function transferFromAndCall(address from, address to, uint256 value, bytes data) external returns (bool)
function transferFromAndCall(address from, address to, uint256 value, bytes data) public virtual returns (bool)
```

_Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls `IERC1363Receiver::onTransferReceived` on `to`._
Expand All @@ -360,7 +421,7 @@ _Moves a `value` amount of tokens from `from` to `to` using the allowance mechan
### approveAndCall

```solidity
function approveAndCall(address spender, uint256 value) external returns (bool)
function approveAndCall(address spender, uint256 value) public virtual returns (bool)
```

_Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls `IERC1363Spender::onApprovalReceived` on `spender`._
Expand All @@ -381,7 +442,7 @@ _Sets a `value` amount of tokens as the allowance of `spender` over the caller's
### approveAndCall

```solidity
function approveAndCall(address spender, uint256 value, bytes data) external returns (bool)
function approveAndCall(address spender, uint256 value, bytes data) public virtual returns (bool)
```

_Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls `IERC1363Spender::onApprovalReceived` on `spender`._
Expand Down Expand Up @@ -506,64 +567,3 @@ _Indicates a failure with the ERC-20 `approve` during a `approveAndCall` operati
| spender | address | The address which will spend the funds. |
| value | uint256 | The amount of tokens to be spent. |

## IERC1363Receiver

_Interface for any contract that wants to support `transferAndCall` or `transferFromAndCall` from ERC-1363 token contracts._

### onTransferReceived

```solidity
function onTransferReceived(address operator, address from, uint256 value, bytes data) external returns (bytes4)
```

_Whenever ERC-1363 tokens are transferred to this contract via `IERC1363::transferAndCall` or `IERC1363::transferFromAndCall` by `operator` from `from`, this function is called.

NOTE: To accept the transfer, this must return
`bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`
(i.e. 0x88a7ca5c, or its own function selector)._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| operator | address | The address which called `transferAndCall` or `transferFromAndCall` function. |
| from | address | The address which are tokens transferred from. |
| value | uint256 | The amount of tokens transferred. |
| data | bytes | Additional data with no specified format. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes4 | `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` if transfer is allowed unless throwing. |

## IERC1363Spender

_Interface for any contract that wants to support `approveAndCall` from ERC-1363 token contracts._

### onApprovalReceived

```solidity
function onApprovalReceived(address owner, uint256 value, bytes data) external returns (bytes4)
```

_Whenever an ERC-1363 tokens `owner` approves this contract via `IERC1363::approveAndCall` to spend their tokens, this function is called.

NOTE: To accept the approval, this must return
`bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
(i.e. 0x7b04a2d0, or its own function selector)._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| owner | address | The address which called `approveAndCall` function and previously owned the tokens. |
| value | uint256 | The amount of tokens to be spent. |
| data | bytes | Additional data with no specified format. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes4 | `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` if approval is allowed unless throwing. |

Loading

0 comments on commit 6d1f5cf

Please sign in to comment.