Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vittominacori committed Feb 10, 2022
1 parent 4a58dd8 commit e1fd9a4
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Expand Up @@ -8,7 +8,8 @@ charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
trim_trailing_whitespace = false
max_line_length = 120

[*.sol]
indent_size = 4
Expand Down
7 changes: 3 additions & 4 deletions .prettierrc
@@ -1,13 +1,12 @@
{
"singleQuote": true,
"trailingComma": "all",
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"printWidth": 120,
"explicitTypes": "always"
}
}
Expand Down
12 changes: 10 additions & 2 deletions .solhint.json
@@ -1,6 +1,14 @@
{
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
"no-unused-vars": "error",
"const-name-snakecase": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "error",
"func-name-mixedcase": "error",
"func-param-name-mixedcase": "error",
"modifier-name-mixedcase": "error",
"private-vars-leading-underscore": "error",
"var-name-mixedcase": "error",
"imports-on-top": "error"
}
}
48 changes: 24 additions & 24 deletions contracts/token/ERC1363/ERC1363.sol
Expand Up @@ -26,68 +26,68 @@ abstract contract ERC1363 is ERC20, IERC1363, ERC165 {
}

/**
* @dev Transfer tokens to a specified address and then execute a callback on recipient.
* @param recipient The address to transfer to.
* @dev Transfer tokens to a specified address and then execute a callback on `to`.
* @param to The address to transfer to.
* @param amount The amount to be transferred.
* @return A boolean that indicates if the operation was successful.
*/
function transferAndCall(address recipient, uint256 amount) public virtual override returns (bool) {
return transferAndCall(recipient, amount, "");
function transferAndCall(address to, uint256 amount) public virtual override returns (bool) {
return transferAndCall(to, amount, "");
}

/**
* @dev Transfer tokens to a specified address and then execute a callback on recipient.
* @param recipient The address to transfer to
* @dev Transfer tokens to a specified address and then execute a callback on `to`.
* @param to The address to transfer to
* @param amount The amount to be transferred
* @param data Additional data with no specified format
* @return A boolean that indicates if the operation was successful.
*/
function transferAndCall(
address recipient,
address to,
uint256 amount,
bytes memory data
) public virtual override returns (bool) {
transfer(recipient, amount);
require(_checkAndCallTransfer(_msgSender(), recipient, amount, data), "ERC1363: _checkAndCallTransfer reverts");
transfer(to, amount);
require(_checkAndCallTransfer(_msgSender(), to, amount, data), "ERC1363: _checkAndCallTransfer reverts");
return true;
}

/**
* @dev Transfer tokens from one address to another and then execute a callback on recipient.
* @param sender The address which you want to send tokens from
* @param recipient The address which you want to transfer to
* @dev Transfer tokens from one address to another and then execute a callback on `to`.
* @param from The address which you want to send tokens from
* @param to The address which you want to transfer to
* @param amount The amount of tokens to be transferred
* @return A boolean that indicates if the operation was successful.
*/
function transferFromAndCall(
address sender,
address recipient,
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
return transferFromAndCall(sender, recipient, amount, "");
return transferFromAndCall(from, to, amount, "");
}

/**
* @dev Transfer tokens from one address to another and then execute a callback on recipient.
* @param sender The address which you want to send tokens from
* @param recipient The address which you want to transfer to
* @dev Transfer tokens from one address to another and then execute a callback on `to`.
* @param from The address which you want to send tokens from
* @param to The address which you want to transfer to
* @param amount The amount of tokens to be transferred
* @param data Additional data with no specified format
* @return A boolean that indicates if the operation was successful.
*/
function transferFromAndCall(
address sender,
address recipient,
address from,
address to,
uint256 amount,
bytes memory data
) public virtual override returns (bool) {
transferFrom(sender, recipient, amount);
require(_checkAndCallTransfer(sender, recipient, amount, data), "ERC1363: _checkAndCallTransfer reverts");
transferFrom(from, to, amount);
require(_checkAndCallTransfer(from, to, amount, data), "ERC1363: _checkAndCallTransfer reverts");
return true;
}

/**
* @dev Approve spender to transfer tokens and then execute a callback on recipient.
* @dev Approve spender to transfer tokens and then execute a callback on `to`.
* @param spender The address allowed to transfer to
* @param amount The amount allowed to be transferred
* @return A boolean that indicates if the operation was successful.
Expand All @@ -97,7 +97,7 @@ abstract contract ERC1363 is ERC20, IERC1363, ERC165 {
}

/**
* @dev Approve spender to transfer tokens and then execute a callback on recipient.
* @dev Approve spender to transfer tokens and then execute a callback on spender.
* @param spender The address allowed to transfer to.
* @param amount The amount allowed to be transferred.
* @param data Additional data with no specified format.
Expand Down
20 changes: 10 additions & 10 deletions contracts/token/ERC1363/IERC1363.sol
Expand Up @@ -14,49 +14,49 @@ import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC1363 is IERC20, IERC165 {
/**
* @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
* @param recipient address The address which you want to transfer to
* @param to address The address which you want to transfer to
* @param amount uint256 The amount of tokens to be transferred
* @return true unless throwing
*/
function transferAndCall(address recipient, uint256 amount) external returns (bool);
function transferAndCall(address to, uint256 amount) external returns (bool);

/**
* @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
* @param recipient address The address which you want to transfer to
* @param to address The address which you want to transfer to
* @param amount uint256 The amount of tokens to be transferred
* @param data bytes Additional data with no specified format, sent in call to `recipient`
* @param data bytes Additional data with no specified format, sent in call to `to`
* @return true unless throwing
*/
function transferAndCall(
address recipient,
address to,
uint256 amount,
bytes calldata data
) external returns (bool);

/**
* @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver
* @param sender address The address which you want to send tokens from
* @param recipient address The address which you want to transfer to
* @param to address The address which you want to transfer to
* @param amount uint256 The amount of tokens to be transferred
* @return true unless throwing
*/
function transferFromAndCall(
address sender,
address recipient,
address to,
uint256 amount
) external returns (bool);

/**
* @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver
* @param sender address The address which you want to send tokens from
* @param recipient address The address which you want to transfer to
* @param to address The address which you want to transfer to
* @param amount uint256 The amount of tokens to be transferred
* @param data bytes Additional data with no specified format, sent in call to `recipient`
* @param data bytes Additional data with no specified format, sent in call to `to`
* @return true unless throwing
*/
function transferFromAndCall(
address sender,
address recipient,
address to,
uint256 amount,
bytes calldata data
) external returns (bool);
Expand Down
24 changes: 12 additions & 12 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "erc-payable-token",
"version": "4.4.2",
"version": "4.5.0",
"description": "ERC-1363 Payable Token Implementation",
"files": [
"contracts",
Expand All @@ -20,9 +20,9 @@
"profile": "npm run clean && npm run coverage && open coverage/index.html",
"lint": "npm run lint:js && npm run lint:sol",
"lint:fix": "npm run lint:js:fix && npm run lint:sol:fix",
"lint:js": "eslint .",
"lint:js:fix": "eslint . --fix",
"lint:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\"",
"lint:js": "eslint --ignore-path .gitignore .",
"lint:js:fix": "eslint --ignore-path .gitignore . --fix",
"lint:sol": "solhint 'contracts/**/*.sol' && prettier -c 'contracts/**/*.sol'",
"lint:sol:fix": "prettier --write \"contracts/**/*.sol\"",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
Expand All @@ -47,30 +47,30 @@
},
"homepage": "https://vittominacori.github.io/erc1363-payable-token",
"dependencies": {
"@openzeppelin/contracts": "4.4.2"
"@openzeppelin/contracts": "4.5.0"
},
"devDependencies": {
"@nomiclabs/hardhat-ganache": "^2.0.1",
"@nomiclabs/hardhat-truffle5": "^2.0.3",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/test-helpers": "^0.5.15",
"@vuepress/plugin-google-analytics": "^1.8.2",
"chai": "^4.3.4",
"@vuepress/plugin-google-analytics": "^1.9.7",
"chai": "4.3.4",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-standard": "^5.0.0",
"ganache-cli": "^6.12.2",
"hardhat": "^2.8.0",
"hardhat": "^2.8.3",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.6",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.17",
"truffle": "^5.4.24",
"vuepress": "^1.8.2"
"solidity-coverage": "^0.7.19",
"truffle": "^5.4.32",
"vuepress": "^1.9.7"
}
}
4 changes: 2 additions & 2 deletions test/token/ERC1363/ERC1363.behaviour.js
Expand Up @@ -61,7 +61,7 @@ function shouldBehaveLikeERC1363 ([owner, spender, recipient], balance) {
it('reverts', async function () {
await expectRevert(
transferFromAndCallWithData.call(this, sender, receiver, amount, { from: spender }),
'ERC20: transfer amount exceeds balance',
'ERC20: insufficient allowance',
);
});
});
Expand All @@ -70,7 +70,7 @@ function shouldBehaveLikeERC1363 ([owner, spender, recipient], balance) {
it('reverts', async function () {
await expectRevert(
transferFromAndCallWithoutData.call(this, sender, receiver, amount, { from: spender }),
'ERC20: transfer amount exceeds balance',
'ERC20: insufficient allowance',
);
});
});
Expand Down

0 comments on commit e1fd9a4

Please sign in to comment.