Compare commits

...

12 Commits

Author SHA1 Message Date
Github Actions
28193479c6 Publish
- @0x/contracts-erc20@3.3.52
 - @0x/contracts-test-utils@5.4.42
 - @0x/contracts-treasury@1.4.35
 - @0x/contracts-utils@4.8.33
 - @0x/contracts-zero-ex@0.38.1
 - @0x/asset-swapper@16.66.19
 - @0x/contract-addresses@7.4.0
 - @0x/contract-wrappers@13.22.11
 - @0x/protocol-utils@11.17.1
2022-11-15 01:50:44 +00:00
Github Actions
70212534a1 Updated CHANGELOGS & MD docs 2022-11-15 01:50:40 +00:00
Kyu
ea9575e94d Update Polygon FillQuoteTransformer to support Solidly (and its forks) (#616) 2022-11-14 16:01:08 -08:00
Elena
ca0b074893 Add Solidity linter (#608)
* Add solhint and basic configuration

* Add solhint-plugin-prettier to run prettier via solhint

* Remove all solhint-disable rules in contracts

* Turn off compiler version errors

* Fix max-line-length linter errors

* Fix linting and prettier issues in contracts

* Add global lint command to run both ts and solidity linter
2022-11-08 16:12:42 +02:00
Github Actions
b3281bfdb1 Publish
- @0x/contracts-erc20@3.3.51
 - @0x/contracts-test-utils@5.4.41
 - @0x/contracts-treasury@1.4.34
 - @0x/contracts-utils@4.8.32
 - @0x/contracts-zero-ex@0.38.0
 - @0x/asset-swapper@16.66.18
 - @0x/contract-addresses@7.3.0
 - @0x/contract-wrappers@13.22.10
 - @0x/protocol-utils@11.17.0
2022-11-05 00:19:12 +00:00
Github Actions
1516bf6a24 Updated CHANGELOGS & MD docs 2022-11-05 00:19:08 +00:00
Kyu
ab19bb41c4 Update fee-related transformer addresses (#615) 2022-11-04 17:02:44 -07:00
Kyu
7368aded88 Rename VelodromeMixin to SolidlyMixin and add Solidly support to PolygonBridgeAdapter (#612) 2022-11-04 14:41:35 -07:00
Github Actions
b1f856e7a4 Publish
- @0x/contracts-erc20@3.3.50
 - @0x/contracts-test-utils@5.4.40
 - @0x/contracts-treasury@1.4.33
 - @0x/contracts-utils@4.8.31
 - @0x/contracts-zero-ex@0.37.10
 - @0x/asset-swapper@16.66.17
 - @0x/contract-addresses@7.2.0
 - @0x/contract-wrappers@13.22.9
 - @0x/protocol-utils@11.16.17
2022-11-02 22:16:58 +00:00
Github Actions
9d42018fc6 Updated CHANGELOGS & MD docs 2022-11-02 22:16:54 +00:00
Noah Khamliche
624cbebe27 added new RFQTV2 compliant fqt (#611)
* added new RFQTV2 compliant fqt

* update changelog
2022-11-02 14:58:36 -07:00
Kyu
4ace7c8c43 fix: Migrate transformers to smart contract compatible unsafeTransformerTransfer [TKR-587] (#594)
* Use `call` instead of `transfer` in `LibERC20Transformer`

* Since `transfer` only forwards 2300 gas it can cause an `out of gas`
revert when the receipient is a smart contract.

* Add `unsafeTransformerTransfer` and migrate `transformers` to use
`unsafeTransformerTransfer` instead of `transformerTransfer`

* Update .prettierignore
2022-10-28 11:39:22 -07:00
132 changed files with 803 additions and 331 deletions

View File

@@ -60,6 +60,7 @@ lib
/contracts/dev-utils/test/generated-wrappers
/contracts/dev-utils/generated-artifacts
/contracts/dev-utils/test/generated-artifacts
/contracts/zero-ex/foundry-artifacts
/contracts/zero-ex/generated-wrappers
/contracts/zero-ex/test/generated-wrappers
/contracts/zero-ex/generated-artifacts

17
.solhint.json Normal file
View File

@@ -0,0 +1,17 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"avoid-low-level-calls": "off",
"avoid-tx-origin": "warn",
"code-complexity": "off",
"const-name-snakecase": "error",
"function-max-lines": "off",
"max-line-length": ["error", 120],
"no-inline-assembly": "off",
"quotes": ["error", "double"],
"no-empty-blocks": "off",
"compiler-version": "off"
}
}

1
.solhintignore Normal file
View File

@@ -0,0 +1 @@
contracts/erc20/contracts/src/ZRXToken.sol

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1668477029,
"version": "3.3.52",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667607537,
"version": "3.3.51",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667427402,
"version": "3.3.50",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1666645023,
"version": "3.3.49",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.3.52 - _November 15, 2022_
* Dependencies updated
## v3.3.51 - _November 5, 2022_
* Dependencies updated
## v3.3.50 - _November 2, 2022_
* Dependencies updated
## v3.3.49 - _October 24, 2022_
* Dependencies updated

View File

@@ -23,7 +23,8 @@ import "./ERC20Token.sol";
contract UnlimitedAllowanceERC20Token is ERC20Token {
uint256 internal constant MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.
// See https://github.com/ethereum/EIPs/issues/717
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _value Amount to transfer.

View File

@@ -13,7 +13,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// solhint-disable
pragma solidity ^0.5.9;
contract WETH9 {

View File

@@ -137,14 +137,11 @@ contract UnlimitedAllowanceToken is ERC20Token {
}
contract ZRXToken is UnlimitedAllowanceToken {
// solhint-disable const-name-snakecase
uint8 public constant decimals = 18;
uint256 public totalSupply = 10**27; // 1 billion tokens, 18 decimal places
string public constant name = "0x Protocol Token";
string public constant symbol = "ZRX";
// solhint-enableconst-name-snakecase
function ZRXToken() public {
balances[msg.sender] = totalSupply;
}

View File

@@ -19,7 +19,6 @@
pragma solidity ^0.5.9;
contract IERC20Token {
// solhint-disable no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);

View File

@@ -20,7 +20,6 @@
pragma solidity ^0.6.5;
interface IERC20TokenV06 {
// solhint-disable no-simple-event-func-name
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);

View File

@@ -20,7 +20,6 @@ pragma solidity ^0.5.5;
import "./DummyERC20Token.sol";
// solhint-disable no-empty-blocks
contract DummyMultipleReturnERC20Token is DummyERC20Token {
constructor(
string memory _name,
@@ -40,7 +39,8 @@ contract DummyMultipleReturnERC20Token is DummyERC20Token {
) external returns (bool) {
emit Transfer(_from, _to, _value);
// HACK: This contract will not compile if we remove `returns (bool)`, so we manually return 64 bytes (equiavalent to true, true)
// HACK: This contract will not compile if we remove `returns (bool)`, so we manually return 64 bytes
// (equiavalent to true, true)
assembly {
mstore(0, 1)
mstore(32, 1)

View File

@@ -20,7 +20,6 @@ pragma solidity ^0.5.5;
import "./DummyERC20Token.sol";
// solhint-disable no-empty-blocks
contract DummyNoReturnERC20Token is DummyERC20Token {
constructor(
string memory _name,

View File

@@ -20,8 +20,6 @@ pragma solidity ^0.5.5;
import "./DummyERC20Token.sol";
// solhint-disable no-empty-blocks
// solhint-disable no-unused-vars
contract UntransferrableDummyERC20Token is DummyERC20Token {
constructor(
string memory _name,

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.3.49",
"version": "3.3.52",
"engines": {
"node": ">=6.12"
},
@@ -52,8 +52,8 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.39",
"@0x/contracts-utils": "^4.8.30",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/contracts-utils": "^4.8.33",
"@0x/dev-utils": "^5.0.0",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1668477029,
"version": "5.4.42",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667607537,
"version": "5.4.41",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667427402,
"version": "5.4.40",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1666645023,
"version": "5.4.39",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.42 - _November 15, 2022_
* Dependencies updated
## v5.4.41 - _November 5, 2022_
* Dependencies updated
## v5.4.40 - _November 2, 2022_
* Dependencies updated
## v5.4.39 - _October 24, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.39",
"version": "5.4.42",
"engines": {
"node": ">=6.12"
},
@@ -46,7 +46,7 @@
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^7.1.0",
"@0x/contract-addresses": "^7.4.0",
"@0x/dev-utils": "^5.0.0",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1668477029,
"version": "1.4.35",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667607537,
"version": "1.4.34",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667427402,
"version": "1.4.33",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1666645023,
"version": "1.4.32",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.35 - _November 15, 2022_
* Dependencies updated
## v1.4.34 - _November 5, 2022_
* Dependencies updated
## v1.4.33 - _November 2, 2022_
* Dependencies updated
## v1.4.32 - _October 24, 2022_
* Dependencies updated

View File

@@ -83,12 +83,9 @@ contract ZrxTreasury is IZrxTreasury {
);
}
// solhint-disable
/// @dev Allows this contract to receive ether.
receive() external payable {}
// solhint-enable
/// @dev Updates the proposal and quorum thresholds to the given
/// values. Note that this function is only callable by the
/// treasury contract itself, so the threshold can only be

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.32",
"version": "1.4.35",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^7.1.0",
"@0x/contract-addresses": "^7.4.0",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "^3.3.49",
"@0x/contracts-erc20": "^3.3.52",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.39",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@types/isomorphic-fetch": "^0.0.35",
@@ -73,7 +73,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.16.16",
"@0x/protocol-utils": "^11.17.1",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1668477029,
"version": "4.8.33",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667607537,
"version": "4.8.32",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1667427402,
"version": "4.8.31",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1666645023,
"version": "4.8.30",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.33 - _November 15, 2022_
* Dependencies updated
## v4.8.32 - _November 5, 2022_
* Dependencies updated
## v4.8.31 - _November 2, 2022_
* Dependencies updated
## v4.8.30 - _October 24, 2022_
* Dependencies updated

View File

@@ -23,7 +23,6 @@ import "./LibAuthorizableRichErrors.sol";
import "./LibRichErrors.sol";
import "./Ownable.sol";
// solhint-disable no-empty-blocks
contract Authorizable is Ownable, IAuthorizable {
/// @dev Only authorized addresses can invoke functions with this modifier.
modifier onlyAuthorized() {

View File

@@ -19,8 +19,6 @@
pragma solidity ^0.5.9;
contract DeploymentConstants {
// solhint-disable separate-by-one-line-in-contract
// Mainnet addresses ///////////////////////////////////////////////////////
/// @dev Mainnet address of the WETH contract.
address private constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
@@ -60,93 +58,93 @@ contract DeploymentConstants {
address private constant DODO_HELPER = 0x533dA777aeDCE766CEAe696bf90f8541A4bA80Eb;
// // Ropsten addresses ///////////////////////////////////////////////////////
// /// @dev Mainnet address of the WETH contract.
/// @dev Mainnet address of the WETH contract.
// address constant private WETH_ADDRESS = 0xc778417E063141139Fce010982780140Aa0cD5Ab;
// /// @dev Mainnet address of the KyberNetworkProxy contract.
/// @dev Mainnet address of the KyberNetworkProxy contract.
// address constant private KYBER_NETWORK_PROXY_ADDRESS = 0xd719c34261e099Fdb33030ac8909d5788D3039C4;
// /// @dev Mainnet address of the `UniswapExchangeFactory` contract.
/// @dev Mainnet address of the `UniswapExchangeFactory` contract.
// address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0x9c83dCE8CA20E9aAF9D3efc003b2ea62aBC08351;
// /// @dev Mainnet address of the `UniswapV2Router01` contract.
/// @dev Mainnet address of the `UniswapV2Router01` contract.
// address constant private UNISWAP_V2_ROUTER_01_ADDRESS = 0xf164fC0Ec4E93095b804a4795bBe1e041497b92a;
// /// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
/// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
// address constant private ETH2DAI_ADDRESS = address(0);
// /// @dev Mainnet address of the `ERC20BridgeProxy` contract
/// @dev Mainnet address of the `ERC20BridgeProxy` contract
// address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0xb344afeD348de15eb4a9e180205A2B0739628339;
// ///@dev Mainnet address of the `Dai` (multi-collateral) contract
// address constant private DAI_ADDRESS = address(0);
// /// @dev Mainnet address of the `Chai` contract
/// @dev Mainnet address of the `Chai` contract
// address constant private CHAI_ADDRESS = address(0);
// /// @dev Mainnet address of the 0x DevUtils contract.
/// @dev Mainnet address of the 0x DevUtils contract.
// address constant private DEV_UTILS_ADDRESS = 0xC812AF3f3fBC62F76ea4262576EC0f49dB8B7f1c;
// /// @dev Kyber ETH pseudo-address.
/// @dev Kyber ETH pseudo-address.
// address constant internal KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// /// @dev Mainnet address of the dYdX contract.
/// @dev Mainnet address of the dYdX contract.
// address constant private DYDX_ADDRESS = address(0);
// /// @dev Mainnet address of the GST2 contract
/// @dev Mainnet address of the GST2 contract
// address constant private GST_ADDRESS = address(0);
// /// @dev Mainnet address of the GST Collector
/// @dev Mainnet address of the GST Collector
// address constant private GST_COLLECTOR_ADDRESS = address(0);
// /// @dev Mainnet address of the mStable mUSD contract.
/// @dev Mainnet address of the mStable mUSD contract.
// address constant private MUSD_ADDRESS = 0x4E1000616990D83e56f4b5fC6CC8602DcfD20459;
// // Rinkeby addresses ///////////////////////////////////////////////////////
// /// @dev Mainnet address of the WETH contract.
/// @dev Mainnet address of the WETH contract.
// address constant private WETH_ADDRESS = 0xc778417E063141139Fce010982780140Aa0cD5Ab;
// /// @dev Mainnet address of the KyberNetworkProxy contract.
/// @dev Mainnet address of the KyberNetworkProxy contract.
// address constant private KYBER_NETWORK_PROXY_ADDRESS = 0x0d5371e5EE23dec7DF251A8957279629aa79E9C5;
// /// @dev Mainnet address of the `UniswapExchangeFactory` contract.
/// @dev Mainnet address of the `UniswapExchangeFactory` contract.
// address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xf5D915570BC477f9B8D6C0E980aA81757A3AaC36;
// /// @dev Mainnet address of the `UniswapV2Router01` contract.
/// @dev Mainnet address of the `UniswapV2Router01` contract.
// address constant private UNISWAP_V2_ROUTER_01_ADDRESS = 0xf164fC0Ec4E93095b804a4795bBe1e041497b92a;
// /// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
/// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
// address constant private ETH2DAI_ADDRESS = address(0);
// /// @dev Mainnet address of the `ERC20BridgeProxy` contract
/// @dev Mainnet address of the `ERC20BridgeProxy` contract
// address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0xA2AA4bEFED748Fba27a3bE7Dfd2C4b2c6DB1F49B;
// ///@dev Mainnet address of the `Dai` (multi-collateral) contract
// address constant private DAI_ADDRESS = address(0);
// /// @dev Mainnet address of the `Chai` contract
/// @dev Mainnet address of the `Chai` contract
// address constant private CHAI_ADDRESS = address(0);
// /// @dev Mainnet address of the 0x DevUtils contract.
/// @dev Mainnet address of the 0x DevUtils contract.
// address constant private DEV_UTILS_ADDRESS = 0x46B5BC959e8A754c0256FFF73bF34A52Ad5CdfA9;
// /// @dev Kyber ETH pseudo-address.
/// @dev Kyber ETH pseudo-address.
// address constant internal KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// /// @dev Mainnet address of the dYdX contract.
/// @dev Mainnet address of the dYdX contract.
// address constant private DYDX_ADDRESS = address(0);
// /// @dev Mainnet address of the GST2 contract
/// @dev Mainnet address of the GST2 contract
// address constant private GST_ADDRESS = address(0);
// /// @dev Mainnet address of the GST Collector
/// @dev Mainnet address of the GST Collector
// address constant private GST_COLLECTOR_ADDRESS = address(0);
// /// @dev Mainnet address of the mStable mUSD contract.
/// @dev Mainnet address of the mStable mUSD contract.
// address constant private MUSD_ADDRESS = address(0);
// // Kovan addresses /////////////////////////////////////////////////////////
// /// @dev Kovan address of the WETH contract.
/// @dev Kovan address of the WETH contract.
// address constant private WETH_ADDRESS = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
// /// @dev Kovan address of the KyberNetworkProxy contract.
/// @dev Kovan address of the KyberNetworkProxy contract.
// address constant private KYBER_NETWORK_PROXY_ADDRESS = 0x692f391bCc85cefCe8C237C01e1f636BbD70EA4D;
// /// @dev Kovan address of the `UniswapExchangeFactory` contract.
/// @dev Kovan address of the `UniswapExchangeFactory` contract.
// address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30;
// /// @dev Kovan address of the `UniswapV2Router01` contract.
/// @dev Kovan address of the `UniswapV2Router01` contract.
// address constant private UNISWAP_V2_ROUTER_01_ADDRESS = 0xf164fC0Ec4E93095b804a4795bBe1e041497b92a;
// /// @dev Kovan address of the Eth2Dai `MatchingMarket` contract.
/// @dev Kovan address of the Eth2Dai `MatchingMarket` contract.
// address constant private ETH2DAI_ADDRESS = 0xe325acB9765b02b8b418199bf9650972299235F4;
// /// @dev Kovan address of the `ERC20BridgeProxy` contract
/// @dev Kovan address of the `ERC20BridgeProxy` contract
// address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x3577552C1Fb7A44aD76BeEB7aB53251668A21F8D;
// /// @dev Kovan address of the `Chai` contract
/// @dev Kovan address of the `Chai` contract
// address constant private CHAI_ADDRESS = address(0);
// /// @dev Kovan address of the `Dai` (multi-collateral) contract
/// @dev Kovan address of the `Dai` (multi-collateral) contract
// address constant private DAI_ADDRESS = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
// /// @dev Kovan address of the 0x DevUtils contract.
/// @dev Kovan address of the 0x DevUtils contract.
// address constant private DEV_UTILS_ADDRESS = 0x9402639A828BdF4E9e4103ac3B69E1a6E522eB59;
// /// @dev Kyber ETH pseudo-address.
/// @dev Kyber ETH pseudo-address.
// address constant internal KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// /// @dev Kovan address of the dYdX contract.
/// @dev Kovan address of the dYdX contract.
// address constant private DYDX_ADDRESS = address(0);
// /// @dev Kovan address of the GST2 contract
/// @dev Kovan address of the GST2 contract
// address constant private GST_ADDRESS = address(0);
// /// @dev Kovan address of the GST Collector
/// @dev Kovan address of the GST Collector
// address constant private GST_COLLECTOR_ADDRESS = address(0);
// /// @dev Mainnet address of the mStable mUSD contract.
/// @dev Mainnet address of the mStable mUSD contract.
// address constant private MUSD_ADDRESS = address(0);
/// @dev Overridable way to get the `KyberNetworkProxy` address.

View File

@@ -22,7 +22,6 @@ library LibAddressArrayRichErrors {
// bytes4(keccak256("MismanagedMemoryError(uint256,uint256)"))
bytes4 internal constant MISMANAGED_MEMORY_ERROR_SELECTOR = 0x5fc83722;
// solhint-disable func-name-mixedcase
function MismanagedMemoryError(uint256 freeMemPtr, uint256 addressArrayEndPtr)
internal
pure

View File

@@ -37,7 +37,6 @@ library LibAuthorizableRichErrors {
// bytes4(keccak256("ZeroCantBeAuthorizedError()"))
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
// solhint-disable func-name-mixedcase
function AuthorizedAddressMismatchError(address authorized, address target) internal pure returns (bytes memory) {
return abi.encodeWithSelector(AUTHORIZED_ADDRESS_MISMATCH_ERROR_SELECTOR, authorized, target);
}

View File

@@ -105,7 +105,6 @@ library LibBytes {
// Copy whole words front to back
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {
} lt(source, sEnd) {
@@ -140,7 +139,6 @@ library LibBytes {
// 2**255, so they can be safely re-interpreted as signed.
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {
} slt(dest, dEnd) {

View File

@@ -33,7 +33,6 @@ library LibBytesRichErrors {
// bytes4(keccak256("InvalidByteOperationError(uint8,uint256,uint256)"))
bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR = 0x28006595;
// solhint-disable func-name-mixedcase
function InvalidByteOperationError(
InvalidByteOperationErrorCodes errorCode,
uint256 offset,

View File

@@ -7,7 +7,6 @@ library LibMathRichErrors {
// bytes4(keccak256("RoundingError(uint256,uint256,uint256)"))
bytes4 internal constant ROUNDING_ERROR_SELECTOR = 0x339f3de2;
// solhint-disable func-name-mixedcase
function DivisionByZeroError() internal pure returns (bytes memory) {
return DIVISION_BY_ZERO_ERROR;
}

View File

@@ -7,7 +7,6 @@ library LibOwnableRichErrors {
// bytes4(keccak256("TransferOwnerToZeroError()"))
bytes internal constant TRANSFER_OWNER_TO_ZERO_ERROR_BYTES = hex"e69edc3e";
// solhint-disable func-name-mixedcase
function OnlyOwnerError(address sender, address owner) internal pure returns (bytes memory) {
return abi.encodeWithSelector(ONLY_OWNER_ERROR_SELECTOR, sender, owner);
}

View File

@@ -22,7 +22,6 @@ library LibReentrancyGuardRichErrors {
// bytes4(keccak256("IllegalReentrancyError()"))
bytes internal constant ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES = hex"0c3b823f";
// solhint-disable func-name-mixedcase
function IllegalReentrancyError() internal pure returns (bytes memory) {
return ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES;
}

View File

@@ -22,7 +22,6 @@ library LibRichErrors {
// bytes4(keccak256("Error(string)"))
bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;
// solhint-disable func-name-mixedcase
/// @dev ABI encode a standard, string revert error payload.
/// This is the same payload that would be included by a `revert(string)`
/// solidity statement. It has the function signature `Error(string)`.
@@ -32,8 +31,6 @@ library LibRichErrors {
return abi.encodeWithSelector(STANDARD_ERROR_SELECTOR, bytes(message));
}
// solhint-enable func-name-mixedcase
/// @dev Reverts an encoded rich revert reason `errorData`.
/// @param errorData ABI encoded error data.
function rrevert(bytes memory errorData) internal pure {

View File

@@ -20,7 +20,6 @@ library LibSafeMathRichErrors {
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96
}
// solhint-disable func-name-mixedcase
function Uint256BinOpError(
BinOpErrorCodes errorCode,
uint256 a,

View File

@@ -24,7 +24,6 @@ import "./errors/LibRichErrorsV06.sol";
import "./errors/LibAuthorizableRichErrorsV06.sol";
import "./OwnableV06.sol";
// solhint-disable no-empty-blocks
contract AuthorizableV06 is OwnableV06, IAuthorizableV06 {
/// @dev Only authorized addresses can invoke functions with this modifier.
modifier onlyAuthorized() {

View File

@@ -106,7 +106,6 @@ library LibBytesV06 {
// Copy whole words front to back
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {
} lt(source, sEnd) {
@@ -141,7 +140,6 @@ library LibBytesV06 {
// 2**255, so they can be safely re-interpreted as signed.
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {
} slt(dest, dEnd) {

View File

@@ -38,7 +38,6 @@ library LibAuthorizableRichErrorsV06 {
// bytes4(keccak256("ZeroCantBeAuthorizedError()"))
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
// solhint-disable func-name-mixedcase
function AuthorizedAddressMismatchError(address authorized, address target) internal pure returns (bytes memory) {
return abi.encodeWithSelector(AUTHORIZED_ADDRESS_MISMATCH_ERROR_SELECTOR, authorized, target);
}

View File

@@ -34,7 +34,6 @@ library LibBytesRichErrorsV06 {
// bytes4(keccak256("InvalidByteOperationError(uint8,uint256,uint256)"))
bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR = 0x28006595;
// solhint-disable func-name-mixedcase
function InvalidByteOperationError(
InvalidByteOperationErrorCodes errorCode,
uint256 offset,

View File

@@ -26,7 +26,6 @@ library LibMathRichErrorsV06 {
// bytes4(keccak256("RoundingError(uint256,uint256,uint256)"))
bytes4 internal constant ROUNDING_ERROR_SELECTOR = 0x339f3de2;
// solhint-disable func-name-mixedcase
function DivisionByZeroError() internal pure returns (bytes memory) {
return DIVISION_BY_ZERO_ERROR;
}

View File

@@ -25,7 +25,6 @@ library LibOwnableRichErrorsV06 {
// bytes4(keccak256("TransferOwnerToZeroError()"))
bytes internal constant TRANSFER_OWNER_TO_ZERO_ERROR_BYTES = hex"e69edc3e";
// solhint-disable func-name-mixedcase
function OnlyOwnerError(address sender, address owner) internal pure returns (bytes memory) {
return abi.encodeWithSelector(ONLY_OWNER_ERROR_SELECTOR, sender, owner);
}

View File

@@ -23,7 +23,6 @@ library LibReentrancyGuardRichErrorsV06 {
// bytes4(keccak256("IllegalReentrancyError()"))
bytes internal constant ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES = hex"0c3b823f";
// solhint-disable func-name-mixedcase
function IllegalReentrancyError() internal pure returns (bytes memory) {
return ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES;
}

View File

@@ -23,7 +23,6 @@ library LibRichErrorsV06 {
// bytes4(keccak256("Error(string)"))
bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;
// solhint-disable func-name-mixedcase
/// @dev ABI encode a standard, string revert error payload.
/// This is the same payload that would be included by a `revert(string)`
/// solidity statement. It has the function signature `Error(string)`.
@@ -33,8 +32,6 @@ library LibRichErrorsV06 {
return abi.encodeWithSelector(STANDARD_ERROR_SELECTOR, bytes(message));
}
// solhint-enable func-name-mixedcase
/// @dev Reverts an encoded rich revert reason `errorData`.
/// @param errorData ABI encoded error data.
function rrevert(bytes memory errorData) internal pure {

View File

@@ -40,7 +40,6 @@ library LibSafeMathRichErrorsV06 {
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128
}
// solhint-disable func-name-mixedcase
function Uint256BinOpError(
BinOpErrorCodes errorCode,
uint256 a,

View File

@@ -20,7 +20,6 @@ pragma solidity ^0.5.9;
import "../src/Authorizable.sol";
// solhint-disable no-empty-blocks
contract TestAuthorizable is Authorizable {
function onlyAuthorizedFn() external view onlyAuthorized {}
}

View File

@@ -33,9 +33,9 @@ contract TestRefundable is Refundable {
return _shouldNotRefund;
}
function refundFinalBalanceFunction() public payable refundFinalBalance {} // solhint-disable-line no-empty-blocks
function refundFinalBalanceFunction() public payable refundFinalBalance {}
function disableRefundUntilEndFunction() public payable disableRefundUntilEnd {} // solhint-disable-line no-empty-blocks
function disableRefundUntilEndFunction() public payable disableRefundUntilEnd {}
function nestedDisableRefundUntilEndFunction() public payable disableRefundUntilEnd returns (uint256) {
disableRefundUntilEndFunction();

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.30",
"version": "4.8.33",
"engines": {
"node": ">=6.12"
},
@@ -51,7 +51,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.39",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1668477029,
"version": "0.38.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.38.0",
"changes": [
{
"note": "Rename Velodrome to Solidly and add SolidlyMixin support on Polygon"
}
],
"timestamp": 1667607537
},
{
"timestamp": 1667427402,
"version": "0.37.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1666645023,
"version": "0.37.9",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.38.1 - _November 15, 2022_
* Dependencies updated
## v0.38.0 - _November 5, 2022_
* Rename Velodrome to Solidly and add SolidlyMixin support on Polygon
## v0.37.10 - _November 2, 2022_
* Dependencies updated
## v0.37.9 - _October 24, 2022_
* Dependencies updated

View File

@@ -140,11 +140,11 @@
"./contracts/src/transformers/bridges/mixins/MixinNerve.sol",
"./contracts/src/transformers/bridges/mixins/MixinPlatypus.sol",
"./contracts/src/transformers/bridges/mixins/MixinShell.sol",
"./contracts/src/transformers/bridges/mixins/MixinSolidly.sol",
"./contracts/src/transformers/bridges/mixins/MixinSynthetix.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswap.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswapV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswapV3.sol",
"./contracts/src/transformers/bridges/mixins/MixinVelodrome.sol",
"./contracts/src/transformers/bridges/mixins/MixinZeroExBridge.sol",
"./contracts/src/vendor/IERC1155Token.sol",
"./contracts/src/vendor/IERC721Token.sol",

View File

@@ -57,8 +57,6 @@ interface IZeroEx is
IERC1155OrdersFeature,
IERC165Feature
{
// solhint-disable state-visibility
/// @dev Fallback for just receiving ether.
receive() external payable;
}

View File

@@ -29,7 +29,6 @@ import "./errors/LibProxyRichErrors.sol";
/// @dev An extensible proxy contract that serves as a universal entry point for
/// interacting with the 0x protocol.
contract ZeroEx {
// solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase
using LibBytesV06 for bytes;
/// @dev Construct this contract and register the `BootstrapFeature` feature.
@@ -43,8 +42,6 @@ contract ZeroEx {
LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] = address(bootstrap);
}
// solhint-disable state-visibility
/// @dev Forwards calls to the appropriate implementation contract.
fallback() external payable {
bytes4 selector = msg.data.readBytes4(0);
@@ -63,8 +60,6 @@ contract ZeroEx {
/// @dev Fallback for just receiving ether.
receive() external payable {}
// solhint-enable state-visibility
/// @dev Get the implementation contract of a registered function.
/// @param selector The function selector.
/// @return impl The implementation contract address.

View File

@@ -37,8 +37,6 @@ contract ZeroExOptimized {
LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] = address(bootstrap);
}
// solhint-disable state-visibility
/// @dev Forwards calls to the appropriate implementation contract.
fallback() external payable {
// This is used in assembly below as impls_slot.

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibCommonRichErrors {
// solhint-disable func-name-mixedcase
function OnlyCallableBySelfError(address sender) internal pure returns (bytes memory) {
return abi.encodeWithSelector(bytes4(keccak256("OnlyCallableBySelfError(address)")), sender);
}

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibLiquidityProviderRichErrors {
// solhint-disable func-name-mixedcase
function LiquidityProviderIncompleteSellError(
address providerAddress,
address makerToken,

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibMetaTransactionsRichErrors {
// solhint-disable func-name-mixedcase
function InvalidMetaTransactionsArrayLengthsError(uint256 mtxCount, uint256 signatureCount)
internal
pure

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibNFTOrdersRichErrors {
// solhint-disable func-name-mixedcase
function OverspentEthError(uint256 ethSpent, uint256 ethAvailable) internal pure returns (bytes memory) {
return abi.encodeWithSelector(bytes4(keccak256("OverspentEthError(uint256,uint256)")), ethSpent, ethAvailable);
}

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibNativeOrdersRichErrors {
// solhint-disable func-name-mixedcase
function ProtocolFeeRefundFailed(address receiver, uint256 refundAmount) internal pure returns (bytes memory) {
return
abi.encodeWithSelector(

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibOwnableRichErrors {
// solhint-disable func-name-mixedcase
function OnlyOwnerError(address sender, address owner) internal pure returns (bytes memory) {
return abi.encodeWithSelector(bytes4(keccak256("OnlyOwnerError(address,address)")), sender, owner);
}

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibProxyRichErrors {
// solhint-disable func-name-mixedcase
function NotImplementedError(bytes4 selector) internal pure returns (bytes memory) {
return abi.encodeWithSelector(bytes4(keccak256("NotImplementedError(bytes4)")), selector);
}

View File

@@ -29,8 +29,6 @@ library LibSignatureRichErrors {
BAD_SIGNATURE_DATA
}
// solhint-disable func-name-mixedcase
function SignatureValidationError(
SignatureValidationErrorCodes code,
bytes32 hash,

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibSimpleFunctionRegistryRichErrors {
// solhint-disable func-name-mixedcase
function NotInRollbackHistoryError(bytes4 selector, address targetImpl) internal pure returns (bytes memory) {
return
abi.encodeWithSelector(

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibTransformERC20RichErrors {
// solhint-disable func-name-mixedcase,separate-by-one-line-in-contract
function InsufficientEthAttachedError(uint256 ethAttached, uint256 ethNeeded) internal pure returns (bytes memory) {
return
abi.encodeWithSelector(

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.5;
library LibWalletRichErrors {
// solhint-disable func-name-mixedcase
function WalletExecuteCallFailedError(
address wallet,
address callTarget,

View File

@@ -27,15 +27,11 @@ import "./IFlashWallet.sol";
/// @dev A contract that can execute arbitrary calls from its owner.
contract FlashWallet is IFlashWallet {
// solhint-disable no-unused-vars,indent,no-empty-blocks
using LibRichErrorsV06 for bytes;
// solhint-disable
/// @dev Store the owner/deployer as an immutable to make this contract stateless.
address public immutable override owner;
// solhint-enable
constructor() public {
// The deployer is the owner.
owner = msg.sender;
@@ -89,12 +85,9 @@ contract FlashWallet is IFlashWallet {
}
}
// solhint-disable
/// @dev Allows this contract to receive ether.
receive() external payable override {}
// solhint-enable
/// @dev Signal support for receiving ERC1155 tokens.
/// @param interfaceID The interface ID, as per ERC-165 rules.
/// @return hasSupport `true` if this contract supports an ERC-165 interface.

View File

@@ -44,9 +44,7 @@ contract BatchFillNativeOrdersFeature is IFeature, IBatchFillNativeOrdersFeature
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 1, 0);
constructor(address zeroExAddress) public FixinEIP712(zeroExAddress) {
// solhint-disable no-empty-blocks
}
constructor(address zeroExAddress) public FixinEIP712(zeroExAddress) {}
/// @dev Initialize and register this feature.
/// Should be delegatecalled by `Migrate.migrate()`.

View File

@@ -27,7 +27,6 @@ import "./interfaces/IBootstrapFeature.sol";
/// @dev Detachable `bootstrap()` feature.
contract BootstrapFeature is IBootstrapFeature {
// solhint-disable state-visibility,indent
/// @dev The ZeroEx contract.
/// This has to be immutable to persist across delegatecalls.
address private immutable _deployer;
@@ -37,7 +36,6 @@ contract BootstrapFeature is IBootstrapFeature {
/// @dev The deployer.
/// This has to be immutable to persist across delegatecalls.
address private immutable _bootstrapCaller;
// solhint-enable state-visibility,indent
using LibRichErrorsV06 for bytes;

View File

@@ -113,9 +113,7 @@ contract MetaTransactionsFeature is
require(initialBalance <= address(this).balance, "MetaTransactionsFeature/ETH_LEAK");
}
constructor(address zeroExAddress) public FixinCommon() FixinEIP712(zeroExAddress) {
// solhint-disable-next-line no-empty-blocks
}
constructor(address zeroExAddress) public FixinCommon() FixinEIP712(zeroExAddress) {}
/// @dev Initialize and register this feature.
/// Should be delegatecalled by `Migrate.migrate()`.

View File

@@ -38,9 +38,7 @@ contract NativeOrdersFeature is IFeature, NativeOrdersSettlement {
IStaking staking,
FeeCollectorController feeCollectorController,
uint32 protocolFeeMultiplier
) public NativeOrdersSettlement(zeroExAddress, weth, staking, feeCollectorController, protocolFeeMultiplier) {
// solhint-disable no-empty-blocks
}
) public NativeOrdersSettlement(zeroExAddress, weth, staking, feeCollectorController, protocolFeeMultiplier) {}
/// @dev Initialize and register this feature.
/// Should be delegatecalled by `Migrate.migrate()`.

View File

@@ -22,8 +22,6 @@ pragma experimental ABIEncoderV2;
/// @dev Basic interface for a feature contract.
interface IFeature {
// solhint-disable func-name-mixedcase
/// @dev The name of this feature set.
function FEATURE_NAME() external view returns (string memory name);

View File

@@ -22,7 +22,6 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol";
// solhint-disable no-empty-blocks
/// @dev Owner management and migration features.
interface IOwnableFeature is IOwnableV06 {
/// @dev Emitted when `migrate()` is called.

View File

@@ -36,9 +36,7 @@ abstract contract NativeOrdersCancellation is INativeOrdersEvents, NativeOrdersI
/// @dev Highest bit of a uint256, used to flag cancelled orders.
uint256 private constant HIGH_BIT = 1 << 255;
constructor(address zeroExAddress) internal NativeOrdersInfo(zeroExAddress) {
// solhint-disable no-empty-blocks
}
constructor(address zeroExAddress) internal NativeOrdersInfo(zeroExAddress) {}
/// @dev Cancel a single limit order. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.

View File

@@ -46,9 +46,7 @@ abstract contract NativeOrdersInfo is FixinEIP712, FixinTokenSpender {
/// @dev Highest bit of a uint256, used to flag cancelled orders.
uint256 private constant HIGH_BIT = 1 << 255;
constructor(address zeroExAddress) internal FixinEIP712(zeroExAddress) {
// solhint-disable no-empty-blocks
}
constructor(address zeroExAddress) internal FixinEIP712(zeroExAddress) {}
/// @dev Get the order info for a limit order.
/// @param order The limit order.

View File

@@ -37,9 +37,7 @@ abstract contract NativeOrdersProtocolFees is FixinProtocolFees {
IStaking staking,
FeeCollectorController feeCollectorController,
uint32 protocolFeeMultiplier
) internal FixinProtocolFees(weth, staking, feeCollectorController, protocolFeeMultiplier) {
// solhint-disable no-empty-blocks
}
) internal FixinProtocolFees(weth, staking, feeCollectorController, protocolFeeMultiplier) {}
/// @dev Transfers protocol fees from the `FeeCollector` pools into
/// the staking contract.

View File

@@ -118,9 +118,7 @@ abstract contract NativeOrdersSettlement is
public
NativeOrdersCancellation(zeroExAddress)
NativeOrdersProtocolFees(weth, staking, feeCollectorController, protocolFeeMultiplier)
{
// solhint-disable no-empty-blocks
}
{}
/// @dev Fill a limit order. The taker and sender will be the caller.
/// @param order The limit order. ETH protocol fees can be
@@ -501,6 +499,7 @@ abstract contract NativeOrdersSettlement is
}
// Update filled state for the order.
// solhint-disable-next-line max-line-length
LibNativeOrdersStorage.getStorage().orderHashToTakerTokenFilledAmount[settleInfo.orderHash] = settleInfo // function if the order is cancelled. // OK to overwrite the whole word because we shouldn't get to this
.takerTokenFilledAmount
.safeAdd128(takerTokenFilledAmount);

View File

@@ -30,8 +30,6 @@ import "./InitialMigration.sol";
/// @dev A contract for deploying and configuring the full ZeroEx contract.
contract FullMigration {
// solhint-disable no-empty-blocks,indent
/// @dev Features to add the the proxy contract.
struct Features {
SimpleFunctionRegistryFeature registry;

View File

@@ -43,8 +43,8 @@ library LibERC1155OrdersStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.ERC1155Orders);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -35,8 +35,8 @@ library LibERC721OrdersStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.ERC721Orders);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -33,8 +33,8 @@ library LibMetaTransactionsStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.MetaTransactions);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -30,14 +30,13 @@ library LibNativeOrdersStorage {
// The lower `uint128` is the taker token fill amount.
// The high bit will be `1` if the order was directly cancelled.
mapping(bytes32 => uint256) orderHashToTakerTokenFilledAmount;
// The minimum valid order salt for a given maker and order pair (maker, taker)
// for limit orders.
// The minimum valid order salt for a given maker and order pair (maker, taker) for limit orders.
// solhint-disable-next-line max-line-length
mapping(address => mapping(address => mapping(address => uint256))) limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt;
// The minimum valid order salt for a given maker and order pair (maker, taker)
// for RFQ orders.
// The minimum valid order salt for a given maker and order pair (maker, taker) for RFQ orders.
// solhint-disable-next-line max-line-length
mapping(address => mapping(address => mapping(address => uint256))) rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt;
// For a given order origin, which tx.origin addresses are allowed to
// fill the order.
// For a given order origin, which tx.origin addresses are allowed to fill the order.
mapping(address => mapping(address => bool)) originRegistry;
// For a given maker address, which addresses are allowed to
// sign on its behalf.
@@ -47,8 +46,8 @@ library LibNativeOrdersStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.NativeOrders);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -33,8 +33,8 @@ library LibOtcOrdersStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.OtcOrders);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -35,6 +35,7 @@ library LibOwnableStorage {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.Ownable);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -35,8 +35,8 @@ library LibProxyStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.Proxy);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -27,16 +27,15 @@ import "../external/IFlashWallet.sol";
library LibReentrancyGuardStorage {
/// @dev Storage bucket for this feature.
struct Storage {
// Reentrancy flags set whenever a non-reentrant function is entered
// and cleared when it is exited.
// Reentrancy flags set whenever a non-reentrant function is entered and cleared when it is exited.
uint256 reentrancyFlags;
}
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.ReentrancyGuard);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -33,8 +33,8 @@ library LibSimpleFunctionRegistryStorage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.SimpleFunctionRegistry);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -23,11 +23,11 @@ pragma experimental ABIEncoderV2;
/// @dev Common storage helpers
library LibStorage {
/// @dev What to bit-shift a storage ID by to get its slot.
/// This gives us a maximum of 2**128 inline fields in each bucket.
/// This gives us a maximum of 2**128 inline fields in each bucket.
uint256 private constant STORAGE_SLOT_EXP = 128;
/// @dev Storage IDs for feature storage buckets.
/// WARNING: APPEND-ONLY.
/// WARNING: APPEND-ONLY.
enum StorageId {
Proxy,
SimpleFunctionRegistry,
@@ -42,9 +42,10 @@ library LibStorage {
ERC1155Orders
}
/// @dev Get the storage slot given a storage ID. We assign unique, well-spaced
/// slots to storage bucket variables to ensure they do not overlap.
/// See: https://solidity.readthedocs.io/en/v0.6.6/assembly.html#access-to-external-variables-functions-and-libraries
/// @dev Get the storage slot given a storage ID. We assign unique, well-spaced slots to storage bucket variables
/// to ensure they do not overlap.
// solhint-disable-next-line max-line-length
/// See: https://solidity.readthedocs.io/en/v0.6.6/assembly.html#access-to-external-variables-functions-and-libraries
/// @param storageId An entry in `StorageId`
/// @return slot The storage slot.
function getStorageSlot(StorageId storageId) internal pure returns (uint256 slot) {

View File

@@ -38,8 +38,8 @@ library LibTransformERC20Storage {
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(LibStorage.StorageId.TransformERC20);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.
// Dip into assembly to change the slot pointed to by the local variable `stor`.
// solhint-disable-next-line max-line-length
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
assembly {
stor_slot := storageSlot

View File

@@ -61,7 +61,7 @@ contract AffiliateFeeTransformer is Transformer {
amount = LibERC20Transformer.getTokenBalanceOf(fees[i].token, address(this));
}
if (amount != 0) {
fees[i].token.transformerTransfer(fees[i].recipient, amount);
fees[i].token.unsafeTransformerTransfer(fees[i].recipient, amount);
}
}

View File

@@ -34,7 +34,9 @@ library LibERC20Transformer {
/// This is just `keccak256('TRANSFORMER_SUCCESS')`.
bytes4 internal constant TRANSFORMER_SUCCESS = 0x13c9929e;
/// @dev Transfer ERC20 tokens and ETH.
/// @dev Transfer ERC20 tokens and ETH. Since it relies on `transfer` it may run out of gas when
/// the `recipient` is a smart contract wallet. See `unsafeTransformerTransfer` for smart contract
/// compatible transfer.
/// @param token An ERC20 or the ETH pseudo-token address (`ETH_TOKEN_ADDRESS`).
/// @param to The recipient.
/// @param amount The transfer amount.
@@ -50,6 +52,24 @@ library LibERC20Transformer {
}
}
/// @dev Transfer ERC20 tokens and ETH. For ETH transfer. It's not safe from re-entrancy attacks and the
/// caller is responsible for gurading against a potential re-entrancy attack.
/// @param token An ERC20 or the ETH pseudo-token address (`ETH_TOKEN_ADDRESS`).
/// @param to The recipient.
/// @param amount The transfer amount.
function unsafeTransformerTransfer(
IERC20TokenV06 token,
address payable to,
uint256 amount
) internal {
if (isTokenETH(token)) {
(bool sent, ) = to.call{value: amount}("");
require(sent, "LibERC20Transformer/FAILED_TO_SEND_ETHER");
} else {
token.compatTransfer(to, amount);
}
}
/// @dev Check if a token is the ETH pseudo-token.
/// @param token The token to check.
/// @return isETH `true` if the token is the ETH pseudo-token.

View File

@@ -30,7 +30,6 @@ import "./LibERC20Transformer.sol";
/// @dev A transformer that transfers tokens to the taker.
contract PayTakerTransformer is Transformer {
// solhint-disable no-empty-blocks
using LibRichErrorsV06 for bytes;
using LibSafeMathV06 for uint256;
using LibERC20Transformer for IERC20TokenV06;
@@ -65,7 +64,7 @@ contract PayTakerTransformer is Transformer {
amount = data.tokens[i].getTokenBalanceOf(address(this));
}
if (amount != 0) {
data.tokens[i].transformerTransfer(context.recipient, amount);
data.tokens[i].unsafeTransformerTransfer(context.recipient, amount);
}
}
return LibERC20Transformer.TRANSFORMER_SUCCESS;

View File

@@ -53,7 +53,7 @@ contract PositiveSlippageFeeTransformer is Transformer {
uint256 transformerAmount = LibERC20Transformer.getTokenBalanceOf(fee.token, address(this));
if (transformerAmount > fee.bestCaseAmount) {
uint256 positiveSlippageAmount = transformerAmount - fee.bestCaseAmount;
fee.token.transformerTransfer(fee.recipient, positiveSlippageAmount);
fee.token.unsafeTransformerTransfer(fee.recipient, positiveSlippageAmount);
}
return LibERC20Transformer.TRANSFORMER_SUCCESS;

View File

@@ -55,7 +55,7 @@ library BridgeProtocols {
uint128 internal constant GMX = 26;
uint128 internal constant PLATYPUS = 27;
uint128 internal constant BANCORV3 = 28;
uint128 internal constant VELODROME = 29;
uint128 internal constant SOLIDLY = 29;
uint128 internal constant SYNTHETIX = 30;
uint128 internal constant WOOFI = 31;
}

View File

@@ -22,9 +22,9 @@ import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinSynthetix.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinVelodrome.sol";
import "./mixins/MixinZeroExBridge.sol";
contract OptimismBridgeAdapter is
@@ -36,7 +36,7 @@ contract OptimismBridgeAdapter is
MixinNerve,
MixinSynthetix,
MixinUniswapV3,
MixinVelodrome,
MixinSolidly,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
@@ -69,11 +69,11 @@ contract OptimismBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.VELODROME) {
} else if (protocolId == BridgeProtocols.SOLIDLY) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeVelodrome(sellToken, buyToken, sellAmount, order.bridgeData);
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.SYNTHETIX) {
if (dryRun) {
return (0, true);

View File

@@ -32,6 +32,7 @@ import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinMStable.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinWOOFi.sol";
@@ -51,6 +52,7 @@ contract PolygonBridgeAdapter is
MixinNerve,
MixinUniswapV2,
MixinUniswapV3,
MixinSolidly,
MixinWOOFi,
MixinZeroExBridge
{
@@ -124,6 +126,11 @@ contract PolygonBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.SOLIDLY) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.WOOFI) {
if (dryRun) {
return (0, true);

View File

@@ -29,6 +29,7 @@ interface IBalancerV2Vault {
GIVEN_OUT
}
// solhint-disable max-line-length
/**
* @dev Performs a swap with a single Pool.
*
@@ -43,6 +44,9 @@ interface IBalancerV2Vault {
* Emits a `Swap` event.
* For full documentation see https://github.com/balancer-labs/balancer-core-v2/blob/master/contracts/vault/interfaces/IVault.sol
*/
// solhint-enable max-line-length
function swap(
SingleSwap calldata request,
FundManagement calldata funds,

View File

@@ -25,13 +25,14 @@ import "../IBridgeAdapter.sol";
UniswapV2
*/
interface IGmxRouter {
// /// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path.
// /// The first element of path is the input token, the last is the output token, and any intermediate elements represent
// /// intermediate pairs to trade through (if, for example, a direct pair does not exist).
// /// @param _path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
// /// @param _amountIn The amount of input tokens to send.
// /// @param _minOut The minimum amount of output tokens that must be received for the transaction not to revert.
// /// @param _reciever Recipient of the output tokens.
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by
/// the path. The first element of path is the input token, the last is the output token, and any intermediate
/// elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist).
/// @param _path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses
/// must exist and have liquidity.
/// @param _amountIn The amount of input tokens to send.
/// @param _minOut The minimum amount of output tokens that must be received for the transaction not to revert.
/// @param _receiver Recipient of the output tokens.
function swap(
address[] calldata _path,
uint256 _amountIn,

View File

@@ -29,13 +29,14 @@ import "../IBridgeAdapter.sol";
KyberDmm Router
*/
interface IKyberDmmRouter {
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path.
/// The first element of path is the input token, the last is the output token, and any intermediate elements represent
/// intermediate pairs to trade through (if, for example, a direct pair does not exist).
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by
/// the path. The first element of path is the input token, the last is the output token, and any intermediate
/// elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist).
/// @param amountIn The amount of input tokens to send.
/// @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
/// @param pools An array of pool addresses. pools.length must be >= 1.
/// @param path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
/// @param path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses
/// must exist and have liquidity.
/// @param to Recipient of the output tokens.
/// @param deadline Unix timestamp after which the transaction will revert.
/// @return amounts The input token amount and all subsequent output token amounts.

View File

@@ -23,7 +23,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
interface IVelodromeRouter {
interface ISolidlyRouter {
function swapExactTokensForTokensSimple(
uint256 amountIn,
uint256 amountOutMin,
@@ -35,16 +35,16 @@ interface IVelodromeRouter {
) external returns (uint256[] memory amounts);
}
contract MixinVelodrome {
contract MixinSolidly {
using LibERC20TokenV06 for IERC20TokenV06;
function _tradeVelodrome(
function _tradeSolidly(
IERC20TokenV06 sellToken,
IERC20TokenV06 buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
(IVelodromeRouter router, bool stable) = abi.decode(bridgeData, (IVelodromeRouter, bool));
(ISolidlyRouter router, bool stable) = abi.decode(bridgeData, (ISolidlyRouter, bool));
sellToken.approveIfBelow(address(router), sellAmount);
boughtAmount = router.swapExactTokensForTokensSimple(

View File

@@ -41,7 +41,9 @@ interface ISynthetix {
}
contract MixinSynthetix {
// solhint-disable-next-line const-name-snakecase
address private constant rewardAddress = 0x5C80239D97E1eB216b5c3D8fBa5DE5Be5d38e4C9;
// solhint-disable-next-line const-name-snakecase
bytes32 constant trackingCode = 0x3058000000000000000000000000000000000000000000000000000000000000;
function _tradeSynthetix(uint256 sellAmount, bytes memory bridgeData) public returns (uint256 boughtAmount) {

View File

@@ -29,12 +29,13 @@ import "../IBridgeAdapter.sol";
UniswapV2
*/
interface IUniswapV2Router02 {
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path.
/// The first element of path is the input token, the last is the output token, and any intermediate elements represent
/// intermediate pairs to trade through (if, for example, a direct pair does not exist).
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by
/// the path. The first element of path is the input token, the last is the output token, and any intermediate
/// elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist).
/// @param amountIn The amount of input tokens to send.
/// @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
/// @param path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
/// @param path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses
/// must exist and have liquidity.
/// @param to Recipient of the output tokens.
/// @param deadline Unix timestamp after which the transaction will revert.
/// @return amounts The input token amount and all subsequent output token amounts.

Some files were not shown because too many files have changed in this diff Show More