Make deployment constants private and use string reverts for constructor assertions
This commit is contained in:
parent
6d7bf12ade
commit
b8b21cefe3
@ -35,40 +35,48 @@ contract MixinDeploymentConstants {
|
||||
// @TODO SET THESE VALUES FOR DEPLOYMENT
|
||||
|
||||
// Mainnet WETH9 Address
|
||||
address constant internal WETH_ADDRESS = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
||||
address constant private WETH_ADDRESS = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
||||
|
||||
// Kovan WETH9 Address
|
||||
// address constant internal WETH_ADDRESS = address(0xd0a1e359811322d97991e03f863a0c30c2cf029c);
|
||||
// address constant private WETH_ADDRESS = address(0xd0a1e359811322d97991e03f863a0c30c2cf029c);
|
||||
|
||||
// Ropsten & Rinkeby WETH9 Address
|
||||
// address constant internal WETH_ADDRESS = address(0xc778417e063141139fce010982780140aa0cd5ab);
|
||||
// address constant private WETH_ADDRESS = address(0xc778417e063141139fce010982780140aa0cd5ab);
|
||||
|
||||
// Mainnet Weth Asset Data
|
||||
bytes constant internal WETH_ASSET_DATA = hex"f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
||||
bytes constant private WETH_ASSET_DATA = hex"f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
||||
|
||||
// Kovan Weth Asset Data
|
||||
// bytes constant internal WETH_ASSET_DATA = hex"f47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c";
|
||||
// bytes constant private WETH_ASSET_DATA = hex"f47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c";
|
||||
|
||||
// Ropsten & Rinkeby Weth Asset Data
|
||||
// bytes constant internal WETH_ASSET_DATA = hex"f47261b0000000000000000000000000c778417e063141139fce010982780140aa0cd5ab";
|
||||
// bytes constant private WETH_ASSET_DATA = hex"f47261b0000000000000000000000000c778417e063141139fce010982780140aa0cd5ab";
|
||||
|
||||
// @TODO SET THESE VALUES FOR DEPLOYMENT
|
||||
address constant public WETH_ASSET_PROXY_ADDRESS = address(1);
|
||||
address constant public ZRX_VAULT_ADDRESS = address(1);
|
||||
address constant private WETH_ASSET_PROXY_ADDRESS = address(1);
|
||||
address constant private ZRX_VAULT_ADDRESS = address(1);
|
||||
|
||||
/// @dev Ensures that the WETH_ASSET_DATA is correct.
|
||||
constructor()
|
||||
public
|
||||
{
|
||||
// Ensure that the WETH_ASSET_DATA is correct.
|
||||
if (!WETH_ASSET_DATA.equals(
|
||||
abi.encodeWithSelector(
|
||||
require(
|
||||
WETH_ASSET_DATA.equals(abi.encodeWithSelector(
|
||||
IAssetData(address(0)).ERC20Token.selector,
|
||||
WETH_ADDRESS
|
||||
)
|
||||
)) {
|
||||
LibRichErrors.rrevert(LibStakingRichErrors.InvalidWethAssetDataError());
|
||||
}
|
||||
)),
|
||||
"INVALID_WETH_ASSET_DATA"
|
||||
);
|
||||
|
||||
require(
|
||||
WETH_ASSET_PROXY_ADDRESS != address(0),
|
||||
"WETH_ASSET_PROXY_MUST_BE_SET"
|
||||
);
|
||||
|
||||
require(
|
||||
ZRX_VAULT_ADDRESS != address(0),
|
||||
"ZRX_VAULT_MUST_BE_SET"
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev An overridable way to access the deployed WETH contract.
|
||||
@ -95,6 +103,9 @@ contract MixinDeploymentConstants {
|
||||
return wethAssetData;
|
||||
}
|
||||
|
||||
/// @dev An overridable way to access the deployed WETH assetProxy.
|
||||
/// Must be view to allow overrides to access state.
|
||||
/// @return wethAssetProxy The assetProxy used to transfer WETH.
|
||||
function _getWethAssetProxy()
|
||||
internal
|
||||
view
|
||||
@ -104,6 +115,9 @@ contract MixinDeploymentConstants {
|
||||
return wethAssetProxy;
|
||||
}
|
||||
|
||||
/// @dev An overridable way to access the deployed zrxVault.
|
||||
/// Must be view to allow overrides to access state.
|
||||
/// @return zrxVault The zrxVault contract.
|
||||
function _getZrxVault()
|
||||
internal
|
||||
view
|
||||
|
@ -133,10 +133,6 @@ library LibStakingRichErrors {
|
||||
bytes4 internal constant INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR =
|
||||
0xefd6cb33;
|
||||
|
||||
// bytes4(keccak256("InvalidWethAssetDataError()"))
|
||||
bytes internal constant INVALID_WETH_ASSET_DATA_ERROR =
|
||||
hex"24bf322c";
|
||||
|
||||
// bytes4(keccak256("PreviousEpochNotFinalizedError(uint256,uint256)"))
|
||||
bytes4 internal constant PREVIOUS_EPOCH_NOT_FINALIZED_ERROR_SELECTOR =
|
||||
0x614b800a;
|
||||
@ -407,14 +403,6 @@ library LibStakingRichErrors {
|
||||
return PROXY_DESTINATION_CANNOT_BE_NIL_ERROR;
|
||||
}
|
||||
|
||||
function InvalidWethAssetDataError()
|
||||
internal
|
||||
pure
|
||||
returns (bytes memory)
|
||||
{
|
||||
return INVALID_WETH_ASSET_DATA_ERROR;
|
||||
}
|
||||
|
||||
function PreviousEpochNotFinalizedError(
|
||||
uint256 unfinalizedEpoch,
|
||||
uint256 unfinalizedPoolsRemaining
|
||||
|
Loading…
x
Reference in New Issue
Block a user