Set wethAssetProxy, ethVault, rewardVault, and zrxVault using init pattern
This commit is contained in:
@@ -35,13 +35,28 @@ contract StakingProxy is
|
|||||||
/// @param _stakingContract Staking contract to delegate calls to.
|
/// @param _stakingContract Staking contract to delegate calls to.
|
||||||
/// @param _readOnlyProxy The address of the read only proxy.
|
/// @param _readOnlyProxy The address of the read only proxy.
|
||||||
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
constructor(address _stakingContract, address _readOnlyProxy, address _wethProxyAddress)
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
constructor(
|
||||||
|
address _stakingContract,
|
||||||
|
address _readOnlyProxy,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
public
|
public
|
||||||
MixinStorage()
|
MixinStorage()
|
||||||
{
|
{
|
||||||
readOnlyProxy = _readOnlyProxy;
|
readOnlyProxy = _readOnlyProxy;
|
||||||
wethAssetProxy = IAssetProxy(_wethProxyAddress);
|
_attachStakingContract(
|
||||||
_attachStakingContract(_stakingContract);
|
_stakingContract,
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Delegates calls to the staking contract, if it is set.
|
/// @dev Delegates calls to the staking contract, if it is set.
|
||||||
@@ -59,11 +74,27 @@ contract StakingProxy is
|
|||||||
/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
|
/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
|
||||||
/// Note that this is callable only by this contract's owner.
|
/// Note that this is callable only by this contract's owner.
|
||||||
/// @param _stakingContract Address of staking contract.
|
/// @param _stakingContract Address of staking contract.
|
||||||
function attachStakingContract(address _stakingContract)
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function attachStakingContract(
|
||||||
|
address _stakingContract,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
external
|
external
|
||||||
onlyOwner
|
onlyOwner
|
||||||
{
|
{
|
||||||
_attachStakingContract(_stakingContract);
|
_attachStakingContract(
|
||||||
|
_stakingContract,
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Detach the current staking contract.
|
/// @dev Detach the current staking contract.
|
||||||
@@ -132,13 +163,30 @@ contract StakingProxy is
|
|||||||
|
|
||||||
/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
|
/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
|
||||||
/// @param _stakingContract Address of staking contract.
|
/// @param _stakingContract Address of staking contract.
|
||||||
function _attachStakingContract(address _stakingContract)
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function _attachStakingContract(
|
||||||
|
address _stakingContract,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
private
|
private
|
||||||
{
|
{
|
||||||
stakingContract = readOnlyProxyCallee = _stakingContract;
|
stakingContract = readOnlyProxyCallee = _stakingContract;
|
||||||
// Call `init()` on the staking contract to initialize storage.
|
// Call `init()` on the staking contract to initialize storage.
|
||||||
(bool didInitSucceed, bytes memory initReturnData) =
|
(bool didInitSucceed, bytes memory initReturnData) = _stakingContract.delegatecall(
|
||||||
_stakingContract.delegatecall(abi.encode(IStorageInit(0).init.selector));
|
abi.encodeWithSelector(
|
||||||
|
IStorageInit(0).init.selector,
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
)
|
||||||
|
);
|
||||||
if (!didInitSucceed) {
|
if (!didInitSucceed) {
|
||||||
assembly { revert(add(initReturnData, 0x20), mload(initReturnData)) }
|
assembly { revert(add(initReturnData, 0x20), mload(initReturnData)) }
|
||||||
}
|
}
|
||||||
|
@@ -60,13 +60,19 @@ interface IStakingEvents {
|
|||||||
/// @param maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
/// @param maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
||||||
/// @param cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
/// @param cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
||||||
/// @param cobbDouglasAlphaDenomintor Denominator for cobb douglas alpha factor.
|
/// @param cobbDouglasAlphaDenomintor Denominator for cobb douglas alpha factor.
|
||||||
event ParamsChanged(
|
/// @param ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
event ParamsSet(
|
||||||
uint256 epochDurationInSeconds,
|
uint256 epochDurationInSeconds,
|
||||||
uint32 rewardDelegatedStakeWeight,
|
uint32 rewardDelegatedStakeWeight,
|
||||||
uint256 minimumPoolStake,
|
uint256 minimumPoolStake,
|
||||||
uint256 maximumMakersInPool,
|
uint256 maximumMakersInPool,
|
||||||
uint256 cobbDouglasAlphaNumerator,
|
uint256 cobbDouglasAlphaNumerator,
|
||||||
uint256 cobbDouglasAlphaDenomintor
|
uint256 cobbDouglasAlphaDenomintor,
|
||||||
|
address ethVaultAddress,
|
||||||
|
address rewardVaultAddress,
|
||||||
|
address zrxVaultAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
/// @dev Emitted by MixinScheduler when the timeLock period is changed.
|
/// @dev Emitted by MixinScheduler when the timeLock period is changed.
|
||||||
|
@@ -22,5 +22,15 @@ pragma solidity ^0.5.9;
|
|||||||
interface IStorageInit {
|
interface IStorageInit {
|
||||||
|
|
||||||
/// @dev Initialize storage owned by this contract.
|
/// @dev Initialize storage owned by this contract.
|
||||||
function init() external;
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function init(
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
|
external;
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,11 @@ library LibStakingRichErrors {
|
|||||||
enum InvalidParamValueErrorCode {
|
enum InvalidParamValueErrorCode {
|
||||||
InvalidCobbDouglasAlpha,
|
InvalidCobbDouglasAlpha,
|
||||||
InvalidRewardDelegatedStakeWeight,
|
InvalidRewardDelegatedStakeWeight,
|
||||||
InvalidMaximumMakersInPool
|
InvalidMaximumMakersInPool,
|
||||||
|
InvalidWethProxyAddress,
|
||||||
|
InvalidEthVaultAddress,
|
||||||
|
InvalidRewardVaultAddress,
|
||||||
|
InvalidZrxVaultAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MakerPoolAssignmentErrorCodes {
|
enum MakerPoolAssignmentErrorCodes {
|
||||||
|
@@ -21,6 +21,9 @@ pragma solidity ^0.5.9;
|
|||||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||||
import "../immutable/MixinStorage.sol";
|
import "../immutable/MixinStorage.sol";
|
||||||
import "../interfaces/IStakingEvents.sol";
|
import "../interfaces/IStakingEvents.sol";
|
||||||
|
import "../interfaces/IEthVault.sol";
|
||||||
|
import "../interfaces/IStakingPoolRewardVault.sol";
|
||||||
|
import "../interfaces/IZrxVault.sol";
|
||||||
import "../libs/LibStakingRichErrors.sol";
|
import "../libs/LibStakingRichErrors.sol";
|
||||||
|
|
||||||
|
|
||||||
@@ -34,39 +37,37 @@ contract MixinParams is
|
|||||||
/// @param _minimumPoolStake Minimum amount of stake required in a pool to collect rewards.
|
/// @param _minimumPoolStake Minimum amount of stake required in a pool to collect rewards.
|
||||||
/// @param _maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
/// @param _maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
||||||
/// @param _cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
/// @param _cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
||||||
/// @param _cobbDouglasAlphaDenomintor Denominator for cobb douglas alpha factor.
|
/// @param _cobbDouglasAlphaDenominator Denominator for cobb douglas alpha factor.
|
||||||
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
function setParams(
|
function setParams(
|
||||||
uint256 _epochDurationInSeconds,
|
uint256 _epochDurationInSeconds,
|
||||||
uint32 _rewardDelegatedStakeWeight,
|
uint32 _rewardDelegatedStakeWeight,
|
||||||
uint256 _minimumPoolStake,
|
uint256 _minimumPoolStake,
|
||||||
uint256 _maximumMakersInPool,
|
uint256 _maximumMakersInPool,
|
||||||
uint32 _cobbDouglasAlphaNumerator,
|
uint32 _cobbDouglasAlphaNumerator,
|
||||||
uint32 _cobbDouglasAlphaDenomintor
|
uint32 _cobbDouglasAlphaDenominator,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
onlyOwner
|
onlyOwner
|
||||||
{
|
{
|
||||||
_assertValidRewardDelegatedStakeWeight(_rewardDelegatedStakeWeight);
|
_setParams(
|
||||||
_assertValidMaximumMakersInPool(_maximumMakersInPool);
|
_epochDurationInSeconds,
|
||||||
_assertValidCobbDouglasAlpha(
|
_rewardDelegatedStakeWeight,
|
||||||
|
_minimumPoolStake,
|
||||||
|
_maximumMakersInPool,
|
||||||
_cobbDouglasAlphaNumerator,
|
_cobbDouglasAlphaNumerator,
|
||||||
_cobbDouglasAlphaDenomintor
|
_cobbDouglasAlphaDenominator,
|
||||||
);
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
epochDurationInSeconds = _epochDurationInSeconds;
|
_rewardVaultAddress,
|
||||||
rewardDelegatedStakeWeight = _rewardDelegatedStakeWeight;
|
_zrxVaultAddress
|
||||||
minimumPoolStake = _minimumPoolStake;
|
|
||||||
maximumMakersInPool = _maximumMakersInPool;
|
|
||||||
cobbDouglasAlphaNumerator = _cobbDouglasAlphaNumerator;
|
|
||||||
cobbDouglasAlphaDenomintor = _cobbDouglasAlphaDenomintor;
|
|
||||||
|
|
||||||
emit ParamsChanged(
|
|
||||||
epochDurationInSeconds,
|
|
||||||
rewardDelegatedStakeWeight,
|
|
||||||
minimumPoolStake,
|
|
||||||
maximumMakersInPool,
|
|
||||||
cobbDouglasAlphaNumerator,
|
|
||||||
cobbDouglasAlphaDenomintor
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +77,11 @@ contract MixinParams is
|
|||||||
/// @return _minimumPoolStake Minimum amount of stake required in a pool to collect rewards.
|
/// @return _minimumPoolStake Minimum amount of stake required in a pool to collect rewards.
|
||||||
/// @return _maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
/// @return _maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
||||||
/// @return _cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
/// @return _cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
||||||
/// @return _cobbDouglasAlphaDenomintor Denominator for cobb douglas alpha factor.
|
/// @return _cobbDouglasAlphaDenominator Denominator for cobb douglas alpha factor.
|
||||||
|
/// @return _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @return _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @return _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @return _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
function getParams()
|
function getParams()
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
@@ -86,7 +91,11 @@ contract MixinParams is
|
|||||||
uint256 _minimumPoolStake,
|
uint256 _minimumPoolStake,
|
||||||
uint256 _maximumMakersInPool,
|
uint256 _maximumMakersInPool,
|
||||||
uint32 _cobbDouglasAlphaNumerator,
|
uint32 _cobbDouglasAlphaNumerator,
|
||||||
uint32 _cobbDouglasAlphaDenomintor
|
uint32 _cobbDouglasAlphaDenominator,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_epochDurationInSeconds = epochDurationInSeconds;
|
_epochDurationInSeconds = epochDurationInSeconds;
|
||||||
@@ -94,7 +103,11 @@ contract MixinParams is
|
|||||||
_minimumPoolStake = minimumPoolStake;
|
_minimumPoolStake = minimumPoolStake;
|
||||||
_maximumMakersInPool = maximumMakersInPool;
|
_maximumMakersInPool = maximumMakersInPool;
|
||||||
_cobbDouglasAlphaNumerator = cobbDouglasAlphaNumerator;
|
_cobbDouglasAlphaNumerator = cobbDouglasAlphaNumerator;
|
||||||
_cobbDouglasAlphaDenomintor = cobbDouglasAlphaDenomintor;
|
_cobbDouglasAlphaDenominator = cobbDouglasAlphaDenomintor;
|
||||||
|
_wethProxyAddress = address(wethAssetProxy);
|
||||||
|
_ethVaultAddress = address(ethVault);
|
||||||
|
_rewardVaultAddress = address(rewardVault);
|
||||||
|
_zrxVaultAddress = address(_zrxVaultAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Assert param values before initializing them.
|
/// @dev Assert param values before initializing them.
|
||||||
@@ -108,7 +121,11 @@ contract MixinParams is
|
|||||||
minimumPoolStake != 0 &&
|
minimumPoolStake != 0 &&
|
||||||
maximumMakersInPool != 0 &&
|
maximumMakersInPool != 0 &&
|
||||||
cobbDouglasAlphaNumerator != 0 &&
|
cobbDouglasAlphaNumerator != 0 &&
|
||||||
cobbDouglasAlphaDenomintor != 0
|
cobbDouglasAlphaDenomintor != 0 &&
|
||||||
|
address(wethAssetProxy) != NIL_ADDRESS &&
|
||||||
|
address(ethVault) != NIL_ADDRESS &&
|
||||||
|
address(rewardVault) != NIL_ADDRESS &&
|
||||||
|
address(zrxVault) != NIL_ADDRESS
|
||||||
) {
|
) {
|
||||||
LibRichErrors.rrevert(
|
LibRichErrors.rrevert(
|
||||||
LibStakingRichErrors.InitializationError(
|
LibStakingRichErrors.InitializationError(
|
||||||
@@ -118,20 +135,105 @@ contract MixinParams is
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Initialize storage belonging to this mixin.
|
/// @dev Initialzize storage belonging to this mixin.
|
||||||
function _initMixinParams()
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function _initMixinParams(
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
// assert the current values before overwriting them.
|
// assert the current values before overwriting them.
|
||||||
_assertMixinParamsBeforeInit();
|
_assertMixinParamsBeforeInit();
|
||||||
|
|
||||||
// Set up defaults.
|
// Set up defaults.
|
||||||
epochDurationInSeconds = 2 weeks;
|
_epochDurationInSeconds = 2 weeks;
|
||||||
rewardDelegatedStakeWeight = (90 * PPM_DENOMINATOR) / 100; // 90%
|
_rewardDelegatedStakeWeight = (90 * PPM_DENOMINATOR) / 100; // 90%
|
||||||
minimumPoolStake = 100 * MIN_TOKEN_VALUE; // 100 ZRX
|
_minimumPoolStake = 100 * MIN_TOKEN_VALUE; // 100 ZRX
|
||||||
maximumMakersInPool = 10;
|
_maximumMakersInPool = 10;
|
||||||
cobbDouglasAlphaNumerator = 1;
|
_cobbDouglasAlphaNumerator = 1;
|
||||||
cobbDouglasAlphaDenomintor = 2;
|
_cobbDouglasAlphaDenomintor = 2;
|
||||||
|
_setParams(
|
||||||
|
_epochDurationInSeconds,
|
||||||
|
_rewardDelegatedStakeWeight,
|
||||||
|
_minimumPoolStake,
|
||||||
|
_maximumMakersInPool,
|
||||||
|
_cobbDouglasAlphaNumerator,
|
||||||
|
_cobbDouglasAlphaDenomintor,
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Set all configurable parameters at once.
|
||||||
|
/// @param _epochDurationInSeconds Minimum seconds between epochs.
|
||||||
|
/// @param _rewardDelegatedStakeWeight How much delegated stake is weighted vs operator stake, in ppm.
|
||||||
|
/// @param _minimumPoolStake Minimum amount of stake required in a pool to collect rewards.
|
||||||
|
/// @param _maximumMakersInPool Maximum number of maker addresses allowed to be registered to a pool.
|
||||||
|
/// @param _cobbDouglasAlphaNumerator Numerator for cobb douglas alpha factor.
|
||||||
|
/// @param _cobbDouglasAlphaDenominator Denominator for cobb douglas alpha factor.
|
||||||
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function _setParams(
|
||||||
|
uint256 _epochDurationInSeconds,
|
||||||
|
uint32 _rewardDelegatedStakeWeight,
|
||||||
|
uint256 _minimumPoolStake,
|
||||||
|
uint256 _maximumMakersInPool,
|
||||||
|
uint32 _cobbDouglasAlphaNumerator,
|
||||||
|
uint32 _cobbDouglasAlphaDenominator,
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
|
_assertValidRewardDelegatedStakeWeight(_rewardDelegatedStakeWeight);
|
||||||
|
_assertValidMaximumMakersInPool(_maximumMakersInPool);
|
||||||
|
_assertValidCobbDouglasAlpha(
|
||||||
|
_cobbDouglasAlphaNumerator,
|
||||||
|
_cobbDouglasAlphaDenominator
|
||||||
|
);
|
||||||
|
_assertValidAddresses(
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
);
|
||||||
|
// TODO: set boundaries on some of these params
|
||||||
|
|
||||||
|
epochDurationInSeconds = _epochDurationInSeconds;
|
||||||
|
rewardDelegatedStakeWeight = _rewardDelegatedStakeWeight;
|
||||||
|
minimumPoolStake = _minimumPoolStake;
|
||||||
|
maximumMakersInPool = _maximumMakersInPool;
|
||||||
|
cobbDouglasAlphaNumerator = _cobbDouglasAlphaNumerator;
|
||||||
|
cobbDouglasAlphaDenomintor = _cobbDouglasAlphaDenominator;
|
||||||
|
wethAssetProxy = IAssetProxy(_wethProxyAddress);
|
||||||
|
ethVault = IEthVault(_ethVaultAddress);
|
||||||
|
rewardVault = IStakingPoolRewardVault(_rewardVaultAddress);
|
||||||
|
zrxVault = IZrxVault(_zrxVaultAddress);
|
||||||
|
|
||||||
|
emit ParamsSet(
|
||||||
|
_epochDurationInSeconds,
|
||||||
|
_rewardDelegatedStakeWeight,
|
||||||
|
_minimumPoolStake,
|
||||||
|
_maximumMakersInPool,
|
||||||
|
_cobbDouglasAlphaNumerator,
|
||||||
|
_cobbDouglasAlphaDenominator,
|
||||||
|
_wethProxyAddress,
|
||||||
|
_ethVaultAddress,
|
||||||
|
_rewardVaultAddress,
|
||||||
|
_zrxVaultAddress
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Asserts that cobb douglas alpha values are valid.
|
/// @dev Asserts that cobb douglas alpha values are valid.
|
||||||
@@ -184,4 +286,47 @@ contract MixinParams is
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @dev Asserts that passed in addresses are non-zero.
|
||||||
|
/// @param _wethProxyAddress The address that can transfer WETH for fees.
|
||||||
|
/// @param _ethVaultAddress Address of the EthVault contract.
|
||||||
|
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract.
|
||||||
|
/// @param _zrxVaultAddress Address of the ZrxVault contract.
|
||||||
|
function _assertValidVaultAddresses(
|
||||||
|
address _wethProxyAddress,
|
||||||
|
address _ethVaultAddress,
|
||||||
|
address _rewardVaultAddress,
|
||||||
|
address _zrxVaultAddress
|
||||||
|
)
|
||||||
|
private
|
||||||
|
pure
|
||||||
|
{
|
||||||
|
if (_wethProxyAddress == NIL_ADDRESS) {
|
||||||
|
LibRichErrors.rrevert(
|
||||||
|
LibStakingRichErrors.InvalidParamValueError(
|
||||||
|
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidWethProxyAddress
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_ethVaultAddress == NIL_ADDRESS) {
|
||||||
|
LibRichErrors.rrevert(
|
||||||
|
LibStakingRichErrors.InvalidParamValueError(
|
||||||
|
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidEthVaultAddress
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_rewardVaultAddress == NIL_ADDRESS) {
|
||||||
|
LibRichErrors.rrevert(
|
||||||
|
LibStakingRichErrors.InvalidParamValueError(
|
||||||
|
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidRewardVaultAddress
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_zrxVaultAddress == NIL_ADDRESS) {
|
||||||
|
LibRichErrors.rrevert(
|
||||||
|
LibStakingRichErrors.InvalidParamValueError(
|
||||||
|
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidZrxVaultAddress
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user