Add _ to remaining internal/private functions

This commit is contained in:
Amir Bandeali
2019-05-07 16:00:14 -07:00
parent 3217c1e11f
commit 6763bce627
19 changed files with 68 additions and 69 deletions

View File

@@ -63,7 +63,7 @@ contract MixinBalanceThresholdFilterCore is
external
{
// Get accounts whose balances must be validated
address[] memory addressesToValidate = getAddressesToValidate(signerAddress);
address[] memory addressesToValidate = _getAddressesToValidate(signerAddress);
// Validate account balances
uint256 balanceThreshold = BALANCE_THRESHOLD;
@@ -92,12 +92,12 @@ contract MixinBalanceThresholdFilterCore is
/// (defined by `signedExchangeTransaction` above).
/// @param signerAddress Address of transaction signer.
/// @return addressesToValidate Array of addresses to validate.
function getAddressesToValidate(address signerAddress)
function _getAddressesToValidate(address signerAddress)
internal
pure
returns (address[] memory addressesToValidate)
{
bytes4 exchangeFunctionSelector = bytes4(exchangeCalldataload(0));
bytes4 exchangeFunctionSelector = bytes4(_exchangeCalldataload(0));
// solhint-disable expression-indent
if (
exchangeFunctionSelector == BATCH_FILL_ORDERS_SELECTOR ||
@@ -108,20 +108,20 @@ contract MixinBalanceThresholdFilterCore is
exchangeFunctionSelector == MARKET_SELL_ORDERS_SELECTOR ||
exchangeFunctionSelector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
) {
addressesToValidate = loadMakerAddressesFromOrderArray(0);
addressesToValidate = _loadMakerAddressesFromOrderArray(0);
addressesToValidate = addressesToValidate.append(signerAddress);
} else if (
exchangeFunctionSelector == FILL_ORDER_SELECTOR ||
exchangeFunctionSelector == FILL_ORDER_NO_THROW_SELECTOR ||
exchangeFunctionSelector == FILL_OR_KILL_ORDER_SELECTOR
) {
address makerAddress = loadMakerAddressFromOrder(0);
address makerAddress = _loadMakerAddressFromOrder(0);
addressesToValidate = addressesToValidate.append(makerAddress);
addressesToValidate = addressesToValidate.append(signerAddress);
} else if (exchangeFunctionSelector == MATCH_ORDERS_SELECTOR) {
address leftMakerAddress = loadMakerAddressFromOrder(0);
address leftMakerAddress = _loadMakerAddressFromOrder(0);
addressesToValidate = addressesToValidate.append(leftMakerAddress);
address rightMakerAddress = loadMakerAddressFromOrder(1);
address rightMakerAddress = _loadMakerAddressFromOrder(1);
addressesToValidate = addressesToValidate.append(rightMakerAddress);
addressesToValidate = addressesToValidate.append(signerAddress);
} else if (

View File

@@ -33,7 +33,7 @@ contract MixinExchangeCalldata is
/// which is accessed through `signedExchangeTransaction`.
/// @param offset Offset into the Exchange calldata.
/// @return value Corresponding 32 byte value stored at `offset`.
function exchangeCalldataload(uint256 offset)
function _exchangeCalldataload(uint256 offset)
internal
pure
returns (bytes32 value)
@@ -58,12 +58,12 @@ contract MixinExchangeCalldata is
/// from the embedded Exchange calldata.
/// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
/// @return value Corresponding 32 byte value stored at `offset` + 4.
function loadExchangeData(uint256 offset)
function _loadExchangeData(uint256 offset)
internal
pure
returns (bytes32 value)
{
value = exchangeCalldataload(offset + 4);
value = _exchangeCalldataload(offset + 4);
return value;
}
@@ -71,14 +71,14 @@ contract MixinExchangeCalldata is
/// (which is embedded in `signedExchangeTransaction`).
/// @param orderParamIndex Index of the order in the Exchange function's signature.
/// @return makerAddress The extracted maker address.
function loadMakerAddressFromOrder(uint256 orderParamIndex)
function _loadMakerAddressFromOrder(uint256 orderParamIndex)
internal
pure
returns (address makerAddress)
{
uint256 orderOffsetInBytes = orderParamIndex * 32;
uint256 orderPtr = uint256(loadExchangeData(orderOffsetInBytes));
makerAddress = address(uint256(loadExchangeData(orderPtr)));
uint256 orderPtr = uint256(_loadExchangeData(orderOffsetInBytes));
makerAddress = address(uint256(_loadExchangeData(orderPtr)));
return makerAddress;
}
@@ -86,20 +86,20 @@ contract MixinExchangeCalldata is
/// (which is embedded in `signedExchangeTransaction`).
/// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
/// @return makerAddresses The extracted maker addresses.
function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
function _loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
internal
pure
returns (address[] memory makerAddresses)
{
uint256 orderArrayOffsetInBytes = orderArrayParamIndex * 32;
uint256 orderArrayPtr = uint256(loadExchangeData(orderArrayOffsetInBytes));
uint256 orderArrayLength = uint256(loadExchangeData(orderArrayPtr));
uint256 orderArrayPtr = uint256(_loadExchangeData(orderArrayOffsetInBytes));
uint256 orderArrayLength = uint256(_loadExchangeData(orderArrayPtr));
uint256 orderArrayLengthInBytes = orderArrayLength * 32;
uint256 orderArrayElementPtr = orderArrayPtr + 32;
uint256 orderArrayElementEndPtr = orderArrayElementPtr + orderArrayLengthInBytes;
for (uint orderPtrOffset = orderArrayElementPtr; orderPtrOffset < orderArrayElementEndPtr; orderPtrOffset += 32) {
uint256 orderPtr = uint256(loadExchangeData(orderPtrOffset));
address makerAddress = address(uint256(loadExchangeData(orderPtr + orderArrayElementPtr)));
uint256 orderPtr = uint256(_loadExchangeData(orderPtrOffset));
address makerAddress = address(uint256(_loadExchangeData(orderPtr + orderArrayElementPtr)));
makerAddresses = makerAddresses.append(makerAddress);
}
return makerAddresses;

View File

@@ -48,7 +48,7 @@ contract MBalanceThresholdFilterCore is
/// (defined by `signedExchangeTransaction` above).
/// @param signerAddress Address of transaction signer.
/// @return addressesToValidate Array of addresses to validate.
function getAddressesToValidate(address signerAddress)
function _getAddressesToValidate(address signerAddress)
internal
pure
returns (address[] memory addressesToValidate);

View File

@@ -26,7 +26,7 @@ contract MExchangeCalldata {
/// which is accessed through `signedExchangeTransaction`.
/// @param offset Offset into the Exchange calldata.
/// @return value Corresponding 32 byte value stored at `offset`.
function exchangeCalldataload(uint256 offset)
function _exchangeCalldataload(uint256 offset)
internal pure
returns (bytes32 value);
@@ -34,7 +34,7 @@ contract MExchangeCalldata {
/// from the embedded Exchange calldata.
/// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
/// @return value Corresponding 32 byte value stored at `offset` + 4.
function loadExchangeData(uint256 offset)
function _loadExchangeData(uint256 offset)
internal pure
returns (bytes32 value);
@@ -42,7 +42,7 @@ contract MExchangeCalldata {
/// (which is embedded in `signedExchangeTransaction`).
/// @param orderParamIndex Index of the order in the Exchange function's signature.
/// @return makerAddress The extracted maker address.
function loadMakerAddressFromOrder(uint256 orderParamIndex)
function _loadMakerAddressFromOrder(uint256 orderParamIndex)
internal pure
returns (address makerAddress);
@@ -50,7 +50,7 @@ contract MExchangeCalldata {
/// (which is embedded in `signedExchangeTransaction`).
/// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
/// @return makerAddresses The extracted maker addresses.
function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
function _loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
internal
pure
returns (address[] memory makerAddresses);

View File

@@ -61,9 +61,9 @@ contract MixinAssets is
bytes4 proxyId = assetData.readBytes4(0);
if (proxyId == ERC20_DATA_ID) {
approveERC20Token(assetData, amount);
_approveERC20Token(assetData, amount);
} else if (proxyId == ERC721_DATA_ID) {
approveERC721Token(assetData, amount);
_approveERC721Token(assetData, amount);
} else {
revert("UNSUPPORTED_ASSET_PROXY");
}
@@ -166,7 +166,7 @@ contract MixinAssets is
/// @dev Sets approval for ERC20 AssetProxy.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to approve for respective proxy.
function approveERC20Token(
function _approveERC20Token(
bytes memory assetData,
uint256 amount
)
@@ -182,7 +182,7 @@ contract MixinAssets is
/// @dev Sets approval for ERC721 AssetProxy.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to approve for respective proxy.
function approveERC721Token(
function _approveERC721Token(
bytes memory assetData,
uint256 amount
)

View File

@@ -54,7 +54,7 @@ contract MAssets is
/// @dev Sets approval for ERC20 AssetProxy.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to approve for respective proxy.
function approveERC20Token(
function _approveERC20Token(
bytes memory assetData,
uint256 amount
)
@@ -63,7 +63,7 @@ contract MAssets is
/// @dev Sets approval for ERC721 AssetProxy.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to approve for respective proxy.
function approveERC721Token(
function _approveERC721Token(
bytes memory assetData,
uint256 amount
)