diff --git a/.circleci/config.yml b/.circleci/config.yml
index a9c4bc98b..f307f3b54 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -30,7 +30,7 @@ jobs:
docker_layer_caching: true
- run:
name: Fetch solc version
- command: docker pull ethereum/solc:0.4.25
+ command: docker pull ethereum/solc:0.5.4
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
@@ -60,7 +60,7 @@ jobs:
docker_layer_caching: true
- run:
name: Fetch solc version
- command: docker pull ethereum/solc:0.4.25
+ command: docker pull ethereum/solc:0.5.4
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
diff --git a/.gitignore b/.gitignore
index f6c05d6a9..d6f98ab0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
/types/generated/*
coverage.json
coverage/
+.env
### Coverage artifacts (yarn coverage-setup) ###
test/*.js*
@@ -31,4 +32,4 @@ yarn-error.log*
blockchain/
# Ouputs
-deployments/outputs.ts
\ No newline at end of file
+deployments/outputs.ts
diff --git a/README.md b/README.md
index 0f1e23774..6ee9c27fc 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ Firstly, you need to install Docker. The easiest way is to follow the Instructio
You need to pull the docker image that you want to use by using the following command:
```
-docker pull ethereum/solc:0.4.25
+docker pull ethereum/solc:0.5.4
```
If you wish not to set up docker, you can turn off the `docker: true` flag in truffle.js
diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol
index c99a03c12..3177814ce 100644
--- a/contracts/Migrations.sol
+++ b/contracts/Migrations.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract Migrations {
diff --git a/contracts/core/Core.sol b/contracts/core/Core.sol
index 4bc737687..76123db1c 100644
--- a/contracts/core/Core.sol
+++ b/contracts/core/Core.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { CoreAccounting } from "./extensions/CoreAccounting.sol";
import { CoreFactory } from "./extensions/CoreFactory.sol";
diff --git a/contracts/core/TransferProxy.sol b/contracts/core/TransferProxy.sol
index 4546e2bfe..f5d30dab4 100644
--- a/contracts/core/TransferProxy.sol
+++ b/contracts/core/TransferProxy.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -92,8 +92,8 @@ contract TransferProxy is
* @param _to The address to transfer to
*/
function batchTransfer(
- address[] _tokens,
- uint256[] _quantities,
+ address[] calldata _tokens,
+ uint256[] calldata _quantities,
address _from,
address _to
)
@@ -102,7 +102,7 @@ contract TransferProxy is
{
// Storing token count to local variable to save on invocation
uint256 tokenCount = _tokens.length;
-
+
// Confirm and empty _tokens array is not passed
require(
tokenCount > 0,
diff --git a/contracts/core/Vault.sol b/contracts/core/Vault.sol
index 136aaf153..e21a196f6 100644
--- a/contracts/core/Vault.sol
+++ b/contracts/core/Vault.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -74,7 +74,7 @@ contract Vault is
// Retrieve current balance of token for the vault
uint256 existingVaultBalance = ERC20Wrapper.balanceOf(
_token,
- this
+ address(this)
);
// Call specified ERC20 token contract to transfer tokens from Vault to user
@@ -87,7 +87,7 @@ contract Vault is
// Verify transfer quantity is reflected in balance
uint256 newVaultBalance = ERC20Wrapper.balanceOf(
_token,
- this
+ address(this)
);
// Check to make sure current balances are as expected
require(
@@ -139,7 +139,7 @@ contract Vault is
);
// Decrement balances state variable subtracting _quantity to user's token amount
- balances[_token][_owner] = balances[_token][_owner].sub(_quantity);
+ balances[_token][_owner] = balances[_token][_owner].sub(_quantity);
}
/**
@@ -182,16 +182,16 @@ contract Vault is
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchWithdrawTo(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyAuthorized
{
// Storing token count to local variable to save on invocation
uint256 tokenCount = _tokens.length;
-
+
// Confirm and empty _tokens array is not passed
require(
tokenCount > 0,
@@ -224,9 +224,9 @@ contract Vault is
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwner(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyAuthorized
@@ -252,7 +252,7 @@ contract Vault is
_tokens[i],
_owner,
_quantities[i]
- );
+ );
}
}
}
@@ -266,9 +266,9 @@ contract Vault is
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwner(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyAuthorized
@@ -308,10 +308,10 @@ contract Vault is
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalance(
- address[] _tokens,
+ address[] calldata _tokens,
address _from,
address _to,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyAuthorized
diff --git a/contracts/core/exchange-wrappers/KyberNetworkWrapper.sol b/contracts/core/exchange-wrappers/KyberNetworkWrapper.sol
index 70e8b3b82..3d786a35a 100644
--- a/contracts/core/exchange-wrappers/KyberNetworkWrapper.sol
+++ b/contracts/core/exchange-wrappers/KyberNetworkWrapper.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -119,11 +119,11 @@ contract KyberNetworkWrapper {
* @return ExchangeWrapperLibrary.ExchangeResults Struct containing component acquisition results
*/
function exchange(
- ExchangeWrapperLibrary.ExchangeData _exchangeData,
- bytes _tradesData
+ ExchangeWrapperLibrary.ExchangeData memory _exchangeData,
+ bytes memory _tradesData
)
public
- returns (ExchangeWrapperLibrary.ExchangeResults)
+ returns (ExchangeWrapperLibrary.ExchangeResults memory)
{
require(
ICore(core).validModules(msg.sender),
@@ -175,7 +175,7 @@ contract KyberNetworkWrapper {
*/
function tradeOnKyberReserve(
address _sourceToken,
- bytes _tradesData,
+ bytes memory _tradesData,
uint256 _offset
)
private
@@ -199,7 +199,7 @@ contract KyberNetworkWrapper {
address(this),
destinationQuantityToTradeFor,
trade.minimumConversionRate,
- 0
+ address(0)
);
// Ensure the destination token is allowed to be transferred by Set TransferProxy
@@ -231,7 +231,7 @@ contract KyberNetworkWrapper {
* @return KyberTrade KyberTrade struct
*/
function parseKyberTrade(
- bytes _tradesData,
+ bytes memory _tradesData,
uint256 _offset
)
private
@@ -265,13 +265,13 @@ contract KyberNetworkWrapper {
private
{
// Transfer any unused or remainder maker token back to the issuance order user
- uint256 remainderMakerToken = ERC20.balanceOf(_makerToken, this);
+ uint256 remainderMakerToken = ERC20.balanceOf(_makerToken, address(this));
if (remainderMakerToken > 0) {
ERC20.transfer(
_makerToken,
_maker,
remainderMakerToken
);
- }
+ }
}
}
diff --git a/contracts/core/exchange-wrappers/ZeroExExchangeWrapper.sol b/contracts/core/exchange-wrappers/ZeroExExchangeWrapper.sol
index da3718acd..abc74ba1a 100644
--- a/contracts/core/exchange-wrappers/ZeroExExchangeWrapper.sol
+++ b/contracts/core/exchange-wrappers/ZeroExExchangeWrapper.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -93,11 +93,11 @@ contract ZeroExExchangeWrapper {
* @return ExchangeWrapperLibrary.ExchangeResults Struct containing component acquisition results
*/
function exchange(
- ExchangeWrapperLibrary.ExchangeData _exchangeData,
- bytes _ordersData
+ ExchangeWrapperLibrary.ExchangeData memory _exchangeData,
+ bytes memory _ordersData
)
public
- returns (ExchangeWrapperLibrary.ExchangeResults)
+ returns (ExchangeWrapperLibrary.ExchangeResults memory)
{
require(
ICore(core).validModules(msg.sender),
@@ -164,8 +164,8 @@ contract ZeroExExchangeWrapper {
*/
function fillZeroExOrder(
address _issuanceOrderFiller,
- OrderHandler.OrderHeader _header,
- ZeroExOrder.Order _order )
+ OrderHandler.OrderHeader memory _header,
+ ZeroExOrder.Order memory _order )
private
returns (address, uint256)
{
@@ -237,13 +237,13 @@ contract ZeroExExchangeWrapper {
* @return uint256 Tracks how many bytes in _ordersData have been parsed
*/
function parseOrderInformation(
- bytes _ordersData,
+ bytes memory _ordersData,
uint256 _offset,
address _takerToken
)
private
pure
- returns (OrderHandler.ZeroExOrderInformation, uint256)
+ returns (OrderHandler.ZeroExOrderInformation memory, uint256)
{
// Parse header of current wrapper order
OrderHandler.OrderHeader memory header = OrderHandler.parseOrderHeader(
@@ -273,6 +273,6 @@ contract ZeroExExchangeWrapper {
order: order
});
- return (orderInformation, orderBodyStart);
+ return (orderInformation, orderBodyStart);
}
}
diff --git a/contracts/core/exchange-wrappers/lib/ZeroExOrderDataHandler.sol b/contracts/core/exchange-wrappers/lib/ZeroExOrderDataHandler.sol
index ba56c78ff..2abd1017f 100644
--- a/contracts/core/exchange-wrappers/lib/ZeroExOrderDataHandler.sol
+++ b/contracts/core/exchange-wrappers/lib/ZeroExOrderDataHandler.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -71,12 +71,12 @@ library ZeroExOrderDataHandler {
* @return OrderHeader Struct containing wrapper order header data
*/
function parseOrderHeader(
- bytes _ordersData,
+ bytes memory _ordersData,
uint256 _offset
)
internal
pure
- returns (OrderHeader)
+ returns (OrderHeader memory)
{
OrderHeader memory header;
@@ -114,7 +114,7 @@ library ZeroExOrderDataHandler {
* @return LibOrder.Order 0x order struct
*/
function parseZeroExOrder(
- bytes _ordersData,
+ bytes memory _ordersData,
address _makerTokenAddress,
address _takerTokenAddress,
uint256 _offset
@@ -157,7 +157,7 @@ library ZeroExOrderDataHandler {
)
private
pure
- returns (bytes)
+ returns (bytes memory)
{
bytes memory result = new bytes(36);
diff --git a/contracts/core/extensions/CoreAccounting.sol b/contracts/core/extensions/CoreAccounting.sol
index 3ba2c6ec2..fe3f38d0c 100644
--- a/contracts/core/extensions/CoreAccounting.sol
+++ b/contracts/core/extensions/CoreAccounting.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -112,8 +112,8 @@ contract CoreAccounting is
* @param _quantities Array of the amounts of tokens to deposit
*/
function batchDeposit(
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external
nonReentrant
@@ -136,8 +136,8 @@ contract CoreAccounting is
* @param _quantities Array of the amounts of tokens to withdraw
*/
function batchWithdraw(
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external
nonReentrant
@@ -190,28 +190,22 @@ contract CoreAccounting is
function batchDepositInternal(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] memory _tokens,
+ uint256[] memory _quantities
)
internal
whenOperational
{
- // Confirm and empty _tokens array is not passed
+ // Confirm an empty _tokens or quantity array is not passed
require(
- _tokens.length > 0,
- "Core: Empty tokens"
- );
-
- // Confirm an empty _quantities array is not passed
- require(
- _quantities.length > 0,
- "Core: Empty quantities"
+ _tokens.length > 0 && _quantities.length > 0,
+ "Core: Inputs len > 0"
);
// Confirm there is one quantity for every token address
require(
_tokens.length == _quantities.length,
- "Core: Tokens + quantities len mismatch"
+ "Core: Input lens !="
);
state.transferProxyInstance.batchTransfer(
@@ -240,27 +234,21 @@ contract CoreAccounting is
function batchWithdrawInternal(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] memory _tokens,
+ uint256[] memory _quantities
)
internal
{
- // Confirm an empty _tokens array is not passed
- require(
- _tokens.length > 0,
- "Core: Empty tokens"
- );
-
- // Confirm an empty _quantities array is not passed
+ // Confirm an empty _tokens or quantity array is not passed
require(
- _quantities.length > 0,
- "Core: Empty quantities"
+ _tokens.length > 0 && _quantities.length > 0,
+ "Core: Inputs len > 0"
);
// Confirm there is one quantity for every token address
require(
_tokens.length == _quantities.length,
- "Core: Tokens + quantities len mismatch"
+ "Core: Input lens !="
);
// Call Vault contract to deattribute withdrawn tokens from user
diff --git a/contracts/core/extensions/CoreFactory.sol b/contracts/core/extensions/CoreFactory.sol
index e6c669f4e..4e84f451a 100644
--- a/contracts/core/extensions/CoreFactory.sol
+++ b/contracts/core/extensions/CoreFactory.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { CoreState } from "../lib/CoreState.sol";
import { ISetFactory } from "../interfaces/ISetFactory.sol";
@@ -55,14 +55,14 @@ contract CoreFactory is
* @param _callData Byte string containing additional call parameters
* @return setTokenAddress The address of the new Set
*/
- function create(
+ function createSet(
address _factory,
- address[] _components,
- uint256[] _units,
+ address[] calldata _components,
+ uint256[] calldata _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol,
- bytes _callData
+ bytes calldata _callData
)
external
returns (address)
@@ -74,7 +74,7 @@ contract CoreFactory is
);
// Create the Set
- address newSetTokenAddress = ISetFactory(_factory).create(
+ address newSetTokenAddress = ISetFactory(_factory).createSet(
_components,
_units,
_naturalUnit,
diff --git a/contracts/core/extensions/CoreInternal.sol b/contracts/core/extensions/CoreInternal.sol
index 61d469b94..ef8d9030c 100644
--- a/contracts/core/extensions/CoreInternal.sol
+++ b/contracts/core/extensions/CoreInternal.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
@@ -38,7 +38,7 @@ contract CoreInternal is
using AddressArrayUtils for address[];
/* ============ Events ============ */
-
+
event FactoryAdded(
address _factory
);
@@ -118,7 +118,7 @@ contract CoreInternal is
{
require(
state.validFactories[_factory],
- "Core: Factory not enabled"
+ "Core: Invalid Factory"
);
state.factories = state.factories.remove(_factory);
@@ -127,7 +127,7 @@ contract CoreInternal is
emit FactoryRemoved(
_factory
- );
+ );
}
/**
@@ -147,7 +147,7 @@ contract CoreInternal is
{
require(
state.exchangeIds[_exchangeId] == address(0),
- "Core: Exchange Id not registered"
+ "Core: Invalid Id"
);
state.exchangeIds[_exchangeId] = _exchange;
@@ -176,7 +176,7 @@ contract CoreInternal is
{
require(
state.exchangeIds[_exchangeId] != address(0),
- "Core: Exchange already removed"
+ "Core: Invalid exchange"
);
require(
@@ -190,7 +190,7 @@ contract CoreInternal is
emit ExchangeRemoved(
_exchangeId
- );
+ );
}
/**
@@ -229,7 +229,7 @@ contract CoreInternal is
{
require(
state.validModules[_module],
- "Core: Module not enabled"
+ "Core: Invalid Module"
);
state.modules = state.modules.remove(_module);
@@ -238,7 +238,7 @@ contract CoreInternal is
emit ModuleRemoved(
_module
- );
+ );
}
/**
@@ -255,7 +255,7 @@ contract CoreInternal is
{
require(
state.validSets[_set],
- "Core: Set not enabled"
+ "Core: Invalid Set"
);
state.setTokens = state.setTokens.remove(_set);
@@ -266,7 +266,7 @@ contract CoreInternal is
emit SetDisabled(
_set
- );
+ );
}
/**
@@ -283,7 +283,7 @@ contract CoreInternal is
{
require(
state.disabledSets[_set],
- "Core: Set not disabled"
+ "Core: Invalid Set"
);
state.setTokens = state.setTokens.append(_set);
@@ -333,7 +333,7 @@ contract CoreInternal is
{
require(
state.validPriceLibraries[_priceLibrary],
- "Core: PriceLibrary not enabled"
+ "Core: Invalid Lib"
);
state.priceLibraries = state.priceLibraries.remove(_priceLibrary);
@@ -342,6 +342,6 @@ contract CoreInternal is
emit PriceLibraryRemoved(
_priceLibrary
- );
+ );
}
}
diff --git a/contracts/core/extensions/CoreIssuance.sol b/contracts/core/extensions/CoreIssuance.sol
index 454644c93..956143c29 100644
--- a/contracts/core/extensions/CoreIssuance.sol
+++ b/contracts/core/extensions/CoreIssuance.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -150,54 +150,25 @@ contract CoreIssuance is
external
nonReentrant
{
- ISetToken setToken = ISetToken(_set);
-
- // Verify Set was created by Core and is enabled
- require(
- state.validSets[_set],
- "Core: Invalid SetToken"
- );
-
- // Validate quantity is multiple of natural unit
- require(
- _quantity % setToken.naturalUnit() == 0,
- "Core: Quantity must be multiple of natural unit"
- );
-
- // Burn the Set token (thereby decrementing the SetToken balance)
- setToken.burn(
+ uint256[] memory componentTransferValues = redeemAndDecrementVault(
+ _set,
msg.sender,
_quantity
);
- // Fetch Set token properties
- uint256 naturalUnit = setToken.naturalUnit();
- address[] memory components = setToken.getComponents();
- uint256[] memory units = setToken.getUnits();
-
- // Calculate component quantities to redeem
- uint256[] memory componentQuantities = IssuanceLibrary.calculateTransferValues(
- units,
- naturalUnit,
- _quantity
- );
-
- // Decrement components from Set's possession
- state.vaultInstance.batchDecrementTokenOwner(
- components,
- _set,
- componentQuantities
- );
-
// Calculate the withdraw and increment quantities to specified address
+ uint256[] memory incrementTokenOwnerValues;
+ uint256[] memory withdrawToValues;
(
- uint256[] memory incrementTokenOwnerValues,
- uint256[] memory withdrawToValues
+ incrementTokenOwnerValues,
+ withdrawToValues
) = IssuanceLibrary.calculateWithdrawAndIncrementQuantities(
- componentQuantities,
+ componentTransferValues,
_toExclude
);
+ address[] memory components = ISetToken(_set).getComponents();
+
// Increment excluded components to the specified address
state.vaultInstance.batchIncrementTokenOwner(
components,
@@ -287,7 +258,7 @@ contract CoreIssuance is
// Verify Set was created by Core and is enabled
require(
state.validSets[_set],
- "Core: Invalid SetToken"
+ "Core: Invalid Set"
);
// Declare interface variables
@@ -296,7 +267,7 @@ contract CoreIssuance is
// Validate quantity is multiple of natural unit
require(
_quantity % setToken.naturalUnit() == 0,
- "Core: Quantity must be multiple of natural unit"
+ "Core: Invalid quantity"
);
// Fetch set token properties
@@ -312,9 +283,11 @@ contract CoreIssuance is
);
// Calculate the withdraw and increment quantities to caller
+ uint256[] memory decrementTokenOwnerValues;
+ uint256[] memory depositValues;
(
- uint256[] memory decrementTokenOwnerValues,
- uint256[] memory depositValues
+ decrementTokenOwnerValues,
+ depositValues
) = IssuanceLibrary.calculateDepositAndDecrementQuantities(
components,
requiredComponentQuantities,
@@ -397,50 +370,76 @@ contract CoreIssuance is
uint256 _quantity
)
internal
+ {
+ uint256[] memory componentTransferValues = redeemAndDecrementVault(
+ _set,
+ _burnAddress,
+ _quantity
+ );
+
+ // Increment the component amount
+ address[] memory components = ISetToken(_set).getComponents();
+ state.vaultInstance.batchIncrementTokenOwner(
+ components,
+ _incrementAddress,
+ componentTransferValues
+ );
+ }
+
+ /**
+ * Private method that validates inputs, redeems Set, and decrements
+ * the components in the vault
+ *
+ * @param _set Address of the Set to redeem
+ * @param _burnAddress Address to burn tokens from
+ * @param _quantity Number of tokens to redeem
+ * @return componentTransferValues Transfer value of components
+ */
+ function redeemAndDecrementVault(
+ address _set,
+ address _burnAddress,
+ uint256 _quantity
+ )
+ private
+ returns (uint256[] memory)
{
// Verify Set was created by Core and is enabled
require(
state.validSets[_set],
- "Core: Invalid SetToken address"
+ "Core: Invalid Set"
);
- // Declare interface variables
ISetToken setToken = ISetToken(_set);
+ address[] memory components = setToken.getComponents();
+ uint256[] memory units = setToken.getUnits();
+ uint256 naturalUnit = setToken.naturalUnit();
// Validate quantity is multiple of natural unit
- uint256 naturalUnit = setToken.naturalUnit();
require(
_quantity % naturalUnit == 0,
- "Core: Quantity must be multiple of natural unit"
+ "Core: Invalid quantity"
);
- // Burn the Set token (thereby decrementing the SetToken balance)
+ // Burn the Set token (thereby decrementing the Set balance)
setToken.burn(
_burnAddress,
_quantity
);
- // Fetch Set token properties
- address[] memory components = setToken.getComponents();
- uint256[] memory units = setToken.getUnits();
- uint256[] memory tokenValues = IssuanceLibrary.calculateTransferValues(
+ // Calculate component quantities to redeem
+ uint256[] memory componentQuantities = IssuanceLibrary.calculateTransferValues(
units,
naturalUnit,
_quantity
);
- // Decrement the Set amount
+ // Decrement components from Set's possession
state.vaultInstance.batchDecrementTokenOwner(
components,
_set,
- tokenValues
+ componentQuantities
);
- // Increment the component amount
- state.vaultInstance.batchIncrementTokenOwner(
- components,
- _incrementAddress,
- tokenValues
- );
+ return componentQuantities;
}
}
diff --git a/contracts/core/extensions/CoreModuleInteraction.sol b/contracts/core/extensions/CoreModuleInteraction.sol
index 1c37dbaee..13534019b 100644
--- a/contracts/core/extensions/CoreModuleInteraction.sol
+++ b/contracts/core/extensions/CoreModuleInteraction.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
@@ -61,8 +61,8 @@ contract CoreModuleInteraction is
function batchDepositModule(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external
onlyModule
@@ -87,8 +87,8 @@ contract CoreModuleInteraction is
function batchWithdrawModule(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external
onlyModule
@@ -184,9 +184,9 @@ contract CoreModuleInteraction is
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwnerModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyModule
@@ -207,9 +207,9 @@ contract CoreModuleInteraction is
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwnerModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyModule
@@ -231,10 +231,10 @@ contract CoreModuleInteraction is
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalanceModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _from,
address _to,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external
onlyModule
@@ -269,7 +269,7 @@ contract CoreModuleInteraction is
_token,
_quantity,
_from,
- _to
+ _to
);
}
@@ -283,8 +283,8 @@ contract CoreModuleInteraction is
* @param _to The address to transfer to
*/
function batchTransferModule(
- address[] _tokens,
- uint256[] _quantities,
+ address[] calldata _tokens,
+ uint256[] calldata _quantities,
address _from,
address _to
)
@@ -295,8 +295,7 @@ contract CoreModuleInteraction is
_tokens,
_quantities,
_from,
- _to
+ _to
);
}
-
-}
\ No newline at end of file
+}
diff --git a/contracts/core/extensions/CoreOperationState.sol b/contracts/core/extensions/CoreOperationState.sol
index a094851e7..feb034b6a 100644
--- a/contracts/core/extensions/CoreOperationState.sol
+++ b/contracts/core/extensions/CoreOperationState.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
@@ -36,16 +36,16 @@ contract CoreOperationState is
/* ============ Enum ============ */
/**
- * Operational:
+ * Operational:
* All Accounting and Issuance related functions are available for usage during this stage
*
- * Shut Down:
+ * Shut Down:
* Only functions which allow users to redeem and withdraw funds are allowed during this stage
- */
- enum OperationState {
+ */
+ enum OperationState {
Operational,
ShutDown,
- InvalidState
+ InvalidState
}
/* ============ Events ============ */
@@ -60,7 +60,7 @@ contract CoreOperationState is
modifier whenOperational() {
require(
state.operationState == uint8(OperationState.Operational),
- "Core: State is non-operational"
+ "Core: Nonoperational"
);
_;
}
diff --git a/contracts/core/interfaces/ICore.sol b/contracts/core/interfaces/ICore.sol
index c12f84e9a..e33ae1522 100644
--- a/contracts/core/interfaces/ICore.sol
+++ b/contracts/core/interfaces/ICore.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
@@ -33,7 +33,7 @@ interface ICore {
function transferProxy()
external
view
- returns(address);
+ returns (address);
/**
* Return vault address.
@@ -43,7 +43,7 @@ interface ICore {
function vault()
external
view
- returns(address);
+ returns (address);
/**
* Return address belonging to given exchangeId.
@@ -56,7 +56,7 @@ interface ICore {
)
external
view
- returns(address);
+ returns (address);
/*
* Returns if valid set
@@ -89,7 +89,7 @@ interface ICore {
)
external
view
- returns(bool);
+ returns (bool);
/**
* Exchanges components for Set Tokens
@@ -183,8 +183,8 @@ interface ICore {
* @param _quantities Array of the number of tokens to deposit
*/
function batchDeposit(
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external;
@@ -196,8 +196,8 @@ interface ICore {
* @param _quantities Array of the number of tokens to withdraw
*/
function batchWithdraw(
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external;
@@ -252,17 +252,17 @@ interface ICore {
* @param _callData Byte string containing additional call parameters
* @return setTokenAddress The address of the new Set
*/
- function create(
+ function createSet(
address _factory,
- address[] _components,
- uint256[] _units,
+ address[] calldata _components,
+ uint256[] calldata _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol,
- bytes _callData
+ bytes calldata _callData
)
external
- returns(address);
+ returns (address);
/**
* Exposes internal function that deposits a quantity of tokens to the vault and attributes
@@ -311,8 +311,8 @@ interface ICore {
function batchDepositModule(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external;
@@ -328,8 +328,8 @@ interface ICore {
function batchWithdrawModule(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] calldata _tokens,
+ uint256[] calldata _quantities
)
external;
@@ -376,9 +376,9 @@ interface ICore {
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwnerModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -391,9 +391,9 @@ interface ICore {
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwnerModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -407,10 +407,10 @@ interface ICore {
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalanceModule(
- address[] _tokens,
+ address[] calldata _tokens,
address _from,
address _to,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -441,8 +441,8 @@ interface ICore {
* @param _to The address to transfer to
*/
function batchTransferModule(
- address[] _tokens,
- uint256[] _quantities,
+ address[] calldata _tokens,
+ uint256[] calldata _quantities,
address _from,
address _to
)
diff --git a/contracts/core/interfaces/ICoreAccounting.sol b/contracts/core/interfaces/ICoreAccounting.sol
index 4a931ca56..7dbfda2da 100644
--- a/contracts/core/interfaces/ICoreAccounting.sol
+++ b/contracts/core/interfaces/ICoreAccounting.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
@@ -40,8 +40,8 @@ contract ICoreAccounting {
function batchDepositInternal(
address _from,
address _to,
- address[] _tokens,
- uint[] _quantities
+ address[] memory _tokens,
+ uint[] memory _quantities
)
internal;
@@ -57,8 +57,8 @@ contract ICoreAccounting {
function batchWithdrawInternal(
address _from,
address _to,
- address[] _tokens,
- uint256[] _quantities
+ address[] memory _tokens,
+ uint256[] memory _quantities
)
internal;
}
diff --git a/contracts/core/interfaces/ICoreIssuance.sol b/contracts/core/interfaces/ICoreIssuance.sol
index 312fb85ec..c72230b3c 100644
--- a/contracts/core/interfaces/ICoreIssuance.sol
+++ b/contracts/core/interfaces/ICoreIssuance.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
diff --git a/contracts/core/interfaces/IExchangeIssueModule.sol b/contracts/core/interfaces/IExchangeIssueModule.sol
index 0fc82d75e..e0dc479d9 100644
--- a/contracts/core/interfaces/IExchangeIssueModule.sol
+++ b/contracts/core/interfaces/IExchangeIssueModule.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ExchangeIssueLibrary } from "../lib/ExchangeIssueLibrary.sol";
@@ -27,8 +27,8 @@ import { ExchangeIssueLibrary } from "../lib/ExchangeIssueLibrary.sol";
*/
interface IExchangeIssueModule {
function exchangeIssue(
- ExchangeIssueLibrary.ExchangeIssueParams _exchangeIssueData,
- bytes _orderData
+ ExchangeIssueLibrary.ExchangeIssueParams calldata _exchangeIssueData,
+ bytes calldata _orderData
)
- public;
+ external;
}
diff --git a/contracts/core/interfaces/IExchangeWrapper.sol b/contracts/core/interfaces/IExchangeWrapper.sol
index fede6de0a..e55281db4 100644
--- a/contracts/core/interfaces/IExchangeWrapper.sol
+++ b/contracts/core/interfaces/IExchangeWrapper.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ExchangeWrapperLibrary } from "../lib/ExchangeWrapperLibrary.sol";
@@ -43,9 +43,9 @@ interface IExchangeWrapper {
* @param _orderData Arbitrary bytes data for any information to pass to the exchange
*/
function exchange(
- ExchangeWrapperLibrary.ExchangeData _exchangeData,
- bytes _orderData
+ ExchangeWrapperLibrary.ExchangeData calldata _exchangeData,
+ bytes calldata _orderData
)
external
- returns (ExchangeWrapperLibrary.ExchangeResults);
+ returns (ExchangeWrapperLibrary.ExchangeResults memory);
}
diff --git a/contracts/core/interfaces/IRebalancingSetFactory.sol b/contracts/core/interfaces/IRebalancingSetFactory.sol
index bddd14a98..1631cfcc1 100644
--- a/contracts/core/interfaces/IRebalancingSetFactory.sol
+++ b/contracts/core/interfaces/IRebalancingSetFactory.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ISetFactory } from "./ISetFactory.sol";
import { IWhiteList } from "./IWhiteList.sol";
@@ -92,7 +92,7 @@ contract IRebalancingSetFactory is
* Getter for rebalanceAuctionModule address on RebalancingSetTokenFactory
*
* @return address Address of rebalanceAuctionModule
- */
+ */
function rebalanceAuctionModule()
external
returns (address);
diff --git a/contracts/core/interfaces/IRebalancingSetToken.sol b/contracts/core/interfaces/IRebalancingSetToken.sol
index 638acc30b..64421c365 100644
--- a/contracts/core/interfaces/IRebalancingSetToken.sol
+++ b/contracts/core/interfaces/IRebalancingSetToken.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { RebalancingHelperLibrary } from "../lib/RebalancingHelperLibrary.sol";
@@ -77,8 +77,8 @@ interface IRebalancingSetToken {
*/
function balanceOf(
address owner
- )
- public
+ )
+ external
view
returns (uint256);
@@ -115,8 +115,8 @@ interface IRebalancingSetToken {
*
* @return A address representing the base Set Token
*/
- function currentSet()
- public
+ function currentSet()
+ external
view
returns (address);
@@ -128,7 +128,7 @@ interface IRebalancingSetToken {
function unitShares()
external
view
- returns(uint256);
+ returns (uint256);
/*
* Burn set token for given address.
@@ -155,7 +155,7 @@ interface IRebalancingSetToken {
uint256 _quantity
)
external
- returns (address[], uint256[], uint256[]);
+ returns (address[] memory, uint256[] memory, uint256[] memory);
/*
* Get combinedTokenArray of Rebalancing Set
@@ -175,5 +175,5 @@ interface IRebalancingSetToken {
function getCombinedTokenArray()
external
view
- returns(address[]);
+ returns (address[] memory);
}
diff --git a/contracts/core/interfaces/ISetFactory.sol b/contracts/core/interfaces/ISetFactory.sol
index 6b6c97935..cfeb6e3e8 100644
--- a/contracts/core/interfaces/ISetFactory.sol
+++ b/contracts/core/interfaces/ISetFactory.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
@@ -48,13 +48,13 @@ interface ISetFactory {
* @param _callData Byte string containing additional call parameters
* @return setTokenAddress The address of the new Set
*/
- function create(
- address[] _components,
- uint[] _units,
+ function createSet(
+ address[] calldata _components,
+ uint[] calldata _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol,
- bytes _callData
+ bytes calldata _callData
)
external
returns (address);
diff --git a/contracts/core/interfaces/ISetToken.sol b/contracts/core/interfaces/ISetToken.sol
index 6b551b887..a70bfe5c6 100644
--- a/contracts/core/interfaces/ISetToken.sol
+++ b/contracts/core/interfaces/ISetToken.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
* @title ISetToken
@@ -45,7 +45,7 @@ interface ISetToken {
function getComponents()
external
view
- returns(address[]);
+ returns (address[] memory);
/*
* Get units of all tokens in Set
@@ -55,7 +55,7 @@ interface ISetToken {
function getUnits()
external
view
- returns(uint256[]);
+ returns (uint256[] memory);
/*
* Checks to make sure token is component of Set
diff --git a/contracts/core/interfaces/ITransferProxy.sol b/contracts/core/interfaces/ITransferProxy.sol
index dca45e5fa..821b0304e 100644
--- a/contracts/core/interfaces/ITransferProxy.sol
+++ b/contracts/core/interfaces/ITransferProxy.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
* @title ITransferProxy
@@ -54,8 +54,8 @@ interface ITransferProxy {
* @param _to The address to transfer to
*/
function batchTransfer(
- address[] _tokens,
- uint256[] _quantities,
+ address[] calldata _tokens,
+ uint256[] calldata _quantities,
address _from,
address _to
)
diff --git a/contracts/core/interfaces/IVault.sol b/contracts/core/interfaces/IVault.sol
index ac5997550..e0d48c5e8 100644
--- a/contracts/core/interfaces/IVault.sol
+++ b/contracts/core/interfaces/IVault.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
* @title IVault
@@ -97,9 +97,9 @@ interface IVault {
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchWithdrawTo(
- address[] _tokens,
+ address[] calldata _tokens,
address _to,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -112,9 +112,9 @@ interface IVault {
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwner(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -127,9 +127,9 @@ interface IVault {
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwner(
- address[] _tokens,
+ address[] calldata _tokens,
address _owner,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -142,10 +142,10 @@ interface IVault {
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalance(
- address[] _tokens,
+ address[] calldata _tokens,
address _from,
address _to,
- uint256[] _quantities
+ uint256[] calldata _quantities
)
external;
@@ -160,5 +160,6 @@ interface IVault {
address _owner
)
external
+ view
returns (uint256);
}
diff --git a/contracts/core/interfaces/IWhiteList.sol b/contracts/core/interfaces/IWhiteList.sol
index fbf2cdab3..12b23f47f 100644
--- a/contracts/core/interfaces/IWhiteList.sol
+++ b/contracts/core/interfaces/IWhiteList.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
* @title IWhiteList
@@ -37,7 +37,7 @@ interface IWhiteList {
)
external
view
- returns(bool);
+ returns (bool);
/**
* Verifies an array of addresses against the whitelist
@@ -46,9 +46,9 @@ interface IWhiteList {
* @return bool Whether all addresses in the list are whitelsited
*/
function areValidAddresses(
- address[] _addresses
+ address[] calldata _addresses
)
external
view
- returns(bool);
+ returns (bool);
}
diff --git a/contracts/core/lib/CoreState.sol b/contracts/core/lib/CoreState.sol
index 284f8d6ac..a231f121e 100644
--- a/contracts/core/lib/CoreState.sol
+++ b/contracts/core/lib/CoreState.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ITransferProxy } from "../interfaces/ITransferProxy.sol";
import { IVault } from "../interfaces/IVault.sol";
@@ -95,7 +95,7 @@ contract CoreState {
function operationState()
external
view
- returns(uint8)
+ returns (uint8)
{
return state.operationState;
}
@@ -111,7 +111,7 @@ contract CoreState {
)
external
view
- returns(address)
+ returns (address)
{
return state.exchangeIds[_exchangeId];
}
@@ -124,7 +124,7 @@ contract CoreState {
function transferProxy()
external
view
- returns(address)
+ returns (address)
{
return state.transferProxy;
}
@@ -137,7 +137,7 @@ contract CoreState {
function vault()
external
view
- returns(address)
+ returns (address)
{
return state.vault;
}
@@ -153,7 +153,7 @@ contract CoreState {
)
external
view
- returns(bool)
+ returns (bool)
{
return state.validFactories[_factory];
}
@@ -169,10 +169,10 @@ contract CoreState {
)
external
view
- returns(bool)
+ returns (bool)
{
return state.validModules[_module];
- }
+ }
/**
* Return boolean indicating if address is valid Set.
@@ -185,7 +185,7 @@ contract CoreState {
)
external
view
- returns(bool)
+ returns (bool)
{
return state.validSets[_set];
}
@@ -201,7 +201,7 @@ contract CoreState {
)
external
view
- returns(bool)
+ returns (bool)
{
return state.disabledSets[_set];
}
@@ -217,7 +217,7 @@ contract CoreState {
)
external
view
- returns(bool)
+ returns (bool)
{
return state.validPriceLibraries[_priceLibrary];
}
@@ -230,7 +230,7 @@ contract CoreState {
function setTokens()
external
view
- returns(address[])
+ returns (address[] memory)
{
return state.setTokens;
}
@@ -243,7 +243,7 @@ contract CoreState {
function modules()
external
view
- returns(address[])
+ returns (address[] memory)
{
return state.modules;
}
@@ -256,7 +256,7 @@ contract CoreState {
function factories()
external
view
- returns(address[])
+ returns (address[] memory)
{
return state.factories;
}
@@ -269,7 +269,7 @@ contract CoreState {
function exchanges()
external
view
- returns(address[])
+ returns (address[] memory)
{
return state.exchanges;
}
@@ -282,7 +282,7 @@ contract CoreState {
function priceLibraries()
external
view
- returns(address[])
+ returns (address[] memory)
{
return state.priceLibraries;
}
diff --git a/contracts/core/lib/ExchangeHeaderLibrary.sol b/contracts/core/lib/ExchangeHeaderLibrary.sol
index 19ac52278..90cf56a8e 100644
--- a/contracts/core/lib/ExchangeHeaderLibrary.sol
+++ b/contracts/core/lib/ExchangeHeaderLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -50,7 +50,7 @@ library ExchangeHeaderLibrary {
* @return ExchangeHeader Struct containing data for a batch of exchange orders
*/
function parseExchangeHeader(
- bytes _orderData,
+ bytes memory _orderData,
uint256 _offset
)
internal
@@ -80,13 +80,13 @@ library ExchangeHeaderLibrary {
* @return ExchangeBody Bytes representing the exchange body
*/
function sliceBodyData(
- bytes _orderData,
+ bytes memory _orderData,
uint256 _scannedBytes,
uint256 _exchangeDataLength
)
internal
pure
- returns (bytes)
+ returns (bytes memory)
{
bytes memory bodyData = LibBytes.slice(
_orderData,
diff --git a/contracts/core/lib/ExchangeIssueLibrary.sol b/contracts/core/lib/ExchangeIssueLibrary.sol
index 749d89758..137ea2d7f 100644
--- a/contracts/core/lib/ExchangeIssueLibrary.sol
+++ b/contracts/core/lib/ExchangeIssueLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
diff --git a/contracts/core/lib/ExchangeValidationLibrary.sol b/contracts/core/lib/ExchangeValidationLibrary.sol
index 9c10f57b6..306e03113 100644
--- a/contracts/core/lib/ExchangeValidationLibrary.sol
+++ b/contracts/core/lib/ExchangeValidationLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ISetToken } from "../interfaces/ISetToken.sol";
import { IVault } from "../interfaces/IVault.sol";
@@ -63,8 +63,8 @@ library ExchangeValidationLibrary {
*/
function validateRequiredComponents(
address _set,
- address[] _requiredComponents,
- uint256[] _requiredComponentAmounts
+ address[] memory _requiredComponents,
+ uint256[] memory _requiredComponentAmounts
)
internal
view
@@ -127,8 +127,8 @@ library ExchangeValidationLibrary {
*/
function validateRequiredComponentBalances(
address _vault,
- address[] _requiredComponents,
- uint256[] _requiredBalances,
+ address[] memory _requiredComponents,
+ uint256[] memory _requiredBalances,
address _userToCheck
)
internal
@@ -150,4 +150,4 @@ library ExchangeValidationLibrary {
);
}
}
-}
\ No newline at end of file
+}
diff --git a/contracts/core/lib/ExchangeWrapperLibrary.sol b/contracts/core/lib/ExchangeWrapperLibrary.sol
index b0ad151c0..03b49d17c 100644
--- a/contracts/core/lib/ExchangeWrapperLibrary.sol
+++ b/contracts/core/lib/ExchangeWrapperLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -44,11 +44,11 @@ library ExchangeWrapperLibrary {
*/
struct ExchangeData {
address maker;
- address taker;
- address makerToken;
- uint256 makerAssetAmount;
- uint256 orderCount;
- uint256 fillQuantity;
+ address taker;
+ address makerToken;
+ uint256 makerAssetAmount;
+ uint256 orderCount;
+ uint256 fillQuantity;
}
/**
@@ -73,7 +73,7 @@ library ExchangeWrapperLibrary {
address _core,
ExchangeData memory _exchangeData,
address _exchangeWrapper,
- bytes _bodyData
+ bytes memory _bodyData
)
internal
{
@@ -89,6 +89,6 @@ library ExchangeWrapperLibrary {
_exchangeData.maker,
exchangeResults.components,
exchangeResults.componentQuantities
- );
+ );
}
}
diff --git a/contracts/core/lib/IssuanceLibrary.sol b/contracts/core/lib/IssuanceLibrary.sol
index f6e91d245..6b43c40ca 100644
--- a/contracts/core/lib/IssuanceLibrary.sol
+++ b/contracts/core/lib/IssuanceLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -26,7 +26,7 @@ import { IVault } from "../interfaces/IVault.sol";
* @title IssuanceLibrary
* @author Set Protocol
*
- * This library contains functions for calculating
+ * This library contains functions for calculating
*/
library IssuanceLibrary {
@@ -44,16 +44,16 @@ library IssuanceLibrary {
* @return uint256[] depositQuantities Quantities to deposit into the vault
*/
function calculateDepositAndDecrementQuantities(
- address[] _components,
- uint256[] _componentQuantities,
+ address[] calldata _components,
+ uint256[] calldata _componentQuantities,
address _owner,
address _vault
)
external
view
returns (
- uint256[] /* decrementtQuantities */,
- uint256[] /* depositQuantities */
+ uint256[] memory /* decrementQuantities */,
+ uint256[] memory /* depositQuantities */
)
{
uint256 componentCount = _components.length;
@@ -96,14 +96,14 @@ library IssuanceLibrary {
* @return uint256[] withdrawQuantities Quantities to withdraw from vault
*/
function calculateWithdrawAndIncrementQuantities(
- uint256[] _componentQuantities,
+ uint256[] calldata _componentQuantities,
uint256 _toExclude
)
external
pure
returns (
- uint256[] /* incrementQuantities */,
- uint256[] /* withdrawQuantities */
+ uint256[] memory /* incrementQuantities */,
+ uint256[] memory /* withdrawQuantities */
)
{
uint256 componentCount = _componentQuantities.length;
@@ -138,13 +138,13 @@ library IssuanceLibrary {
* @return uint256[] Transfer value in base units of the Set
*/
function calculateTransferValues(
- uint256[] _componentUnits,
+ uint256[] calldata _componentUnits,
uint256 _naturalUnit,
uint256 _quantity
)
external
pure
- returns (uint256[])
+ returns (uint256[] memory)
{
uint256[] memory tokenValues = new uint256[](_componentUnits.length);
diff --git a/contracts/core/lib/RebalancingHelperLibrary.sol b/contracts/core/lib/RebalancingHelperLibrary.sol
index 1738d1e21..503b95fc4 100644
--- a/contracts/core/lib/RebalancingHelperLibrary.sol
+++ b/contracts/core/lib/RebalancingHelperLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -27,7 +27,7 @@ import { StandardStartRebalanceLibrary } from "../tokens/rebalancing-libraries/S
* @title RebalancingHelperLibrary
* @author Set Protocol
*
- * The Rebalancing Helper Library contains functions for facilitating the rebalancing process for
+ * The Rebalancing Helper Library contains functions for facilitating the rebalancing process for
* Rebalancing Set Tokens.
*
*/
@@ -38,7 +38,7 @@ library RebalancingHelperLibrary {
/* ============ Enums ============ */
- enum State { Default, Proposal, Rebalance, Drawdown }
+ enum State { Default, Proposal, Rebalance, Drawdown }
/* ============ Structs ============ */
@@ -87,12 +87,13 @@ library RebalancingHelperLibrary {
function getBidPrice(
uint256 _quantity,
address _auctionLibrary,
- StandardStartRebalanceLibrary.BiddingParameters _biddingParameters,
- AuctionPriceParameters _auctionParameters,
+ StandardStartRebalanceLibrary.BiddingParameters memory _biddingParameters,
+ AuctionPriceParameters memory _auctionParameters,
uint8 _rebalanceState
)
public
- returns (uint256[], uint256[])
+ view
+ returns (uint256[] memory, uint256[] memory)
{
// Confirm in Rebalance State
require(
@@ -101,7 +102,9 @@ library RebalancingHelperLibrary {
);
// Get bid conversion price, currently static placeholder for calling auctionlibrary
- (uint256 priceNumerator, uint256 priceDivisor) = IAuctionPriceCurve(_auctionLibrary).getCurrentPrice(
+ uint256 priceNumerator;
+ uint256 priceDivisor;
+ (priceNumerator, priceDivisor) = IAuctionPriceCurve(_auctionLibrary).getCurrentPrice(
_auctionParameters
);
@@ -131,10 +134,11 @@ library RebalancingHelperLibrary {
uint256 _unitsMultiplier,
uint256 _priceNumerator,
uint256 _priceDivisor,
- StandardStartRebalanceLibrary.BiddingParameters _biddingParameters
+ StandardStartRebalanceLibrary.BiddingParameters memory _biddingParameters
)
public
- returns (uint256[], uint256[])
+ pure
+ returns (uint256[] memory, uint256[] memory)
{
// Declare unit arrays in memory
uint256 combinedTokenCount = _biddingParameters.combinedTokenArray.length;
@@ -154,9 +158,9 @@ library RebalancingHelperLibrary {
_priceNumerator,
_priceDivisor
);
- }
+ }
- return (inflowUnitArray, outflowUnitArray);
+ return (inflowUnitArray, outflowUnitArray);
}
/*
@@ -230,6 +234,6 @@ library RebalancingHelperLibrary {
inflowUnit = 0;
}
- return (inflowUnit, outflowUnit);
+ return (inflowUnit, outflowUnit);
}
}
diff --git a/contracts/core/lib/auction-price-libraries/IAuctionPriceCurve.sol b/contracts/core/lib/auction-price-libraries/IAuctionPriceCurve.sol
index 57fdbe4b6..61aac2332 100644
--- a/contracts/core/lib/auction-price-libraries/IAuctionPriceCurve.sol
+++ b/contracts/core/lib/auction-price-libraries/IAuctionPriceCurve.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { RebalancingHelperLibrary } from "../RebalancingHelperLibrary.sol";
@@ -42,9 +42,9 @@ interface IAuctionPriceCurve {
* @param _auctionPriceParameters Struct containing relevant auction price parameters
*/
function validateAuctionPriceParameters(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters calldata _auctionParameters
)
- public
+ external
view;
/*
@@ -55,9 +55,9 @@ interface IAuctionPriceCurve {
* @return uint256 The auction price denominator
*/
function getCurrentPrice(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters calldata _auctionParameters
)
- public
+ external
view
returns (uint256, uint256);
}
diff --git a/contracts/core/lib/auction-price-libraries/LinearAuctionPriceCurve.sol b/contracts/core/lib/auction-price-libraries/LinearAuctionPriceCurve.sol
index 0c4e67cfd..44d03768d 100644
--- a/contracts/core/lib/auction-price-libraries/LinearAuctionPriceCurve.sol
+++ b/contracts/core/lib/auction-price-libraries/LinearAuctionPriceCurve.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -62,7 +62,7 @@ contract LinearAuctionPriceCurve {
* @param _auctionPriceParameters Struct containing relevant auction price parameters
*/
function validateAuctionPriceParameters(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters memory _auctionParameters
)
public
view
@@ -95,7 +95,7 @@ contract LinearAuctionPriceCurve {
* @return uint256 The auction price denominator
*/
function getCurrentPrice(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters memory _auctionParameters
)
public
view
@@ -109,10 +109,10 @@ contract LinearAuctionPriceCurve {
uint256 currentPriceDenominator = priceDenominator;
// Determine the auctionStartPrice based on if it should be self-defined
- uint256 auctionStartPrice = 0;
+ uint256 auctionStartPrice = 0;
if (usesStartPrice) {
auctionStartPrice = _auctionParameters.auctionStartPrice;
- }
+ }
/*
* This price curve can be broken down into three stages, 1) set up to allow a portion where managers
@@ -120,7 +120,7 @@ contract LinearAuctionPriceCurve {
* to the auction. The auction price, p(x), is defined by:
*
* p(x) = (priceNumerator/priceDenominator
- *
+ *
* In each stage either the priceNumerator or priceDenominator is manipulated to change p(x).The curve shape
* in each stage is defined below.
*
@@ -128,18 +128,18 @@ contract LinearAuctionPriceCurve {
* and terminates at the passed pivot price. The length of time it takes for the auction to reach the pivot
* price is defined by the manager too, thus resulting in the following equation for the slope of the line:
*
- * PriceNumerator(x) = auctionStartPrice + (auctionPivotPrice-auctionStartPrice)*(x/auctionTimeToPivot),
+ * PriceNumerator(x) = auctionStartPrice + (auctionPivotPrice-auctionStartPrice)*(x/auctionTimeToPivot),
* where x is amount of time from auction start
- *
+ *
* 2) Stage 2 the protocol takes over to attempt to hasten/guarantee finality, this unfortunately decreases
- * the granularity of the auction price changes. In this stage the PriceNumerator remains fixed at the
+ * the granularity of the auction price changes. In this stage the PriceNumerator remains fixed at the
* auctionPivotPrice. However, the priceDenominator decays at a rate equivalent to 0.1% of the ORIGINAL
* priceDenominator every 30 secs. This leads to the following function relative to time:
*
* PriceDenominator(x) = priceDenominator-(0.01*priceDenominator*((x-auctionTimeToPivot)/30)), where x is amount
- * of time from auction start.
+ * of time from auction start.
*
- * Since we are decaying the denominator the price curve takes on the shape of e^x. Because of the limitations
+ * Since we are decaying the denominator the price curve takes on the shape of e^x. Because of the limitations
* of integer math the denominator can only be decayed to 1. Hence in order to maintain simplicity in calculations
* there is a third segment defined below.
*
@@ -172,7 +172,7 @@ contract LinearAuctionPriceCurve {
.sub(thirtySecondPeriods
.mul(priceDenominator)
.div(MAX_30_SECOND_PERIODS)
- );
+ );
} else {
// Once denominator has fully decayed, fix it at 1
currentPriceDenominator = 1;
diff --git a/contracts/core/modules/ExchangeIssueModule.sol b/contracts/core/modules/ExchangeIssueModule.sol
index 73127fd1c..c74b3989a 100644
--- a/contracts/core/modules/ExchangeIssueModule.sol
+++ b/contracts/core/modules/ExchangeIssueModule.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
@@ -82,11 +82,11 @@ contract ExchangeIssueModule is
*/
function exchangeIssue(
ExchangeIssueLibrary.ExchangeIssueParams memory _exchangeIssueData,
- bytes _orderData
+ bytes memory _orderData
)
public
nonReentrant
- {
+ {
// Ensures validity of exchangeIssue data parameters
validateExchangeIssue(_exchangeIssueData);
@@ -136,7 +136,7 @@ contract ExchangeIssueModule is
* @return paymentTokenUsed Amount of payment token used to execute orders
*/
function executeExchangeOrders(
- bytes _orderData,
+ bytes memory _orderData,
address _paymentTokenAddress
)
private
@@ -213,8 +213,8 @@ contract ExchangeIssueModule is
* @param _paymentTokenAmountUsed Amount of maker token used to source tokens
*/
function assertPostExchangeTokenBalances(
- ExchangeIssueLibrary.ExchangeIssueParams _exchangeIssueData,
- uint256[] _requiredBalances,
+ ExchangeIssueLibrary.ExchangeIssueParams memory _exchangeIssueData,
+ uint256[] memory _requiredBalances,
uint256 _paymentTokenAmountUsed
)
private
@@ -232,7 +232,7 @@ contract ExchangeIssueModule is
_exchangeIssueData.requiredComponents,
_requiredBalances,
msg.sender
- );
+ );
}
/**
@@ -242,11 +242,11 @@ contract ExchangeIssueModule is
* @return uint256[] Expected token balances after order execution
*/
function calculateRequiredTokenBalances(
- ExchangeIssueLibrary.ExchangeIssueParams _exchangeIssueData
+ ExchangeIssueLibrary.ExchangeIssueParams memory _exchangeIssueData
)
private
view
- returns (uint256[])
+ returns (uint256[] memory)
{
// Calculate amount of component tokens required to issue
uint256[] memory requiredBalances = new uint256[](_exchangeIssueData.requiredComponents.length);
@@ -262,9 +262,9 @@ contract ExchangeIssueModule is
// Required vault balances after exchange order executed
requiredBalances[i] = tokenBalance.add(requiredAddition);
- }
+ }
- return requiredBalances;
+ return requiredBalances;
}
/**
@@ -273,7 +273,7 @@ contract ExchangeIssueModule is
* @param _exchangeIssueData Exchange Issue object containing exchange data
*/
function validateExchangeIssue(
- ExchangeIssueLibrary.ExchangeIssueParams _exchangeIssueData
+ ExchangeIssueLibrary.ExchangeIssueParams memory _exchangeIssueData
)
private
view
diff --git a/contracts/core/modules/RebalanceAuctionModule.sol b/contracts/core/modules/RebalanceAuctionModule.sol
index 40b26a24b..5d801bd29 100644
--- a/contracts/core/modules/RebalanceAuctionModule.sol
+++ b/contracts/core/modules/RebalanceAuctionModule.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -38,7 +38,7 @@ contract RebalanceAuctionModule is
ReentrancyGuard
{
using SafeMath for uint256;
-
+
/* ============ Events ============ */
event BidPlaced(
@@ -82,10 +82,13 @@ contract RebalanceAuctionModule is
nonReentrant
{
// Place bid and retrieve token inflows and outflows
+ address[] memory tokenArray;
+ uint256[] memory inflowUnitArray;
+ uint256[] memory outflowUnitArray;
(
- address[] memory tokenArray,
- uint256[] memory inflowUnitArray,
- uint256[] memory outflowUnitArray
+ tokenArray,
+ inflowUnitArray,
+ outflowUnitArray
) = placeBidAndGetTokenFlows(
_rebalancingSetToken,
_quantity
@@ -105,7 +108,7 @@ contract RebalanceAuctionModule is
_rebalancingSetToken,
msg.sender,
outflowUnitArray
- );
+ );
// Log bid placed event
emit BidPlaced(
@@ -129,10 +132,13 @@ contract RebalanceAuctionModule is
nonReentrant
{
// Place bid and retrieve token inflows and outflows
+ address[] memory tokenArray;
+ uint256[] memory inflowUnitArray;
+ uint256[] memory outflowUnitArray;
(
- address[] memory tokenArray,
- uint256[] memory inflowUnitArray,
- uint256[] memory outflowUnitArray
+ tokenArray,
+ inflowUnitArray,
+ outflowUnitArray
) = placeBidAndGetTokenFlows(
_rebalancingSetToken,
_quantity
@@ -208,7 +214,7 @@ contract RebalanceAuctionModule is
msg.sender,
callerBalance
);
-
+
// Transfer token amounts to caller in Vault from Rebalancing Set Token
coreInstance.batchTransferBalanceModule(
combinedTokenArray,
@@ -221,7 +227,7 @@ contract RebalanceAuctionModule is
/* ============ Public Functions ============ */
/**
- * Place bid on Rebalancing Set Token and return token flows.
+ * Place bid on Rebalancing Set Token and return token flows.
*
* @param _rebalancingSetToken Address of the rebalancing token being bid on
* @param _quantity Number of currentSets to rebalance
@@ -234,7 +240,7 @@ contract RebalanceAuctionModule is
uint256 _quantity
)
private
- returns (address[], uint256[], uint256[])
+ returns (address[] memory, uint256[] memory, uint256[] memory)
{
// Make sure the rebalancingSetToken is tracked by Core
require(
diff --git a/contracts/core/modules/RebalancingTokenIssuanceModule.sol b/contracts/core/modules/RebalancingTokenIssuanceModule.sol
index 23e6031dd..4c9c2c795 100644
--- a/contracts/core/modules/RebalancingTokenIssuanceModule.sol
+++ b/contracts/core/modules/RebalancingTokenIssuanceModule.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -111,6 +111,7 @@ contract RebalancingTokenIssuanceModule is
address _baseSetAddress
)
private
+ view
returns (uint256)
{
// Get Base Set Details from the rebalancing Set
@@ -124,7 +125,7 @@ contract RebalancingTokenIssuanceModule is
baseSetBalance % baseSetNaturalUnit == 0,
"RebalancingTokenIssuanceModule.getBaseSetRedeemQuantity: Base Redemption must be multiple of natural unit"
);
-
+
return baseSetBalance;
}
}
diff --git a/contracts/core/modules/lib/ModuleCoreState.sol b/contracts/core/modules/lib/ModuleCoreState.sol
index c2f9ce927..3ca17f1bb 100644
--- a/contracts/core/modules/lib/ModuleCoreState.sol
+++ b/contracts/core/modules/lib/ModuleCoreState.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ICore } from "../../interfaces/ICore.sol";
import { ITransferProxy } from "../../interfaces/ITransferProxy.sol";
diff --git a/contracts/core/tokens/RebalancingSetToken.sol b/contracts/core/tokens/RebalancingSetToken.sol
index f0df034e3..6ee4e889d 100644
--- a/contracts/core/tokens/RebalancingSetToken.sol
+++ b/contracts/core/tokens/RebalancingSetToken.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
@@ -54,7 +54,7 @@ contract RebalancingSetToken is
using AddressArrayUtils for address[];
/* ============ State Variables ============ */
-
+
// Dependency variables
address public core;
address public factory;
@@ -136,8 +136,8 @@ contract RebalancingSetToken is
uint256 _proposalPeriod,
uint256 _rebalanceInterval,
address _componentWhiteList,
- string _name,
- string _symbol
+ string memory _name,
+ string memory _symbol
)
public
ERC20Detailed(
@@ -319,12 +319,14 @@ contract RebalancingSetToken is
uint256 _quantity
)
external
- returns (address[], uint256[], uint256[])
+ returns (address[] memory, uint256[] memory, uint256[] memory)
{
// Place bid and get back inflow and outflow arrays
+ uint256[] memory inflowUnitArray;
+ uint256[] memory outflowUnitArray;
(
- uint256[] memory inflowUnitArray,
- uint256[] memory outflowUnitArray
+ inflowUnitArray,
+ outflowUnitArray
) = StandardPlaceBidLibrary.placeBid(
_quantity,
auctionLibrary,
@@ -348,9 +350,10 @@ contract RebalancingSetToken is
function endFailedAuction()
external
{
+ uint256 calculatedUnitShares;
(
,
- uint256 calculatedUnitShares
+ calculatedUnitShares
) = StandardSettleRebalanceLibrary.calculateNextSetIssueQuantity(
totalSupply(),
naturalUnit,
@@ -388,12 +391,12 @@ contract RebalancingSetToken is
)
public
view
- returns (uint256[], uint256[])
+ returns (uint256[] memory, uint256[] memory)
{
return RebalancingHelperLibrary.getBidPrice(
_quantity,
auctionLibrary,
- biddingParameters,
+ biddingParameters,
auctionParameters,
uint8(rebalanceState)
);
@@ -455,7 +458,7 @@ contract RebalancingSetToken is
// Check to see if state is Drawdown
if (rebalanceState == RebalancingHelperLibrary.State.Drawdown) {
- // In Drawdown Sets can only be burned as part of the withdrawal process
+ // In Drawdown Sets can only be burned as part of the withdrawal process
require(
coreInstance.validModules(msg.sender),
"RebalancingSetToken.burn: Set cannot be redeemed during Drawdown"
@@ -466,7 +469,7 @@ contract RebalancingSetToken is
require(
msg.sender == core,
"RebalancingSetToken.burn: Sender must be core"
- );
+ );
}
_burn(_from, _quantity);
@@ -501,7 +504,7 @@ contract RebalancingSetToken is
function getComponents()
external
view
- returns(address[])
+ returns (address[] memory)
{
address[] memory components = new address[](1);
components[0] = currentSet;
@@ -516,7 +519,7 @@ contract RebalancingSetToken is
function getUnits()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
uint256[] memory units = new uint256[](1);
units[0] = unitShares;
@@ -531,7 +534,7 @@ contract RebalancingSetToken is
function getBiddingParameters()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
uint256[] memory biddingParams = new uint256[](2);
biddingParams[0] = biddingParameters.minimumBid;
@@ -547,7 +550,7 @@ contract RebalancingSetToken is
function getAuctionParameters()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
uint256[] memory auctionParams = new uint256[](4);
auctionParams[0] = auctionParameters.auctionStartTime;
@@ -582,7 +585,7 @@ contract RebalancingSetToken is
function getCombinedTokenArrayLength()
external
view
- returns(uint256)
+ returns (uint256)
{
return biddingParameters.combinedTokenArray.length;
}
@@ -595,7 +598,7 @@ contract RebalancingSetToken is
function getCombinedTokenArray()
external
view
- returns(address[])
+ returns (address[] memory)
{
return biddingParameters.combinedTokenArray;
}
@@ -608,7 +611,7 @@ contract RebalancingSetToken is
function getCombinedCurrentUnits()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
return biddingParameters.combinedCurrentUnits;
}
@@ -621,7 +624,7 @@ contract RebalancingSetToken is
function getCombinedNextSetUnits()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
return biddingParameters.combinedNextSetUnits;
}
diff --git a/contracts/core/tokens/RebalancingSetTokenFactory.sol b/contracts/core/tokens/RebalancingSetTokenFactory.sol
index 25456ea6e..500328d7f 100644
--- a/contracts/core/tokens/RebalancingSetTokenFactory.sol
+++ b/contracts/core/tokens/RebalancingSetTokenFactory.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Bytes32 } from "../../lib/Bytes32.sol";
import { ICore } from "../interfaces/ICore.sol";
@@ -55,11 +55,11 @@ contract RebalancingSetTokenFactory {
// Maximum amount of time before auction pivot can be reached
uint256 public maximumTimeToPivot;
- // Minimum number for the token natural unit
+ // Minimum number for the token natural unit
// The bounds are used for calculations of unitShares and in settlement
uint256 public minimumNaturalUnit;
- // Maximum number for the token natural unit
+ // Maximum number for the token natural unit
uint256 public maximumNaturalUnit;
// ============ Structs ============
@@ -82,8 +82,8 @@ contract RebalancingSetTokenFactory {
* @param _minimumProposalPeriod Minimum amount of time users can review proposals in seconds
* @param _minimumTimeToPivot Minimum amount of time before auction pivot can be reached
* @param _maximumTimeToPivot Maximum amount of time before auction pivot can be reached
- * @param _minimumNaturalUnit Minimum number for the token natural unit
- * @param _maximumNaturalUnit Maximum number for the token natural unit
+ * @param _minimumNaturalUnit Minimum number for the token natural unit
+ * @param _maximumNaturalUnit Maximum number for the token natural unit
*/
constructor(
address _core,
@@ -128,13 +128,13 @@ contract RebalancingSetTokenFactory {
* @param _callData Byte string containing additional call parameters
* @return setToken The address of the newly created SetToken
*/
- function create(
- address[] _components,
- uint256[] _units,
+ function createSet(
+ address[] calldata _components,
+ uint256[] calldata _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol,
- bytes _callData
+ bytes calldata _callData
)
external
returns (address)
@@ -172,24 +172,26 @@ contract RebalancingSetTokenFactory {
);
// Create a new SetToken contract
- return new RebalancingSetToken(
- this,
- parameters.manager,
- startingSet,
- _units[0],
- _naturalUnit,
- parameters.proposalPeriod,
- parameters.rebalanceInterval,
- rebalanceComponentWhitelist,
- _name.bytes32ToString(),
- _symbol.bytes32ToString()
+ return address(
+ new RebalancingSetToken(
+ address(this),
+ parameters.manager,
+ startingSet,
+ _units[0],
+ _naturalUnit,
+ parameters.proposalPeriod,
+ parameters.rebalanceInterval,
+ rebalanceComponentWhitelist,
+ _name.bytes32ToString(),
+ _symbol.bytes32ToString()
+ )
);
}
/* ============ Private Functions ============ */
function parseRebalanceSetCallData(
- bytes _callData
+ bytes memory _callData
)
private
pure
diff --git a/contracts/core/tokens/SetToken.sol b/contracts/core/tokens/SetToken.sol
index 1b37c22ab..c6f9f650f 100644
--- a/contracts/core/tokens/SetToken.sol
+++ b/contracts/core/tokens/SetToken.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { ERC20Detailed } from "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
@@ -65,11 +65,11 @@ contract SetToken is
*/
constructor(
address _factory,
- address[] _components,
- uint256[] _units,
+ address[] memory _components,
+ uint256[] memory _units,
uint256 _naturalUnit,
- string _name,
- string _symbol
+ string memory _name,
+ string memory _symbol
)
public
ERC20Detailed(
@@ -127,7 +127,8 @@ contract SetToken is
// Figure out which of the components has the minimum decimal value
/* solium-disable-next-line security/no-low-level-calls */
- if (currentComponent.call(bytes4(keccak256("decimals()")))) {
+ (bool success, ) = currentComponent.call(abi.encodeWithSignature("decimals()"));
+ if (success) {
currentDecimals = ERC20Detailed(currentComponent).decimals();
minDecimals = currentDecimals < minDecimals ? currentDecimals : minDecimals;
} else {
@@ -214,7 +215,7 @@ contract SetToken is
function getComponents()
external
view
- returns(address[])
+ returns (address[] memory)
{
return components;
}
@@ -227,7 +228,7 @@ contract SetToken is
function getUnits()
external
view
- returns(uint256[])
+ returns (uint256[] memory)
{
return units;
}
diff --git a/contracts/core/tokens/SetTokenFactory.sol b/contracts/core/tokens/SetTokenFactory.sol
index 366fb3ec3..b94f4388d 100644
--- a/contracts/core/tokens/SetTokenFactory.sol
+++ b/contracts/core/tokens/SetTokenFactory.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Bytes32 } from "../../lib/Bytes32.sol";
import { SetToken } from "./SetToken.sol";
@@ -66,13 +66,13 @@ contract SetTokenFactory
* -- Unused callData param used to pass additional information to factories --
* @return setToken The address of the newly created SetToken
*/
- function create(
- address[] _components,
- uint256[] _units,
+ function createSet(
+ address[] calldata _components,
+ uint256[] calldata _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol,
- bytes
+ bytes calldata
)
external
returns (address)
@@ -84,13 +84,15 @@ contract SetTokenFactory
);
// Create a new SetToken contract
- return new SetToken(
- this,
- _components,
- _units,
- _naturalUnit,
- _name.bytes32ToString(),
- _symbol.bytes32ToString()
+ return address(
+ new SetToken(
+ address(this),
+ _components,
+ _units,
+ _naturalUnit,
+ _name.bytes32ToString(),
+ _symbol.bytes32ToString()
+ )
);
}
}
diff --git a/contracts/core/tokens/rebalancing-libraries/StandardFailAuctionLibrary.sol b/contracts/core/tokens/rebalancing-libraries/StandardFailAuctionLibrary.sol
index cdd2d7247..e7e343c9d 100644
--- a/contracts/core/tokens/rebalancing-libraries/StandardFailAuctionLibrary.sol
+++ b/contracts/core/tokens/rebalancing-libraries/StandardFailAuctionLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -55,8 +55,8 @@ library StandardFailAuctionLibrary {
uint256 _calculatedUnitShares,
address _currentSet,
address _coreAddress,
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters,
- StandardStartRebalanceLibrary.BiddingParameters _biddingParameters,
+ RebalancingHelperLibrary.AuctionPriceParameters memory _auctionParameters,
+ StandardStartRebalanceLibrary.BiddingParameters memory _biddingParameters,
uint8 _rebalanceState
)
public
@@ -84,7 +84,7 @@ library StandardFailAuctionLibrary {
* If not enough sets have been bid on then allow auction to fail where no bids being registered
* returns the rebalancing set token to pre-auction state and some bids being registered puts the
* rebalancing set token in Drawdown mode.
- *
+ *
* However, if enough sets have been bid on. Then allow auction to fail and enter Drawdown state if
* and only if the calculated post-auction unitShares is equal to 0.
*/
@@ -108,7 +108,7 @@ library StandardFailAuctionLibrary {
require(
_calculatedUnitShares == 0,
"RebalancingSetToken.endFailedAuction: Cannot be called if rebalance is viably completed"
- );
+ );
// If calculated unitShares equals 0 set to Drawdown state
newRebalanceState = uint8(RebalancingHelperLibrary.State.Drawdown);
@@ -116,4 +116,4 @@ library StandardFailAuctionLibrary {
return newRebalanceState;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/core/tokens/rebalancing-libraries/StandardPlaceBidLibrary.sol b/contracts/core/tokens/rebalancing-libraries/StandardPlaceBidLibrary.sol
index 8849dd464..9779374da 100644
--- a/contracts/core/tokens/rebalancing-libraries/StandardPlaceBidLibrary.sol
+++ b/contracts/core/tokens/rebalancing-libraries/StandardPlaceBidLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -51,12 +51,13 @@ library StandardPlaceBidLibrary {
uint256 _quantity,
address _auctionLibrary,
address _coreAddress,
- StandardStartRebalanceLibrary.BiddingParameters _biddingParameters,
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters,
+ StandardStartRebalanceLibrary.BiddingParameters memory _biddingParameters,
+ RebalancingHelperLibrary.AuctionPriceParameters memory _auctionParameters,
uint8 _rebalanceState
)
public
- returns (uint256[], uint256[])
+ view
+ returns (uint256[] memory, uint256[] memory)
{
// Make sure sender is a module
require(
@@ -83,5 +84,5 @@ library StandardPlaceBidLibrary {
_auctionParameters,
_rebalanceState
);
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/contracts/core/tokens/rebalancing-libraries/StandardProposeLibrary.sol b/contracts/core/tokens/rebalancing-libraries/StandardProposeLibrary.sol
index b6c917d9b..7d968db95 100644
--- a/contracts/core/tokens/rebalancing-libraries/StandardProposeLibrary.sol
+++ b/contracts/core/tokens/rebalancing-libraries/StandardProposeLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -72,7 +72,7 @@ library StandardProposeLibrary {
ProposeAuctionParameters memory _proposeParameters
)
public
- returns (RebalancingHelperLibrary.AuctionPriceParameters)
+ returns (RebalancingHelperLibrary.AuctionPriceParameters memory)
{
ICore coreInstance = ICore(_proposeParameters.coreAddress);
IRebalancingSetFactory factoryInstance = IRebalancingSetFactory(_factoryAddress);
@@ -116,17 +116,17 @@ library StandardProposeLibrary {
coreInstance.validPriceLibraries(_auctionLibrary),
"RebalancingSetToken.propose: Invalid or disabled PriceLibrary address"
);
-
+
// Check that time to pivot is greater than 6 hours
require(
_auctionTimeToPivot > factoryInstance.minimumTimeToPivot(),
- "RebalancingSetToken.propose: Time to pivot must be greater than minimum defined on factory"
+ "RebalancingSetToken.propose: Time to pivot must be greater than minimum defined on factory"
);
// Check that time to pivot is less than 3 days
require(
_auctionTimeToPivot < factoryInstance.maximumTimeToPivot(),
- "RebalancingSetToken.propose: Time to pivot must be greater than maximum defined on factory"
+ "RebalancingSetToken.propose: Time to pivot must be greater than maximum defined on factory"
);
// Check that the propoosed set natural unit is a multiple of current set natural unit, or vice versa.
@@ -140,7 +140,7 @@ library StandardProposeLibrary {
);
// Set auction parameters
- RebalancingHelperLibrary.AuctionPriceParameters memory auctionParameters =
+ RebalancingHelperLibrary.AuctionPriceParameters memory auctionParameters =
RebalancingHelperLibrary.AuctionPriceParameters({
auctionTimeToPivot: _auctionTimeToPivot,
auctionStartPrice: _auctionStartPrice,
@@ -155,4 +155,4 @@ library StandardProposeLibrary {
return auctionParameters;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/core/tokens/rebalancing-libraries/StandardSettleRebalanceLibrary.sol b/contracts/core/tokens/rebalancing-libraries/StandardSettleRebalanceLibrary.sol
index 5f5025790..60b5bfe19 100644
--- a/contracts/core/tokens/rebalancing-libraries/StandardSettleRebalanceLibrary.sol
+++ b/contracts/core/tokens/rebalancing-libraries/StandardSettleRebalanceLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -85,9 +85,11 @@ library StandardSettleRebalanceLibrary {
);
// Calculate next Set quantities
+ uint256 issueAmount;
+ uint256 nextUnitShares;
(
- uint256 issueAmount,
- uint256 nextUnitShares
+ issueAmount,
+ nextUnitShares
) = calculateNextSetIssueQuantity(
_totalSupply,
_naturalUnit,
@@ -136,7 +138,7 @@ library StandardSettleRebalanceLibrary {
_vaultAddress,
setDetails
);
-
+
// Calculate the amount of naturalUnits worth of rebalancingSetToken outstanding
uint256 naturalUnitsOutstanding = _totalSupply.div(_naturalUnit);
@@ -161,7 +163,7 @@ library StandardSettleRebalanceLibrary {
)
public
view
- returns (SetDetails)
+ returns (SetDetails memory)
{
// Create set token interfaces
ISetToken setInstance = ISetToken(_setAddress);
@@ -183,7 +185,7 @@ library StandardSettleRebalanceLibrary {
*/
function calculateMaxIssueAmount(
address _vaultAddress,
- SetDetails _setDetails
+ SetDetails memory _setDetails
)
public
view
@@ -196,7 +198,7 @@ library StandardSettleRebalanceLibrary {
// Get amount of components in vault owned by rebalancingSetToken
uint256 componentAmount = vaultInstance.getOwnerBalance(
_setDetails.setComponents[i],
- this
+ address(this)
);
// Calculate amount of Sets that can be issued from those components, if less than amount for other
@@ -207,6 +209,6 @@ library StandardSettleRebalanceLibrary {
}
}
- return maxIssueAmount;
+ return maxIssueAmount;
}
}
diff --git a/contracts/core/tokens/rebalancing-libraries/StandardStartRebalanceLibrary.sol b/contracts/core/tokens/rebalancing-libraries/StandardStartRebalanceLibrary.sol
index 94f1bd976..77d2f5d49 100644
--- a/contracts/core/tokens/rebalancing-libraries/StandardStartRebalanceLibrary.sol
+++ b/contracts/core/tokens/rebalancing-libraries/StandardStartRebalanceLibrary.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
@@ -83,7 +83,7 @@ library StandardStartRebalanceLibrary {
uint8 _rebalanceState
)
public
- returns (BiddingParameters)
+ returns (BiddingParameters memory)
{
// Must be in "Proposal" state before going into "Rebalance" state
require(
@@ -103,7 +103,7 @@ library StandardStartRebalanceLibrary {
_nextSet,
_auctionLibrary
);
-
+
// Redeem rounded quantity of current Sets and return redeemed amount of Sets
biddingParameters.remainingCurrentSets = redeemCurrentSet(
_currentSet,
@@ -124,7 +124,7 @@ library StandardStartRebalanceLibrary {
/**
* Create struct that holds array representing all components in currentSet and nextSet.
* Calcualate unit difference between both sets relative to the largest natural
- * unit of the two sets. Calculate minimumBid.
+ * unit of the two sets. Calculate minimumBid.
*
* @param _currentSet Address of current Set
* @param _nextSet Address of next Set
@@ -138,7 +138,7 @@ library StandardStartRebalanceLibrary {
)
public
view
- returns (BiddingParameters)
+ returns (BiddingParameters memory)
{
// Get set details for currentSet and nextSet (units, components, natural units)
SetsDetails memory setsDetails = getUnderlyingSetsDetails(
@@ -160,9 +160,11 @@ library StandardStartRebalanceLibrary {
// Create memory version of combinedNextSetUnits and combinedCurrentUnits to only make one
// call to storage once arrays have been created
+ uint256[] memory combinedCurrentUnits;
+ uint256[] memory combinedNextSetUnits;
(
- uint256[] memory combinedCurrentUnits,
- uint256[] memory combinedNextSetUnits
+ combinedCurrentUnits,
+ combinedNextSetUnits
) = calculateCombinedUnitArrays(
setsDetails,
minimumBid,
@@ -193,7 +195,7 @@ library StandardStartRebalanceLibrary {
)
public
view
- returns (SetsDetails)
+ returns (SetsDetails memory)
{
// Create set token interfaces
ISetToken currentSetInstance = ISetToken(_currentSet);
@@ -247,14 +249,14 @@ library StandardStartRebalanceLibrary {
* @return Unit inflow/outflow arrays for current and next Set
*/
function calculateCombinedUnitArrays(
- SetsDetails _setsDetails,
+ SetsDetails memory _setsDetails,
uint256 _minimumBid,
address _auctionLibrary,
- address[] _combinedTokenArray
+ address[] memory _combinedTokenArray
)
public
view
- returns (uint256[], uint256[])
+ returns (uint256[] memory, uint256[] memory)
{
// Create memory version of combinedNextSetUnits and combinedCurrentUnits to only make one
// call to storage once arrays have been created
@@ -263,8 +265,13 @@ library StandardStartRebalanceLibrary {
for (uint256 i = 0; i < _combinedTokenArray.length; i++) {
// Check if component in arrays and get index if it is
- (uint256 indexCurrent, bool isInCurrent) = _setsDetails.currentSetComponents.indexOf(_combinedTokenArray[i]);
- (uint256 indexRebalance, bool isInNext) = _setsDetails.nextSetComponents.indexOf(_combinedTokenArray[i]);
+ uint256 indexCurrent;
+ bool isInCurrent;
+ (indexCurrent, isInCurrent) = _setsDetails.currentSetComponents.indexOf(_combinedTokenArray[i]);
+
+ uint256 indexRebalance;
+ bool isInNext;
+ (indexRebalance, isInNext) = _setsDetails.nextSetComponents.indexOf(_combinedTokenArray[i]);
// Compute and push unit amounts of token in currentSet
if (isInCurrent) {
@@ -310,7 +317,7 @@ library StandardStartRebalanceLibrary {
// Get remainingCurrentSets and make it divisible by currentSet natural unit
uint256 currentSetBalance = IVault(_vaultAddress).getOwnerBalance(
_currentSet,
- this
+ address(this)
);
// Calculates the set's natural unit
@@ -326,4 +333,4 @@ library StandardStartRebalanceLibrary {
return remainingCurrentSets;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/0x/AssetProxy/interfaces/IAssetData.sol b/contracts/external/0x/AssetProxy/interfaces/IAssetData.sol
index 2229477ae..f7e2b0b6e 100644
--- a/contracts/external/0x/AssetProxy/interfaces/IAssetData.sol
+++ b/contracts/external/0x/AssetProxy/interfaces/IAssetData.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
// @dev Interface of the asset proxy's assetData.
// The asset proxies take an ABI encoded `bytes assetData` as argument.
@@ -30,7 +30,7 @@ interface IAssetData {
function ERC721Token(
address tokenContract,
uint256 tokenId,
- bytes receiverData)
+ bytes calldata receiverData)
external pure;
}
diff --git a/contracts/external/0x/AssetProxy/interfaces/IAssetProxy.sol b/contracts/external/0x/AssetProxy/interfaces/IAssetProxy.sol
index 02896cebd..fc55f9457 100644
--- a/contracts/external/0x/AssetProxy/interfaces/IAssetProxy.sol
+++ b/contracts/external/0x/AssetProxy/interfaces/IAssetProxy.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
import "./IAuthorizable.sol";
@@ -31,7 +31,7 @@ contract IAssetProxy is
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFrom(
- bytes assetData,
+ bytes calldata assetData,
address from,
address to,
uint256 amount
diff --git a/contracts/external/0x/AssetProxy/interfaces/IAuthorizable.sol b/contracts/external/0x/AssetProxy/interfaces/IAuthorizable.sol
index 20038dcec..0da689042 100644
--- a/contracts/external/0x/AssetProxy/interfaces/IAuthorizable.sol
+++ b/contracts/external/0x/AssetProxy/interfaces/IAuthorizable.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
/*
@@ -40,7 +40,7 @@ contract IAuthorizable is
function getAuthorizedAddresses()
external
view
- returns (address[]);
+ returns (address[] memory);
/// @dev Authorizes an address.
/// @param target Address to authorize.
diff --git a/contracts/external/0x/AssetProxy/libs/LibAssetProxyErrors.sol b/contracts/external/0x/AssetProxy/libs/LibAssetProxyErrors.sol
index c746bebfb..4c53f45d6 100644
--- a/contracts/external/0x/AssetProxy/libs/LibAssetProxyErrors.sol
+++ b/contracts/external/0x/AssetProxy/libs/LibAssetProxyErrors.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/// @dev This contract documents the revert reasons used in the AssetProxy contracts.
/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
diff --git a/contracts/external/0x/Exchange/interfaces/IAssetProxyDispatcher.sol b/contracts/external/0x/Exchange/interfaces/IAssetProxyDispatcher.sol
index d73e9bd43..73368072d 100644
--- a/contracts/external/0x/Exchange/interfaces/IAssetProxyDispatcher.sol
+++ b/contracts/external/0x/Exchange/interfaces/IAssetProxyDispatcher.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract IAssetProxyDispatcher {
diff --git a/contracts/external/0x/Exchange/interfaces/IExchange.sol b/contracts/external/0x/Exchange/interfaces/IExchange.sol
index 12f299f83..f4e978771 100644
--- a/contracts/external/0x/Exchange/interfaces/IExchange.sol
+++ b/contracts/external/0x/Exchange/interfaces/IExchange.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
import "./IExchangeCore.sol";
diff --git a/contracts/external/0x/Exchange/interfaces/IExchangeCore.sol b/contracts/external/0x/Exchange/interfaces/IExchangeCore.sol
index 15fa4e3ae..e8d878689 100644
--- a/contracts/external/0x/Exchange/interfaces/IExchangeCore.sol
+++ b/contracts/external/0x/Exchange/interfaces/IExchangeCore.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";
diff --git a/contracts/external/0x/Exchange/interfaces/IMatchOrders.sol b/contracts/external/0x/Exchange/interfaces/IMatchOrders.sol
index 61be1880a..53c45e695 100644
--- a/contracts/external/0x/Exchange/interfaces/IMatchOrders.sol
+++ b/contracts/external/0x/Exchange/interfaces/IMatchOrders.sol
@@ -15,7 +15,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";
diff --git a/contracts/external/0x/Exchange/interfaces/ISignatureValidator.sol b/contracts/external/0x/Exchange/interfaces/ISignatureValidator.sol
index 011f48b2f..3ab854687 100644
--- a/contracts/external/0x/Exchange/interfaces/ISignatureValidator.sol
+++ b/contracts/external/0x/Exchange/interfaces/ISignatureValidator.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract ISignatureValidator {
@@ -27,7 +27,7 @@ contract ISignatureValidator {
function preSign(
bytes32 hash,
address signerAddress,
- bytes signature
+ bytes calldata signature
)
external;
diff --git a/contracts/external/0x/Exchange/interfaces/ITransactions.sol b/contracts/external/0x/Exchange/interfaces/ITransactions.sol
index c520b30e3..160530a12 100644
--- a/contracts/external/0x/Exchange/interfaces/ITransactions.sol
+++ b/contracts/external/0x/Exchange/interfaces/ITransactions.sol
@@ -15,7 +15,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract ITransactions {
@@ -27,8 +27,8 @@ contract ITransactions {
function executeTransaction(
uint256 salt,
address signerAddress,
- bytes data,
- bytes signature
+ bytes calldata data,
+ bytes calldata signature
)
external;
}
diff --git a/contracts/external/0x/Exchange/interfaces/IValidator.sol b/contracts/external/0x/Exchange/interfaces/IValidator.sol
index cfa92ae7b..01c076594 100644
--- a/contracts/external/0x/Exchange/interfaces/IValidator.sol
+++ b/contracts/external/0x/Exchange/interfaces/IValidator.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract IValidator {
@@ -28,7 +28,7 @@ contract IValidator {
function isValidSignature(
bytes32 hash,
address signerAddress,
- bytes signature
+ bytes calldata signature
)
external
view
diff --git a/contracts/external/0x/Exchange/interfaces/IWallet.sol b/contracts/external/0x/Exchange/interfaces/IWallet.sol
index e7d638af0..422178793 100644
--- a/contracts/external/0x/Exchange/interfaces/IWallet.sol
+++ b/contracts/external/0x/Exchange/interfaces/IWallet.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract IWallet {
@@ -26,7 +26,7 @@ contract IWallet {
/// @return Validity of order signature.
function isValidSignature(
bytes32 hash,
- bytes signature
+ bytes calldata signature
)
external
view
diff --git a/contracts/external/0x/Exchange/interfaces/IWrapperFunctions.sol b/contracts/external/0x/Exchange/interfaces/IWrapperFunctions.sol
index d23ee561b..fbca8c1ad 100644
--- a/contracts/external/0x/Exchange/interfaces/IWrapperFunctions.sol
+++ b/contracts/external/0x/Exchange/interfaces/IWrapperFunctions.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";
diff --git a/contracts/external/0x/Exchange/libs/LibConstants.sol b/contracts/external/0x/Exchange/libs/LibConstants.sol
index 128898362..dd48b23d3 100644
--- a/contracts/external/0x/Exchange/libs/LibConstants.sol
+++ b/contracts/external/0x/Exchange/libs/LibConstants.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract LibConstants {
diff --git a/contracts/external/0x/Exchange/libs/LibEIP712.sol b/contracts/external/0x/Exchange/libs/LibEIP712.sol
index 7a5ffaa79..3fb3a0c27 100644
--- a/contracts/external/0x/Exchange/libs/LibEIP712.sol
+++ b/contracts/external/0x/Exchange/libs/LibEIP712.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract LibEIP712 {
// EIP191 header for EIP712 prefix
diff --git a/contracts/external/0x/Exchange/libs/LibExchangeErrors.sol b/contracts/external/0x/Exchange/libs/LibExchangeErrors.sol
index abdf6dc99..9a3c3f02c 100644
--- a/contracts/external/0x/Exchange/libs/LibExchangeErrors.sol
+++ b/contracts/external/0x/Exchange/libs/LibExchangeErrors.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/// @dev This contract documents the revert reasons used in the Exchange contract.
/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
diff --git a/contracts/external/0x/Exchange/libs/LibFillResults.sol b/contracts/external/0x/Exchange/libs/LibFillResults.sol
index 707c8d7ab..bec267709 100644
--- a/contracts/external/0x/Exchange/libs/LibFillResults.sol
+++ b/contracts/external/0x/Exchange/libs/LibFillResults.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract LibFillResults
{
diff --git a/contracts/external/0x/Exchange/libs/LibOrder.sol b/contracts/external/0x/Exchange/libs/LibOrder.sol
index f1465f2f9..b65ae539c 100644
--- a/contracts/external/0x/Exchange/libs/LibOrder.sol
+++ b/contracts/external/0x/Exchange/libs/LibOrder.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "./LibEIP712.sol";
diff --git a/contracts/external/0x/LibBytes.sol b/contracts/external/0x/LibBytes.sol
index b01a810eb..4225147a9 100644
--- a/contracts/external/0x/LibBytes.sol
+++ b/contracts/external/0x/LibBytes.sol
@@ -11,7 +11,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
library LibBytes {
diff --git a/contracts/external/DappHub/auth.sol b/contracts/external/DappHub/auth.sol
index 811d0a325..fa9ea2500 100644
--- a/contracts/external/DappHub/auth.sol
+++ b/contracts/external/DappHub/auth.sol
@@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract DSAuthority {
function canCall(
@@ -46,7 +46,7 @@ contract DSAuth is DSAuthEvents {
auth
{
authority = authority_;
- emit LogSetAuthority(authority);
+ emit LogSetAuthority(address(authority));
}
modifier auth {
@@ -62,7 +62,7 @@ contract DSAuth is DSAuthEvents {
} else if (authority == DSAuthority(0)) {
return false;
} else {
- return authority.canCall(src, this, sig);
+ return authority.canCall(src, address(this), sig);
}
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/DappHub/feed-factory.sol b/contracts/external/DappHub/feed-factory.sol
index e5cbb2bb8..1b43e8a9f 100644
--- a/contracts/external/DappHub/feed-factory.sol
+++ b/contracts/external/DappHub/feed-factory.sol
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "./price-feed.sol";
@@ -27,7 +27,7 @@ contract FeedFactory {
PriceFeed feed = new PriceFeed();
emit Created(msg.sender, address(feed));
feed.setOwner(msg.sender);
- isFeed[feed] = true;
+ isFeed[address(feed)] = true;
return feed;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/DappHub/interfaces/IMedian.sol b/contracts/external/DappHub/interfaces/IMedian.sol
index 601c99c6d..fe971cef4 100644
--- a/contracts/external/DappHub/interfaces/IMedian.sol
+++ b/contracts/external/DappHub/interfaces/IMedian.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
@@ -31,7 +31,7 @@ interface IMedian {
* @return Current price of asset represented in hex as bytes32
*/
function read()
- public
+ external
view
returns (bytes32);
@@ -41,7 +41,7 @@ interface IMedian {
* @return Current price of asset represented in hex as bytes32, and whether value is non-zero
*/
function peek()
- public
+ external
view
returns (bytes32, bool);
}
diff --git a/contracts/external/DappHub/math.sol b/contracts/external/DappHub/math.sol
index 9f3efaa1e..9bce567d8 100644
--- a/contracts/external/DappHub/math.sol
+++ b/contracts/external/DappHub/math.sol
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
@@ -81,4 +81,4 @@ contract DSMath {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/DappHub/median.sol b/contracts/external/DappHub/median.sol
index 039fbeb07..2a89b8aa1 100644
--- a/contracts/external/DappHub/median.sol
+++ b/contracts/external/DappHub/median.sol
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "./thing.sol";
@@ -23,7 +23,7 @@ contract Median is DSAuth {
uint128 val;
uint48 public age;
-
+
bytes32 public wat = "ETHUSD";
uint256 public min; // minimum valid feeds
@@ -34,11 +34,11 @@ contract Median is DSAuth {
function read() public view returns (bytes32) {
require(val > 0, "Invalid price feed");
- return bytes32(val);
+ return bytes32(uint256(val));
}
function peek() public view returns (bytes32,bool) {
- return (bytes32(val), val > 0);
+ return (bytes32(uint256(val)), val > 0);
}
function recover(uint256 val_, uint256 age_, uint8 v, bytes32 r, bytes32 s, bytes32 wat_) internal pure returns (address) {
@@ -49,8 +49,8 @@ contract Median is DSAuth {
}
function poke(
- uint256[] val_, uint256[] age_,
- uint8[] v, bytes32[] r, bytes32[] s) external
+ uint256[] calldata val_, uint256[] calldata age_,
+ uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) external
{
uint256 l = val_.length;
require(l >= min, "Not enough signed messages");
@@ -72,14 +72,14 @@ contract Median is DSAuth {
if ((i + 1) < l) {
// require(val_[i] <= val_[i + 1], "Messages not in order");
}
-
+
// Check for uniqueness (TODO: is this the best we can do?)
for (uint j = 0; j < i; j++) {
require(signers[j] != signer, "Oracle already signed");
}
signers[i] = signer;
}
-
+
// Write the value and timestamp to storage
// require(med_ == val_[(l - 1) / 2], "Sanity check fail");
val = uint128(val_[(l - 1) / 2]);
@@ -89,7 +89,7 @@ contract Median is DSAuth {
}
function lift(address a) public auth {
- require(a != 0x0, "No oracle 0");
+ require(a != address(0x0), "No oracle 0");
orcl[a] = true;
}
@@ -102,4 +102,4 @@ contract Median is DSAuth {
min = min_;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/DappHub/note.sol b/contracts/external/DappHub/note.sol
index 08d9b865b..28b1a49db 100644
--- a/contracts/external/DappHub/note.sol
+++ b/contracts/external/DappHub/note.sol
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
contract DSNote {
event LogNote(
@@ -34,8 +34,13 @@ contract DSNote {
bar := calldataload(36)
}
- emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);
+ emit LogNote(msg.sig, msg.sender, foo, bar, getValue(), msg.data);
_;
}
-}
\ No newline at end of file
+
+ function getValue() internal view returns (uint256)
+ {
+ return msg.value;
+ }
+}
diff --git a/contracts/external/DappHub/price-feed.sol b/contracts/external/DappHub/price-feed.sol
index 2a655f69f..70e20a2fc 100644
--- a/contracts/external/DappHub/price-feed.sol
+++ b/contracts/external/DappHub/price-feed.sol
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "./thing.sol";
@@ -30,13 +30,13 @@ contract PriceFeed is DSThing {
function peek() external view returns (bytes32,bool)
{
- return (bytes32(val), now < zzz);
+ return (bytes32(uint256(val)), now < zzz);
}
function read() external view returns (bytes32)
{
require(now < zzz);
- return bytes32(val);
+ return bytes32(uint256(val));
}
function poke(uint128 val_, uint32 zzz_) external note auth
@@ -57,4 +57,4 @@ contract PriceFeed is DSThing {
zzz = 0;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/DappHub/thing.sol b/contracts/external/DappHub/thing.sol
index a464d9d73..03bad8110 100644
--- a/contracts/external/DappHub/thing.sol
+++ b/contracts/external/DappHub/thing.sol
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity ^0.4.23;
+pragma solidity ^0.5.4;
import './auth.sol';
import './note.sol';
@@ -23,8 +23,8 @@ import './math.sol';
contract DSThing is DSAuth, DSNote, DSMath {
- function S(string s) internal pure returns (bytes4) {
+ function S(string memory s) internal pure returns (bytes4) {
return bytes4(keccak256(abi.encodePacked(s)));
}
-}
\ No newline at end of file
+}
diff --git a/contracts/external/KyberNetwork/KyberNetworkProxyInterface.sol b/contracts/external/KyberNetwork/KyberNetworkProxyInterface.sol
index 864ac3267..c5e33bcf4 100644
--- a/contracts/external/KyberNetwork/KyberNetworkProxyInterface.sol
+++ b/contracts/external/KyberNetwork/KyberNetworkProxyInterface.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/// @title Kyber Network interface
@@ -23,5 +23,5 @@ interface KyberNetworkProxyInterface {
)
external
payable
- returns(uint);
+ returns (uint);
}
diff --git a/contracts/lib/AddressArrayUtils.sol b/contracts/lib/AddressArrayUtils.sol
index 051e1c75e..b6ba16c6d 100644
--- a/contracts/lib/AddressArrayUtils.sol
+++ b/contracts/lib/AddressArrayUtils.sol
@@ -1,7 +1,7 @@
// Pulled in from Cryptofin Solidity package in order to control Solidity compiler version
// https://github.com/cryptofinlabs/cryptofin-solidity/blob/master/contracts/array-utils/AddressArrayUtils.sol
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
library AddressArrayUtils {
@@ -29,13 +29,14 @@ library AddressArrayUtils {
* @return Returns isIn for the first occurrence starting from index 0
*/
function contains(address[] memory A, address a) internal pure returns (bool) {
- (, bool isIn) = indexOf(A, a);
+ bool isIn;
+ (, isIn) = indexOf(A, a);
return isIn;
}
/// @return Returns index and isIn for the first occurrence starting from
/// end
- function indexOfFromEnd(address[] A, address a) internal pure returns (uint256, bool) {
+ function indexOfFromEnd(address[] memory A, address a) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i = length; i > 0; i--) {
if (A[i - 1] == a) {
@@ -58,8 +59,8 @@ library AddressArrayUtils {
for (uint256 i = 0; i < aLength; i++) {
newAddresses[i] = A[i];
}
- for (i = 0; i < bLength; i++) {
- newAddresses[aLength + i] = B[i];
+ for (uint256 j = 0; j < bLength; j++) {
+ newAddresses[aLength + j] = B[j];
}
return newAddresses;
}
@@ -71,12 +72,11 @@ library AddressArrayUtils {
* @return Returns A appended by a
*/
function append(address[] memory A, address a) internal pure returns (address[] memory) {
- uint256 lengthA = A.length;
- address[] memory newAddresses = new address[](lengthA + 1);
- for (uint256 i = 0; i < lengthA; i++) {
+ address[] memory newAddresses = new address[](A.length + 1);
+ for (uint256 i = 0; i < A.length; i++) {
newAddresses[i] = A[i];
}
- newAddresses[lengthA] = a;
+ newAddresses[A.length] = a;
return newAddresses;
}
@@ -111,9 +111,9 @@ library AddressArrayUtils {
}
address[] memory newAddresses = new address[](newLength);
uint256 j = 0;
- for (i = 0; i < length; i++) {
- if (includeMap[i]) {
- newAddresses[j] = A[i];
+ for (uint256 k = 0; k < length; k++) {
+ if (includeMap[k]) {
+ newAddresses[j] = A[k];
j++;
}
}
@@ -138,33 +138,30 @@ library AddressArrayUtils {
* Assumes there are no duplicates
*/
function unionB(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
- uint256 lengthA = A.length;
- uint256 lengthB = lengthB;
- bool[] memory includeMap = new bool[](lengthA + lengthB);
- uint256 i = 0;
+ bool[] memory includeMap = new bool[](A.length + B.length);
uint256 count = 0;
- for (i = 0; i < lengthA; i++) {
+ for (uint256 i = 0; i < A.length; i++) {
includeMap[i] = true;
count++;
}
- for (i = 0; i < lengthB; i++) {
- if (!contains(A, B[i])) {
- includeMap[lengthA + i] = true;
+ for (uint256 j = 0; j < B.length; j++) {
+ if (!contains(A, B[j])) {
+ includeMap[A.length + j] = true;
count++;
}
}
address[] memory newAddresses = new address[](count);
- uint256 j = 0;
- for (i = 0; i < lengthA; i++) {
- if (includeMap[i]) {
- newAddresses[j] = A[i];
- j++;
+ uint256 k = 0;
+ for (uint256 m = 0; m < A.length; m++) {
+ if (includeMap[m]) {
+ newAddresses[k] = A[m];
+ k++;
}
}
- for (i = 0; i < lengthB; i++) {
- if (includeMap[lengthA + i]) {
- newAddresses[j] = B[i];
- j++;
+ for (uint256 n = 0; n < B.length; n++) {
+ if (includeMap[A.length + n]) {
+ newAddresses[k] = B[n];
+ k++;
}
}
return newAddresses;
@@ -190,9 +187,9 @@ library AddressArrayUtils {
}
address[] memory newAddresses = new address[](count);
uint256 j = 0;
- for (i = 0; i < length; i++) {
- if (includeMap[i]) {
- newAddresses[j] = A[i];
+ for (uint256 k = 0; k < length; k++) {
+ if (includeMap[k]) {
+ newAddresses[j] = A[k];
j++;
}
}
@@ -227,8 +224,8 @@ library AddressArrayUtils {
for (uint256 i = 0; i < index; i++) {
newAddresses[i] = A[i];
}
- for (i = index + 1; i < length; i++) {
- newAddresses[i - 1] = A[i];
+ for (uint256 j = index + 1; j < length; j++) {
+ newAddresses[j - 1] = A[j];
}
return (newAddresses, A[index]);
}
@@ -242,20 +239,19 @@ library AddressArrayUtils {
returns (address[] memory)
{
(uint256 index, bool isIn) = indexOf(A, a);
-
- require(isIn);
- (address[] memory _A,) = pop(A, index);
- return _A;
+ if (!isIn) {
+ revert();
+ } else {
+ (address[] memory _A,) = pop(A, index);
+ return _A;
+ }
}
function sPop(address[] storage A, uint256 index) internal returns (address) {
uint256 length = A.length;
-
- require(
- index < length,
- "Error: index out of bounds"
- );
-
+ if (index >= length) {
+ revert("Error: index out of bounds");
+ }
address entry = A[index];
for (uint256 i = index; i < length - 1; i++) {
A[i] = A[i + 1];
@@ -271,10 +267,9 @@ library AddressArrayUtils {
*/
function sPopCheap(address[] storage A, uint256 index) internal returns (address) {
uint256 length = A.length;
- require(
- index < length,
- "Error: index out of bounds"
- );
+ if (index >= length) {
+ revert("Error: index out of bounds");
+ }
address entry = A[index];
if (index != length - 1) {
A[index] = A[length - 1];
@@ -305,9 +300,8 @@ library AddressArrayUtils {
* @return Returns true if duplicate, false otherwise
*/
function hasDuplicate(address[] memory A) internal pure returns (bool) {
- uint256 length = A.length;
- for (uint256 i = 0; i < length - 1; i++) {
- for (uint256 j = i + 1; j < length; j++) {
+ for (uint256 i = 0; i < A.length - 1; i++) {
+ for (uint256 j = i + 1; j < A.length; j++) {
if (A[i] == A[j]) {
return true;
}
@@ -323,11 +317,10 @@ library AddressArrayUtils {
* @return True is the arrays are equal, false if not.
*/
function isEqual(address[] memory A, address[] memory B) internal pure returns (bool) {
- uint256 lengthA = A.length;
- if (lengthA != B.length) {
+ if (A.length != B.length) {
return false;
}
- for (uint256 i = 0; i < lengthA; i++) {
+ for (uint256 i = 0; i < A.length; i++) {
if (A[i] != B[i]) {
return false;
}
@@ -346,9 +339,8 @@ library AddressArrayUtils {
pure
returns (address[] memory)
{
- uint256 indices = indexArray.length;
- address[] memory array = new address[](indices);
- for (uint256 i = 0; i < indices; i++) {
+ address[] memory array = new address[](indexArray.length);
+ for (uint256 i = 0; i < indexArray.length; i++) {
array[i] = A[indexArray[i]];
}
return array;
diff --git a/contracts/lib/Authorizable.sol b/contracts/lib/Authorizable.sol
index 8d9c3f40f..b7bebe989 100644
--- a/contracts/lib/Authorizable.sol
+++ b/contracts/lib/Authorizable.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
diff --git a/contracts/lib/Bytes32.sol b/contracts/lib/Bytes32.sol
index 864cbabb8..2a079ca14 100644
--- a/contracts/lib/Bytes32.sol
+++ b/contracts/lib/Bytes32.sol
@@ -14,17 +14,17 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
library Bytes32 {
function bytes32ToBytes(bytes32 data)
internal
pure
- returns (bytes)
+ returns (bytes memory)
{
uint256 i = 0;
- while (i < 32 && uint256(data[i]) != 0) {
+ while (i < 32 && uint256(bytes32(data[i])) != 0) {
++i;
}
bytes memory result = new bytes(i);
@@ -39,7 +39,7 @@ library Bytes32 {
function bytes32ToString(bytes32 test)
internal
pure
- returns(string)
+ returns (string memory)
{
bytes memory intermediate = bytes32ToBytes(test);
return string(abi.encodePacked(intermediate));
diff --git a/contracts/lib/CommonMath.sol b/contracts/lib/CommonMath.sol
index 3b1767a9f..0146927f6 100644
--- a/contracts/lib/CommonMath.sol
+++ b/contracts/lib/CommonMath.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
diff --git a/contracts/lib/ERC20Wrapper.sol b/contracts/lib/ERC20Wrapper.sol
index 6cd052630..9deece9fb 100644
--- a/contracts/lib/ERC20Wrapper.sol
+++ b/contracts/lib/ERC20Wrapper.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { CommonMath } from "./CommonMath.sol";
import { IERC20 } from "./IERC20.sol";
diff --git a/contracts/lib/IERC20.sol b/contracts/lib/IERC20.sol
index 2a623844d..b70ac02f3 100644
--- a/contracts/lib/IERC20.sol
+++ b/contracts/lib/IERC20.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
diff --git a/contracts/lib/IWETH.sol b/contracts/lib/IWETH.sol
index cd78fc736..711a26852 100644
--- a/contracts/lib/IWETH.sol
+++ b/contracts/lib/IWETH.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
/**
diff --git a/contracts/lib/TimeLockUpgrade.sol b/contracts/lib/TimeLockUpgrade.sol
index b50b0e52f..d0615e8f6 100644
--- a/contracts/lib/TimeLockUpgrade.sol
+++ b/contracts/lib/TimeLockUpgrade.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -106,7 +106,7 @@ contract TimeLockUpgrade is
{
// Only allow setting of the timeLockPeriod the first time
if (timeLockPeriod == 0) {
- timeLockPeriod = _timeLockPeriod;
+ timeLockPeriod = _timeLockPeriod;
}
}
}
diff --git a/contracts/lib/WhiteList.sol b/contracts/lib/WhiteList.sol
index 643dce7f6..9d591cbfc 100644
--- a/contracts/lib/WhiteList.sol
+++ b/contracts/lib/WhiteList.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
@@ -60,7 +60,7 @@ contract WhiteList is
* @param _initialAddresses Starting set of addresses to whitelist
*/
constructor(
- address[] _initialAddresses
+ address[] memory _initialAddresses
)
public
{
@@ -134,7 +134,7 @@ contract WhiteList is
function validAddresses()
external
view
- returns(address[])
+ returns (address[] memory)
{
return addresses;
}
@@ -146,11 +146,11 @@ contract WhiteList is
* @return bool Whether all addresses in the list are whitelsited
*/
function areValidAddresses(
- address[] _addresses
+ address[] calldata _addresses
)
external
view
- returns(bool)
+ returns (bool)
{
for (uint256 i = 0; i < _addresses.length; i++) {
if (!whiteList[_addresses[i]]) {
diff --git a/contracts/mocks/core/CoreMock.sol b/contracts/mocks/core/CoreMock.sol
index 4863804a5..2fe5a96ee 100644
--- a/contracts/mocks/core/CoreMock.sol
+++ b/contracts/mocks/core/CoreMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Core } from "../../core/Core.sol";
import { IRebalancingSetToken } from "../../core/interfaces/IRebalancingSetToken.sol";
diff --git a/contracts/mocks/core/exchange-wrappers/lib/ZeroExOrderDataHandlerMock.sol b/contracts/mocks/core/exchange-wrappers/lib/ZeroExOrderDataHandlerMock.sol
index 99b09ed44..8058f0392 100644
--- a/contracts/mocks/core/exchange-wrappers/lib/ZeroExOrderDataHandlerMock.sol
+++ b/contracts/mocks/core/exchange-wrappers/lib/ZeroExOrderDataHandlerMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -13,7 +13,7 @@ contract ZeroExOrderDataHandlerMock {
using LibBytes for bytes;
function parseOrderHeader(
- bytes _ordersData,
+ bytes calldata _ordersData,
uint256 _offset
)
external
@@ -29,14 +29,14 @@ contract ZeroExOrderDataHandlerMock {
}
function parseZeroExOrder(
- bytes _ordersData,
+ bytes calldata _ordersData,
address _makerTokenAddress,
address _takerTokenAddress,
uint256 _offset
)
external
pure
- returns(address[4], uint256[6], bytes, bytes)
+ returns (address[4] memory, uint256[6] memory, bytes memory, bytes memory)
{
ZeroExOrderDataHandler.OrderHeader memory header = ZeroExOrderDataHandler.parseOrderHeader(
_ordersData,
diff --git a/contracts/mocks/core/lib/ConstantAuctionPriceCurve.sol b/contracts/mocks/core/lib/ConstantAuctionPriceCurve.sol
index 53325dd55..410fdb47f 100644
--- a/contracts/mocks/core/lib/ConstantAuctionPriceCurve.sol
+++ b/contracts/mocks/core/lib/ConstantAuctionPriceCurve.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -60,7 +60,7 @@ contract ConstantAuctionPriceCurve {
* @param _auctionPriceParameters Struct containing relevant auction price parameters
*/
function validateAuctionPriceParameters(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters memory _auctionParameters
)
public
view
@@ -82,12 +82,12 @@ contract ConstantAuctionPriceCurve {
/*
* Calculate the current priceRatio for an auction given defined price and time parameters
*
- * @param _auctionPriceParameters Struct containing relevant auction price parameters
+ * -- Unused _auctionPriceParameters param containing relevant auction price parameters --
* @return uint256 The auction price numerator
* @return uint256 The auction price denominator
*/
function getCurrentPrice(
- RebalancingHelperLibrary.AuctionPriceParameters _auctionParameters
+ RebalancingHelperLibrary.AuctionPriceParameters memory
)
public
view
diff --git a/contracts/mocks/core/lib/UpdatableConstantAuctionPriceCurve.sol b/contracts/mocks/core/lib/UpdatableConstantAuctionPriceCurve.sol
index 79ae8d515..def7e1a1d 100644
--- a/contracts/mocks/core/lib/UpdatableConstantAuctionPriceCurve.sol
+++ b/contracts/mocks/core/lib/UpdatableConstantAuctionPriceCurve.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -55,4 +55,4 @@ contract UpdatableConstantAuctionPriceCurve is ConstantAuctionPriceCurve {
{
priceNumerator = _newPrice;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/mocks/core/modules/RebalanceAuctionModuleMock.sol b/contracts/mocks/core/modules/RebalanceAuctionModuleMock.sol
index c3ab3de2f..cef3c255d 100644
--- a/contracts/mocks/core/modules/RebalanceAuctionModuleMock.sol
+++ b/contracts/mocks/core/modules/RebalanceAuctionModuleMock.sol
@@ -1,9 +1,9 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { RebalanceAuctionModule } from "../../../core/modules/RebalanceAuctionModule.sol";
import { IRebalancingSetToken } from "../../../core/interfaces/IRebalancingSetToken.sol";
-contract RebalanceAuctionModuleMock is
+contract RebalanceAuctionModuleMock is
RebalanceAuctionModule
{
constructor(
diff --git a/contracts/mocks/lib/Bytes32Mock.sol b/contracts/mocks/lib/Bytes32Mock.sol
index 2ea3a82ef..bf3f26131 100644
--- a/contracts/mocks/lib/Bytes32Mock.sol
+++ b/contracts/mocks/lib/Bytes32Mock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import { Bytes32 } from "../../lib/Bytes32.sol";
@@ -6,7 +6,7 @@ contract Bytes32Mock {
function testBytes32ToBytes(bytes32 data)
external
pure
- returns(bytes)
+ returns (bytes memory)
{
return Bytes32.bytes32ToBytes(data);
}
@@ -14,7 +14,7 @@ contract Bytes32Mock {
function testBytes32ToString(bytes32 data)
external
pure
- returns(string)
+ returns (string memory)
{
return Bytes32.bytes32ToString(data);
}
diff --git a/contracts/mocks/lib/CommonMathMock.sol b/contracts/mocks/lib/CommonMathMock.sol
index 25ce862ae..e97802a46 100644
--- a/contracts/mocks/lib/CommonMathMock.sol
+++ b/contracts/mocks/lib/CommonMathMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { CommonMath } from "../../lib/CommonMath.sol";
@@ -8,7 +8,7 @@ contract CommonMathMock {
function testMaxUInt256()
external
pure
- returns(uint256)
+ returns (uint256)
{
return CommonMath.maxUInt256();
}
diff --git a/contracts/mocks/lib/ERC20WrapperMock.sol b/contracts/mocks/lib/ERC20WrapperMock.sol
index 5adbf2f23..c81a94782 100644
--- a/contracts/mocks/lib/ERC20WrapperMock.sol
+++ b/contracts/mocks/lib/ERC20WrapperMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ERC20Wrapper } from "../../lib/ERC20Wrapper.sol";
diff --git a/contracts/mocks/lib/TimeLockUpgradeMock.sol b/contracts/mocks/lib/TimeLockUpgradeMock.sol
index b0761444f..756bf0da4 100644
--- a/contracts/mocks/lib/TimeLockUpgradeMock.sol
+++ b/contracts/mocks/lib/TimeLockUpgradeMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { TimeLockUpgrade } from "../../lib/TimeLockUpgrade.sol";
diff --git a/contracts/mocks/tokens/BadTokenMock.sol b/contracts/mocks/tokens/BadTokenMock.sol
index 19d7296c3..ba4d2bdf3 100644
--- a/contracts/mocks/tokens/BadTokenMock.sol
+++ b/contracts/mocks/tokens/BadTokenMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
@@ -9,13 +9,12 @@ contract BadTokenMock is ERC20 {
uint256 constant public decimals = 18;
string public name;
string public symbol;
- uint256 public totalSupply;
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol)
+ string memory _name,
+ string memory _symbol)
public
{
_mint(initialAccount, initialBalance);
diff --git a/contracts/mocks/tokens/InvalidReturnTokenMock.sol b/contracts/mocks/tokens/InvalidReturnTokenMock.sol
index e97d3539c..108c3c939 100644
--- a/contracts/mocks/tokens/InvalidReturnTokenMock.sol
+++ b/contracts/mocks/tokens/InvalidReturnTokenMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -29,8 +29,8 @@ contract InvalidReturnTokenMock {
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol,
+ string memory _name,
+ string memory _symbol,
uint256 _decimals)
public
{
@@ -41,13 +41,6 @@ contract InvalidReturnTokenMock {
decimals = _decimals;
}
- /**
- * @dev Total number of tokens in existence
- */
- function totalSupply() external view returns (uint256) {
- return totalSupply;
- }
-
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
@@ -58,7 +51,7 @@ contract InvalidReturnTokenMock {
uint256 _value
)
external
- returns(uint256)
+ returns (uint256)
{
require(_to != address(0));
require(_value <= balances[msg.sender]);
@@ -90,7 +83,7 @@ contract InvalidReturnTokenMock {
uint256 _value
)
external
- returns(uint256)
+ returns (uint256)
{
require(_to != address(0));
require(_value <= balances[_from]);
@@ -117,7 +110,7 @@ contract InvalidReturnTokenMock {
uint256 _value
)
external
- returns(uint256)
+ returns (uint256)
{
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
@@ -155,7 +148,7 @@ contract InvalidReturnTokenMock {
uint256 _addedValue
)
external
- returns(uint256)
+ returns (uint256)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
@@ -177,7 +170,7 @@ contract InvalidReturnTokenMock {
uint256 _subtractedValue
)
external
- returns(uint256)
+ returns (uint256)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
diff --git a/contracts/mocks/tokens/NoDecimalTokenMock.sol b/contracts/mocks/tokens/NoDecimalTokenMock.sol
index 472208e3a..f402aa1f9 100644
--- a/contracts/mocks/tokens/NoDecimalTokenMock.sol
+++ b/contracts/mocks/tokens/NoDecimalTokenMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
@@ -11,8 +11,8 @@ contract NoDecimalTokenMock is ERC20 {
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol)
+ string memory _name,
+ string memory _symbol)
public
{
_mint(initialAccount, initialBalance);
diff --git a/contracts/mocks/tokens/NoXferReturnTokenMock.sol b/contracts/mocks/tokens/NoXferReturnTokenMock.sol
index b1bdfae93..07c7ca679 100644
--- a/contracts/mocks/tokens/NoXferReturnTokenMock.sol
+++ b/contracts/mocks/tokens/NoXferReturnTokenMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -18,8 +18,8 @@ contract NoXferReturnTokenMock {
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol,
+ string memory _name,
+ string memory _symbol,
uint256 _decimals)
public
{
@@ -30,13 +30,6 @@ contract NoXferReturnTokenMock {
decimals = _decimals;
}
- /**
- * @dev Total number of tokens in existence
- */
- function totalSupply() external view returns (uint256) {
- return totalSupply;
- }
-
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
diff --git a/contracts/mocks/tokens/StandardTokenMock.sol b/contracts/mocks/tokens/StandardTokenMock.sol
index bda51cd4e..d7bd56c1b 100644
--- a/contracts/mocks/tokens/StandardTokenMock.sol
+++ b/contracts/mocks/tokens/StandardTokenMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
@@ -13,8 +13,8 @@ contract StandardTokenMock is ERC20 {
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol,
+ string memory _name,
+ string memory _symbol,
uint256 _decimals)
public
{
diff --git a/contracts/mocks/tokens/StandardTokenWithFeeMock.sol b/contracts/mocks/tokens/StandardTokenWithFeeMock.sol
index b306730d3..7cf995595 100644
--- a/contracts/mocks/tokens/StandardTokenWithFeeMock.sol
+++ b/contracts/mocks/tokens/StandardTokenWithFeeMock.sol
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -49,8 +49,8 @@ contract StandardTokenWithFeeMock {
constructor(
address initialAccount,
uint256 initialBalance,
- string _name,
- string _symbol,
+ string memory _name,
+ string memory _symbol,
uint256 _fee)
public
{
diff --git a/contracts/mocks/tokens/WethMock.sol b/contracts/mocks/tokens/WethMock.sol
index a9f6a51d8..d5d1238fd 100644
--- a/contracts/mocks/tokens/WethMock.sol
+++ b/contracts/mocks/tokens/WethMock.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
import "canonical-weth/contracts/WETH9.sol";
@@ -11,4 +11,4 @@ contract WethMock is WETH9 {
{
balanceOf[initialAccount] = initialBalance;
}
-}
\ No newline at end of file
+}
diff --git a/contracts/supplementary/PayableExchangeIssue.sol b/contracts/supplementary/PayableExchangeIssue.sol
index c62b20ccb..5ec0256a9 100644
--- a/contracts/supplementary/PayableExchangeIssue.sol
+++ b/contracts/supplementary/PayableExchangeIssue.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { ReentrancyGuard } from "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
@@ -86,7 +86,7 @@ contract PayableExchangeIssue is
// Commit the address and instance of Exchange Issue Module to state variables
exchangeIssueModule = _exchangeIssueModule;
- exchangeIssueInstance = IExchangeIssueModule(_exchangeIssueModule);
+ exchangeIssueInstance = IExchangeIssueModule(_exchangeIssueModule);
// Commit the address and instance of Wrapped Ether to state variables
weth = _wrappedEther;
@@ -119,7 +119,7 @@ contract PayableExchangeIssue is
/**
* Issue a Rebalancing Set using Wrapped Ether to acquire the base components of the Base Set.
* The Base Set is then issued using Exchange Issue and reissued into the Rebalancing Set.
- * This function is meant to be used with a user interface
+ * This function is meant to be used with a user interface
*
* @param _rebalancingSetAddress Address of the rebalancing Set to issue
* @param _exchangeIssueData Struct containing data around the base Set issuance
@@ -128,7 +128,7 @@ contract PayableExchangeIssue is
function issueRebalancingSetWithEther(
address _rebalancingSetAddress,
ExchangeIssueLibrary.ExchangeIssueParams memory _exchangeIssueData,
- bytes _orderData
+ bytes memory _orderData
)
public
payable
@@ -167,7 +167,7 @@ contract PayableExchangeIssue is
rebalancingSetIssueQuantity
);
- returnExcessFunds(baseSetAddress);
+ returnExcessFunds(baseSetAddress);
}
/* ============ Private Functions ============ */
diff --git a/contracts/supplementary/rebalancing-manager/BTCETHRebalancingManager.sol b/contracts/supplementary/rebalancing-manager/BTCETHRebalancingManager.sol
index 13526212e..d086e72d9 100644
--- a/contracts/supplementary/rebalancing-manager/BTCETHRebalancingManager.sol
+++ b/contracts/supplementary/rebalancing-manager/BTCETHRebalancingManager.sol
@@ -14,7 +14,7 @@
limitations under the License.
*/
-pragma solidity 0.4.25;
+pragma solidity 0.5.4;
pragma experimental "ABIEncoderV2";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -106,8 +106,8 @@ contract BTCETHRebalancingManager {
address _setTokenFactory,
address _auctionLibrary,
uint256 _auctionTimeToPivot,
- uint256[2] _multipliers,
- uint256[2] _allocationBounds
+ uint256[2] memory _multipliers,
+ uint256[2] memory _allocationBounds
)
public
{
@@ -115,7 +115,7 @@ contract BTCETHRebalancingManager {
_allocationBounds[1] >= _allocationBounds[0],
"RebalancingTokenManager.constructor: Upper allocation bound must be greater than lower."
);
-
+
coreAddress = _coreAddress;
btcPriceFeed = _btcPriceFeedAddress;
@@ -165,9 +165,11 @@ contract BTCETHRebalancingManager {
);
// Get price data
+ uint256 btcPrice;
+ uint256 ethPrice;
(
- uint256 btcPrice,
- uint256 ethPrice
+ btcPrice,
+ ethPrice
) = queryPriceData();
// Require that allocation has changed sufficiently enough to justify rebalance
@@ -176,12 +178,15 @@ contract BTCETHRebalancingManager {
ethPrice,
rebalancingSetInterface.currentSet()
);
-
+
// Create new Set Token that collateralizes Rebalancing Set Token
+ address nextSetAddress;
+ uint256 auctionStartPrice;
+ uint256 auctionPivotPrice;
(
- address nextSetAddress,
- uint256 auctionStartPrice,
- uint256 auctionPivotPrice
+ nextSetAddress,
+ auctionStartPrice,
+ auctionPivotPrice
) = createNewAllocationSetToken(
btcPrice,
ethPrice,
@@ -298,10 +303,13 @@ contract BTCETHRebalancingManager {
returns (address, uint256, uint256)
{
// Calculate the nextSet units and naturalUnit, determine dollar value of nextSet
+ uint256 nextSetNaturalUnit;
+ uint256 nextSetDollarAmount;
+ uint256[] memory nextSetUnits;
(
- uint256 nextSetNaturalUnit,
- uint256 nextSetDollarAmount,
- uint256[] memory nextSetUnits
+ nextSetNaturalUnit,
+ nextSetDollarAmount,
+ nextSetUnits
) = calculateNextSetUnits(
_btcPrice,
_ethPrice
@@ -309,14 +317,16 @@ contract BTCETHRebalancingManager {
// Calculate the auctionStartPrice and auctionPivotPrice of rebalance auction using dollar value
// of both the current and nextSet
+ uint256 auctionStartPrice;
+ uint256 auctionPivotPrice;
(
- uint256 auctionStartPrice,
- uint256 auctionPivotPrice
+ auctionStartPrice,
+ auctionPivotPrice
) = calculateAuctionPriceParameters(
_currentSetDollarAmount,
nextSetDollarAmount
);
-
+
// Create static components array
address[] memory nextSetComponents = new address[](2);
nextSetComponents[0] = btcAddress;
@@ -324,7 +334,7 @@ contract BTCETHRebalancingManager {
// Create the nextSetToken contract that collateralized the Rebalancing Set Token once rebalance
// is finished
- address nextSetAddress = ICore(coreAddress).create(
+ address nextSetAddress = ICore(coreAddress).createSet(
setTokenFactory,
nextSetComponents,
nextSetUnits,
@@ -351,7 +361,8 @@ contract BTCETHRebalancingManager {
uint256 _ethPrice
)
private
- returns (uint256, uint256, uint256[])
+ view
+ returns (uint256, uint256, uint256[] memory)
{
// Initialize set token parameters
uint256 naturalUnit;
@@ -360,7 +371,7 @@ contract BTCETHRebalancingManager {
if (_btcPrice >= _ethPrice) {
// Calculate ethereum units, determined by the following equation:
- // (btcPrice/ethPrice)*(10**(ethDecimal-btcDecimal))
+ // (btcPrice/ethPrice)*(10**(ethDecimal-btcDecimal))
uint256 ethUnits = _btcPrice.mul(DECIMAL_DIFF_MULTIPLIER).div(_ethPrice);
// Create unit array and define natural unit
@@ -374,18 +385,18 @@ contract BTCETHRebalancingManager {
_ethPrice,
naturalUnit,
units
- );
+ );
} else {
- // Calculate btc units as (ethPrice/btcPrice)*100. 100 is used to add
+ // Calculate btc units as (ethPrice/btcPrice)*100. 100 is used to add
// precision. The increase in unit amounts is offset by increasing the
// naturalUnit by two orders of magnitude so that issuance cost is still
// roughly the same
uint256 ethBtcPrice = _ethPrice.mul(PRICE_PRECISION).div(_btcPrice);
// Create unit array and define natural unit
- units[0] = ethBtcPrice.mul(btcMultiplier);
+ units[0] = ethBtcPrice.mul(btcMultiplier);
units[1] = PRICE_PRECISION.mul(DECIMAL_DIFF_MULTIPLIER).mul(ethMultiplier);
- naturalUnit = 10**12;
+ naturalUnit = 10**12;
// Calculate the nextSet dollar value (in cents)
nextSetDollarAmount = calculateSetTokenPriceUSD(
@@ -393,7 +404,7 @@ contract BTCETHRebalancingManager {
_ethPrice,
naturalUnit,
units
- );
+ );
}
return (naturalUnit, nextSetDollarAmount, units);
@@ -448,13 +459,13 @@ contract BTCETHRebalancingManager {
uint256 _btcPrice,
uint256 _ethPrice,
uint256 _naturalUnit,
- uint256[] _units
+ uint256[] memory _units
)
private
- view
+ pure
returns (uint256)
{
- // Calculate btcDollarAmount of one Set Token (in cents)
+ // Calculate btcDollarAmount of one Set Token (in cents)
uint256 btcDollarAmount = calculateTokenAllocationAmountUSD(
_btcPrice,
_naturalUnit,
@@ -471,7 +482,7 @@ contract BTCETHRebalancingManager {
);
// Return sum of two components USD value (in cents)
- return btcDollarAmount.add(ethDollarAmount);
+ return btcDollarAmount.add(ethDollarAmount);
}
/*
@@ -490,7 +501,7 @@ contract BTCETHRebalancingManager {
uint256 _tokenDecimals
)
private
- view
+ pure
returns (uint256)
{
// Calculate the amount of component base units are in one full set token
@@ -504,4 +515,4 @@ contract BTCETHRebalancingManager {
.div(10**_tokenDecimals)
.div(VALUE_TO_CENTS_CONVERSION);
}
-}
\ No newline at end of file
+}
diff --git a/deployments/stages/5_rebalancing.ts b/deployments/stages/5_rebalancing.ts
index fe8ceb690..42e259a1c 100644
--- a/deployments/stages/5_rebalancing.ts
+++ b/deployments/stages/5_rebalancing.ts
@@ -112,7 +112,7 @@ export class RebalancingStage implements DeploymentStageInterface {
const initialSetName = SetProtocolUtils.stringToBytes('BTCETH');
const initialSymbol = SetProtocolUtils.stringToBytes('BTCETH');
- const txHash = await this._coreContract.create.sendTransactionAsync(
+ const txHash = await this._coreContract.createSet.sendTransactionAsync(
setTokenFactoryAddress,
[wbtcAddress, wethAddress],
initialSetParams['units'],
@@ -157,7 +157,7 @@ export class RebalancingStage implements DeploymentStageInterface {
networkConstants.bitEthRebalanceManagerRebalanceInterval[this._networkName]
);
- const txHash = await this._coreContract.create.sendTransactionAsync(
+ const txHash = await this._coreContract.createSet.sendTransactionAsync(
rebalancingSetFactoryAddress,
[initialSetToken],
rebalancingSetUnitShares,
diff --git a/package.json b/package.json
index 15e01c509..f7c2dd64e 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"chain": "yarn clean-chain && ganache-cli --db blockchain --networkId 50 --accounts 20 -l 19000000 -e 10000000000 -m 'concert load couple harbor equip island argue ramp clarify fence smart topic'",
"clean": "rm -rf build; rm -rf transpiled; rm -rf types/generated",
"clean-chain": "rm -rf blockchain && cp -r snapshots/0x-Kyber blockchain",
- "compile": "truffle compile --all",
+ "compile": "./node_modules/.bin/truffle compile --all",
"coverage": "yarn coverage-setup && ./node_modules/.bin/solidity-coverage && yarn coverage-cleanup",
"coverage-cleanup": "find artifacts/ts -name \\*.js* -type f -delete && find test -name \\*.js* -type f -delete && find types -name \\*.js* -type f -delete && find utils -name \\*.js* -type f -delete",
"coverage-continuous": "./node_modules/.bin/solidity-coverage",
@@ -79,8 +79,8 @@
"json-stable-stringify": "^1.0.1",
"lodash": "^4.17.4",
"set-abi-gen": "1.1.0-beta.1",
- "solc": "^0.4.25",
- "solidity-coverage": "^0.5.11",
+ "solc": "^0.5.4",
+ "solidity-coverage": "https://github.com/leapdao/solidity-coverage#master",
"truffle": "^5.0.3",
"truffle-deploy-registry": "^0.5.1",
"truffle-hdwallet-provider-privkey": "^1.0.3",
@@ -92,7 +92,7 @@
},
"dependencies": {
"bn-chai": "^1.0.1",
- "canonical-weth": "1.2.0",
+ "canonical-weth": "^1.3.1",
"dotenv": "^6.2.0",
"eth-gas-reporter": "^0.1.10",
"expect": "^24.1.0",
@@ -100,9 +100,9 @@
"husky": "^0.14.3",
"lint-staged": "^7.2.0",
"module-alias": "^2.1.0",
- "openzeppelin-solidity": "^2.0.0",
+ "openzeppelin-solidity": "^2.1.2",
"set-protocol-utils": "^1.0.0-beta.27",
- "solium": "^1.1.7",
+ "ethlint": "^1.2.3",
"tiny-promisify": "^1.0.0",
"truffle-hdwallet-provider": "^1.0.0-web3one.0",
"ts-mocha": "^6.0.0",
diff --git a/test/contracts/core/extensions/coreAccounting.spec.ts b/test/contracts/core/extensions/coreAccounting.spec.ts
index 7bc5c5647..14d3289d7 100644
--- a/test/contracts/core/extensions/coreAccounting.spec.ts
+++ b/test/contracts/core/extensions/coreAccounting.spec.ts
@@ -431,7 +431,7 @@ contract('CoreAccounting', accounts => {
tokenAddresses
);
- expect(JSON.stringify(expectedLogs)).to.eql(JSON.stringify(formattedLogs));
+ expect(formattedLogs).to.deep.include.members(expectedLogs);
});
});
diff --git a/test/contracts/core/extensions/coreFactory.spec.ts b/test/contracts/core/extensions/coreFactory.spec.ts
index 7a34a9a7a..94a6bab42 100644
--- a/test/contracts/core/extensions/coreFactory.spec.ts
+++ b/test/contracts/core/extensions/coreFactory.spec.ts
@@ -60,7 +60,7 @@ contract('CoreFactory', accounts => {
await blockchain.revertAsync();
});
- describe('#create', async () => {
+ describe('#createSet', async () => {
let factoryAddress: Address;
let components: Address[];
let mockToken: StandardTokenMockContract;
@@ -80,7 +80,7 @@ contract('CoreFactory', accounts => {
});
async function subject(): Promise {
- return core.create.sendTransactionAsync(
+ return core.createSet.sendTransactionAsync(
factoryAddress,
components,
units,
diff --git a/test/contracts/core/extensions/coreModuleInteraction.spec.ts b/test/contracts/core/extensions/coreModuleInteraction.spec.ts
index 869fa6b3b..a7cb21acb 100644
--- a/test/contracts/core/extensions/coreModuleInteraction.spec.ts
+++ b/test/contracts/core/extensions/coreModuleInteraction.spec.ts
@@ -235,7 +235,7 @@ contract('CoreModuleInteraction', accounts => {
tokenAddresses
);
- expect(JSON.stringify(expectedLogs)).to.eql(JSON.stringify(formattedLogs));
+ expect(formattedLogs).to.deep.include.members(expectedLogs);
});
});
@@ -1330,4 +1330,4 @@ contract('CoreModuleInteraction', accounts => {
});
});
});
-});
\ No newline at end of file
+});
diff --git a/test/contracts/core/tokens/rebalancingSetTokenFactory.spec.ts b/test/contracts/core/tokens/rebalancingSetTokenFactory.spec.ts
index 6104ce1fa..bad2b2bcb 100644
--- a/test/contracts/core/tokens/rebalancingSetTokenFactory.spec.ts
+++ b/test/contracts/core/tokens/rebalancingSetTokenFactory.spec.ts
@@ -352,7 +352,7 @@ contract('RebalancingSetTokenFactory', accounts => {
});
async function subject(): Promise {
- return rebalancingSetTokenFactory.create.sendTransactionAsync(
+ return rebalancingSetTokenFactory.createSet.sendTransactionAsync(
subjectComponents,
subjectUnits,
subjectNaturalUnit,
diff --git a/test/contracts/core/tokens/setTokenFactory.spec.ts b/test/contracts/core/tokens/setTokenFactory.spec.ts
index 0f66ee808..dea2e0f74 100644
--- a/test/contracts/core/tokens/setTokenFactory.spec.ts
+++ b/test/contracts/core/tokens/setTokenFactory.spec.ts
@@ -150,7 +150,7 @@ contract('SetTokenFactory', accounts => {
});
async function subject(): Promise {
- return setTokenFactory.create.sendTransactionAsync(
+ return setTokenFactory.createSet.sendTransactionAsync(
components,
units,
naturalUnit,
diff --git a/test/profile/setTokenDeployment.spec.ts b/test/profile/setTokenDeployment.spec.ts
index 46bdfb7ab..652f9d0a4 100644
--- a/test/profile/setTokenDeployment.spec.ts
+++ b/test/profile/setTokenDeployment.spec.ts
@@ -58,7 +58,7 @@ contract('Deployment', accounts => {
});
async function deploySetToken(): Promise {
- return core.create.sendTransactionAsync(
+ return core.createSet.sendTransactionAsync(
subjectFactoryAddress,
subjectComponents,
subjectUnits,
diff --git a/truffle.js b/truffle.js
index f827c56ce..13a7ce38e 100644
--- a/truffle.js
+++ b/truffle.js
@@ -47,11 +47,12 @@ module.exports = {
},
compilers: {
solc: {
- version: "0.4.25",
+ version: "0.5.4",
docker: true,
settings: {
optimizer: {
- enabled: true
+ enabled: true,
+ runs: 200
}
}
}
@@ -79,4 +80,4 @@ function returnWallet(url) {
nonceTracker.setEngine(wallet.engine)
return wallet;
-}
\ No newline at end of file
+}
diff --git a/utils/wrappers/coreWrapper.ts b/utils/wrappers/coreWrapper.ts
index fb4aa8eed..899ed8096 100644
--- a/utils/wrappers/coreWrapper.ts
+++ b/utils/wrappers/coreWrapper.ts
@@ -557,7 +557,7 @@ export class CoreWrapper {
const encodedSymbol = SetUtils.stringToBytes(symbol);
// Creates and registers the Set with Core as enabled
- const txHash = await core.create.sendTransactionAsync(
+ const txHash = await core.createSet.sendTransactionAsync(
factory,
componentAddresses,
units,
diff --git a/utils/wrappers/rebalancingWrapper.ts b/utils/wrappers/rebalancingWrapper.ts
index 4aac0a4ed..784766afc 100644
--- a/utils/wrappers/rebalancingWrapper.ts
+++ b/utils/wrappers/rebalancingWrapper.ts
@@ -119,7 +119,7 @@ export class RebalancingWrapper {
const encodedName = SetUtils.stringToBytes(name);
const encodedSymbol = SetUtils.stringToBytes(symbol);
- const txHash = await core.create.sendTransactionAsync(
+ const txHash = await core.createSet.sendTransactionAsync(
factory,
componentAddresses,
units,
diff --git a/yarn.lock b/yarn.lock
index 5d6f8e940..198b61fd3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1327,6 +1327,10 @@ bignumber.js@^4.1.0, bignumber.js@~4.1.0:
version "2.0.7"
resolved "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2"
+"bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git":
+ version "2.0.7"
+ resolved "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934"
+
binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"
@@ -1698,10 +1702,10 @@ caniuse-lite@^1.0.30000844:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000890.tgz#86a18ffcc65d79ec6a437e985761b8bf1c4efeaf"
integrity sha512-4NI3s4Y6ROm+SgZN5sLUG4k7nVWQnedis3c/RWkynV5G6cHSY7+a8fwFyn2yoBDE3E6VswhTNNwR3PvzGqlTkg==
-canonical-weth@1.2.0:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/canonical-weth/-/canonical-weth-1.2.0.tgz#f1678338caf27728947e4373c93f449fe94ef7de"
- integrity sha512-3iodn+8KJg2qgUWNmOnsu8HbmIkEa/1TRkTQgl2l6N8duSUwk7M1TGP1RTBPJMuJpXStkTTOYnfC8b3ZigiUnw==
+canonical-weth@^1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/canonical-weth/-/canonical-weth-1.3.1.tgz#8c12172ee2cd63247c5f6c75be44a6b173b97fd1"
+ integrity sha512-sDVYcU4ta2ixs9NNmOS15i5sdNJqbAPx/l86rctEK0XcAKI/PEs0IKZ2GjJ2hgTabzf4LfwopgNIznNcS3aLSQ==
caseless@~0.12.0:
version "0.12.0"
@@ -1971,6 +1975,11 @@ combined-stream@1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
+command-exists@^1.2.8:
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291"
+ integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==
+
commander@2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
@@ -2429,7 +2438,7 @@ diff@3.3.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75"
integrity sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==
-diff@^3.1.0, diff@^3.2.0:
+diff@^3.1.0, diff@^3.2.0, diff@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
@@ -3122,6 +3131,25 @@ ethjs-util@0.1.6, ethjs-util@^0.1.3:
is-hex-prefixed "1.0.0"
strip-hex-prefix "1.0.0"
+ethlint@^1.2.3:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/ethlint/-/ethlint-1.2.3.tgz#f0efd1970ccebc7156a3b8ae9b0510b3e57c8882"
+ integrity sha512-1qKDsfPdFmAdQgU8mnSiRAOZd82K6h677LQIDAdWLdzUcz7rL47z8Jpj8bpL2PA0WwrWkTdKt0RThHdRDmTUNw==
+ dependencies:
+ ajv "^5.2.2"
+ chokidar "^1.6.0"
+ colors "^1.1.2"
+ commander "^2.9.0"
+ diff "^3.5.0"
+ eol "^0.9.1"
+ js-string-escape "^1.0.1"
+ lodash "^4.14.2"
+ sol-digger "0.0.2"
+ sol-explore "1.6.1"
+ solium-plugin-security "0.1.1"
+ solparse "2.2.8"
+ text-table "^0.2.0"
+
eventemitter3@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.1.1.tgz#47786bdaa087caf7b1b75e73abc5c7d540158cd0"
@@ -5693,10 +5721,10 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"
-openzeppelin-solidity@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-2.0.0.tgz#b45dddbdae090f89577598c1a7e7518df61b7ba2"
- integrity sha512-SolpxQFArtiYnlSNg3dZ9sz0WVlKtPqSOcJkXRllaZp4+Lpfqz3vxF0yoh7g75TszKPyadqoJmU7+GM/vwh9SA==
+openzeppelin-solidity@^2.1.2:
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-2.1.2.tgz#94e2bb92b60e91abb22c6fe27d983d92850fb324"
+ integrity sha512-1ggh+AZFpMAgGfgnVMQ8dwYawjD2QN4xuWkQS4FUbeUz1fnCKJpguUl2cyadyfDYjBq1XJ6MA6VkzYpTZtJMqw==
optimist@^0.6.1:
version "0.6.1"
@@ -7016,7 +7044,7 @@ solc@0.5.0:
semver "^5.5.0"
yargs "^11.0.0"
-solc@^0.4.2, solc@^0.4.25:
+solc@^0.4.2:
version "0.4.25"
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.25.tgz#06b8321f7112d95b4b903639b1138a4d292f5faa"
integrity sha512-jU1YygRVy6zatgXrLY2rRm7HW1d7a8CkkEgNJwvH2VLpWhMFsMdWcJn6kUqZwcSz/Vm+w89dy7Z/aB5p6AFTrg==
@@ -7027,10 +7055,23 @@ solc@^0.4.2, solc@^0.4.25:
semver "^5.3.0"
yargs "^4.7.1"
-solidity-coverage@^0.5.11:
+solc@^0.5.4:
+ version "0.5.4"
+ resolved "https://registry.yarnpkg.com/solc/-/solc-0.5.4.tgz#e91bbea93d607eb0f934b8bc9b3c9a0d999ef768"
+ integrity sha512-Jz3yz2mct0AYzR83/jBgxDqrLXTHhYUg2G2PVJbMMt5Vu+8e3Of1Mn3nvjPw5mh46jrzt8l4fBN7vHqG5ZF0cw==
+ dependencies:
+ command-exists "^1.2.8"
+ fs-extra "^0.30.0"
+ keccak "^1.0.2"
+ memorystream "^0.3.1"
+ require-from-string "^2.0.0"
+ semver "^5.5.0"
+ tmp "0.0.33"
+ yargs "^11.0.0"
+
+"solidity-coverage@https://github.com/leapdao/solidity-coverage#master":
version "0.5.11"
- resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.5.11.tgz#1ee45f6d98b75a615aadb8f9aa7db4a2b32258e7"
- integrity sha512-qikdsSi6+9XbfvwA0aI7HUVpF9fIFNqRWTw23M89GMDY+b6Gj0wWU9IngJS0fimoZIAdEp3bfChxvpfVcrUesg==
+ resolved "https://github.com/leapdao/solidity-coverage#0c2fe7d3bf64208f473bad1f57e4e14455abe141"
dependencies:
death "^1.1.0"
ethereumjs-testrpc-sc "6.1.6"
@@ -7039,19 +7080,18 @@ solidity-coverage@^0.5.11:
req-cwd "^1.0.1"
shelljs "^0.7.4"
sol-explore "^1.6.2"
- solidity-parser-sc "0.4.11"
+ solidity-parser-sc "https://github.com/leapdao/solidity-parser.git#master"
tree-kill "^1.2.0"
- web3 "^0.18.4"
+ web3 "^0.20.6"
solidity-parser-antlr@^0.2.10:
version "0.2.15"
resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.2.15.tgz#4be687a0a53da268c6a07398e0cfb3168896d610"
integrity sha512-EzRI8/TR/ljTXkZAyAjb0w4G20wH2XM7pcNf87ifdV825AbUv7DkY7HmiZCTj6NeKtIx8Y1s0NZWPbj+JTp8Zw==
-solidity-parser-sc@0.4.11:
- version "0.4.11"
- resolved "https://registry.yarnpkg.com/solidity-parser-sc/-/solidity-parser-sc-0.4.11.tgz#86734c9205537007f4d6201b57176e41696ee607"
- integrity sha512-1kV5iC7m3CtMDfmHaVNwz2saSGQVIuF16rIxU417Al38MVCWHMQQ5vT6cmLsNwDe60S74auobWij9vNawSeOyw==
+"solidity-parser-sc@https://github.com/leapdao/solidity-parser.git#master":
+ version "0.4.12"
+ resolved "https://github.com/leapdao/solidity-parser.git#898896cff7d22a729e5af3bc32f53a72edb1f1bf"
dependencies:
mocha "^4.1.0"
pegjs "^0.10.0"
@@ -7062,28 +7102,10 @@ solium-plugin-security@0.1.1:
resolved "https://registry.yarnpkg.com/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz#2a87bcf8f8c3abf7d198e292e4ac080284e3f3f6"
integrity sha512-kpLirBwIq4mhxk0Y/nn5cQ6qdJTI+U1LO3gpoNIcqNaW+sI058moXBe2UiHs+9wvF9IzYD49jcKhFTxcR9u9SQ==
-solium@^1.1.7:
- version "1.1.8"
- resolved "https://registry.yarnpkg.com/solium/-/solium-1.1.8.tgz#35d30a15c572a233ce8a90226d6cfccb762fadb7"
- integrity sha512-fn0lusM6of14CytIDDHK73SGjn6NsVTaCVJjaKCKJyqKhT00rH/hDtvnIeZ2ZTD9z/xaXd4Js2brW3az6AV9RA==
- dependencies:
- ajv "^5.2.2"
- chokidar "^1.6.0"
- colors "^1.1.2"
- commander "^2.9.0"
- eol "^0.9.1"
- js-string-escape "^1.0.1"
- lodash "^4.14.2"
- sol-digger "0.0.2"
- sol-explore "1.6.1"
- solium-plugin-security "0.1.1"
- solparse "2.2.5"
- text-table "^0.2.0"
-
-solparse@2.2.5:
- version "2.2.5"
- resolved "https://registry.yarnpkg.com/solparse/-/solparse-2.2.5.tgz#72709c867cd6bfc50ec2325f4b81d2b3ea365d99"
- integrity sha512-t7tvtR6KU6QfPYLMv1nlCh9DA8HYIu5tbjHpKu0fhGFZ1NuSp0KKDHfFHv07g6v1xgcuUY3rVqNFjZt5b9+5qA==
+solparse@2.2.8:
+ version "2.2.8"
+ resolved "https://registry.yarnpkg.com/solparse/-/solparse-2.2.8.tgz#d13e42dbed95ce32f43894f5ec53f00d14cf9f11"
+ integrity sha512-Tm6hdfG72DOxD40SD+T5ddbekWglNWjzDRSNq7ZDIOHVsyaJSeeunUuWNj4DE7uDrJK3tGQuX0ZTDZWNYsGPMA==
dependencies:
mocha "^4.0.1"
pegjs "^0.10.0"
@@ -7555,7 +7577,7 @@ tiny-promisify@^1.0.0:
dependencies:
babel-runtime "^6.11.6"
-tmp@^0.0.33:
+tmp@0.0.33, tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==
@@ -8544,6 +8566,17 @@ web3@^0.18.4:
xhr2 "*"
xmlhttprequest "*"
+web3@^0.20.6:
+ version "0.20.7"
+ resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.7.tgz#1605e6d81399ed6f85a471a4f3da0c8be57df2f7"
+ integrity sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==
+ dependencies:
+ bignumber.js "git+https://github.com/frozeman/bignumber.js-nolookahead.git"
+ crypto-js "^3.1.4"
+ utf8 "^2.1.1"
+ xhr2-cookies "^1.1.0"
+ xmlhttprequest "*"
+
"websocket@git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible":
version "1.0.26"
resolved "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
@@ -8663,7 +8696,7 @@ xhr-request@^1.0.1:
url-set-query "^1.0.0"
xhr "^2.0.4"
-xhr2-cookies@1.1.0:
+xhr2-cookies@1.1.0, xhr2-cookies@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48"
integrity sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=