Make deployment constant getters public

This commit is contained in:
Amir Bandeali 2019-09-24 16:43:08 -07:00
parent 85e56706bf
commit 1b159f5ccc
9 changed files with 37 additions and 41 deletions

View File

@ -69,8 +69,8 @@ contract MixinExchangeFees is
// Transfer the protocol fee to this address if it should be paid in
// WETH.
if (msg.value == 0) {
_getWethAssetProxy().transferFrom(
_getWethAssetData(),
getWethAssetProxy().transferFrom(
getWethAssetData(),
payerAddress,
address(this),
protocolFeePaid

View File

@ -82,8 +82,8 @@ contract MixinDeploymentConstants {
/// @dev An overridable way to access the deployed WETH contract.
/// Must be view to allow overrides to access state.
/// @return wethContract The WETH contract instance.
function _getWethContract()
internal
function getWethContract()
public
view
returns (IEtherToken wethContract)
{
@ -94,8 +94,8 @@ contract MixinDeploymentConstants {
/// @dev An overridable way to access the deployed WETH assetData.
/// Must be view to allow overrides to access state.
/// @return wethAssetData The assetData of the configured WETH contract.
function _getWethAssetData()
internal
function getWethAssetData()
public
view
returns (bytes memory wethAssetData)
{
@ -106,8 +106,8 @@ contract MixinDeploymentConstants {
/// @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
function getWethAssetProxy()
public
view
returns (IAssetProxy wethAssetProxy)
{
@ -118,8 +118,8 @@ contract MixinDeploymentConstants {
/// @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
function getZrxVault()
public
view
returns (IZrxVault zrxVault)
{

View File

@ -50,7 +50,7 @@ contract MixinStake is
address payable owner = msg.sender;
// deposit equivalent amount of ZRX into vault
_getZrxVault().depositFrom(owner, amount);
getZrxVault().depositFrom(owner, amount);
// mint stake
_incrementCurrentAndNextBalance(_activeStakeByOwner[owner], amount);
@ -96,7 +96,7 @@ contract MixinStake is
currentWithdrawableStake.safeSub(amount);
// withdraw equivalent amount of ZRX from vault
_getZrxVault().withdrawFrom(owner, amount);
getZrxVault().withdrawFrom(owner, amount);
// emit stake event
emit Unstake(
@ -211,7 +211,7 @@ contract MixinStake is
// Increment how much stake has been delegated to pool.
_incrementNextBalance(_delegatedStakeByPoolId[poolId], amount);
// Synchronizes reward state in the pool that the staker is delegating
// Synchronizes reward state in the pool that the owner is delegating
// to.
IStructs.StoredBalance memory finalDelegatedStakeToPoolByOwner =
_loadSyncedBalance(_delegatedStakeToPoolByOwner[owner][poolId]);
@ -251,7 +251,7 @@ contract MixinStake is
// decrement how much stake has been delegated to pool
_decrementNextBalance(_delegatedStakeByPoolId[poolId], amount);
// synchronizes reward state in the pool that the staker is undelegating
// synchronizes reward state in the pool that the owner is undelegating
// from
IStructs.StoredBalance memory finalDelegatedStakeToPoolByOwner =
_loadSyncedBalance(_delegatedStakeToPoolByOwner[owner][poolId]);

View File

@ -92,7 +92,7 @@ contract MixinStakeBalances is
view
returns (uint256)
{
return _getZrxVault().balanceOf(owner);
return getZrxVault().balanceOf(owner);
}
/// @dev Returns the active stake for a given owner.

View File

@ -184,7 +184,7 @@ contract MixinStakingPoolRewards is
if (operatorReward > 0) {
// Transfer the operator's weth reward to the operator
_getWethContract().transfer(pool.operator, operatorReward);
getWethContract().transfer(pool.operator, operatorReward);
}
if (membersReward > 0) {
@ -283,7 +283,7 @@ contract MixinStakingPoolRewards is
_decreasePoolRewards(poolId, balance);
// Withdraw the member's WETH balance
_getWethContract().transfer(member, balance);
getWethContract().transfer(member, balance);
}
/// @dev Computes the reward balance in ETH of a specific member of a pool.

View File

@ -245,7 +245,7 @@ contract MixinFinalizer is
{
uint256 ethBalance = address(this).balance;
if (ethBalance != 0) {
_getWethContract().deposit.value(ethBalance)();
getWethContract().deposit.value(ethBalance)();
}
}
@ -256,7 +256,7 @@ contract MixinFinalizer is
view
returns (uint256 wethBalance)
{
wethBalance = _getWethContract().balanceOf(address(this))
wethBalance = getWethContract().balanceOf(address(this))
.safeSub(wethReservedForPoolRewards);
return wethBalance;

View File

@ -91,10 +91,6 @@ contract TestProtocolFees is
emit ERC20ProxyTransferFrom(assetData, from, to, amount);
}
function getWethAssetData() external view returns (bytes memory) {
return _getWethAssetData();
}
/// @dev Overridden to use test pools.
function getStakingPoolIdOfMaker(address makerAddress)
public
@ -131,8 +127,8 @@ contract TestProtocolFees is
});
}
function _getWethAssetProxy()
internal
function getWethAssetProxy()
public
view
returns (IAssetProxy wethAssetProxy)
{

View File

@ -43,8 +43,8 @@ contract TestStaking is
}
/// @dev Overridden to use testWethAddress;
function _getWethContract()
internal
function getWethContract()
public
view
returns (IEtherToken)
{
@ -55,8 +55,8 @@ contract TestStaking is
return IEtherToken(wethAddress);
}
function _getWethAssetData()
internal
function getWethAssetData()
public
view
returns (bytes memory)
{
@ -67,8 +67,8 @@ contract TestStaking is
);
}
function _getWethAssetProxy()
internal
function getWethAssetProxy()
public
view
returns (IAssetProxy wethAssetProxy)
{
@ -77,8 +77,8 @@ contract TestStaking is
return wethAssetProxy;
}
function _getZrxVault()
internal
function getZrxVault()
public
view
returns (IZrxVault zrxVault)
{

View File

@ -42,6 +42,14 @@ contract TestStakingNoWETH is
return true;
}
function getWethContract()
public
view
returns (IEtherToken)
{
return IEtherToken(address(this));
}
function _wrapEth()
internal
{}
@ -53,12 +61,4 @@ contract TestStakingNoWETH is
{
return address(this).balance;
}
function _getWethContract()
internal
view
returns (IEtherToken)
{
return IEtherToken(address(this));
}
}