Separate immutable contracts, only inherit as needed
This commit is contained in:
@@ -22,13 +22,15 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "./libs/LibProxy.sol";
|
import "./libs/LibProxy.sol";
|
||||||
import "./libs/LibSafeDowncast.sol";
|
import "./libs/LibSafeDowncast.sol";
|
||||||
import "./immutable/MixinStorage.sol";
|
import "./immutable/MixinStorage.sol";
|
||||||
|
import "./immutable/MixinConstants.sol";
|
||||||
import "./interfaces/IStorageInit.sol";
|
import "./interfaces/IStorageInit.sol";
|
||||||
import "./interfaces/IStakingProxy.sol";
|
import "./interfaces/IStakingProxy.sol";
|
||||||
|
|
||||||
|
|
||||||
contract StakingProxy is
|
contract StakingProxy is
|
||||||
IStakingProxy,
|
IStakingProxy,
|
||||||
MixinStorage
|
MixinStorage,
|
||||||
|
MixinConstants
|
||||||
{
|
{
|
||||||
using LibProxy for address;
|
using LibProxy for address;
|
||||||
using LibSafeDowncast for uint256;
|
using LibSafeDowncast for uint256;
|
||||||
|
|||||||
@@ -18,28 +18,15 @@
|
|||||||
|
|
||||||
pragma solidity ^0.5.9;
|
pragma solidity ^0.5.9;
|
||||||
|
|
||||||
import "./MixinDeploymentConstants.sol";
|
|
||||||
|
|
||||||
|
contract MixinConstants {
|
||||||
|
|
||||||
contract MixinConstants is
|
|
||||||
MixinDeploymentConstants
|
|
||||||
{
|
|
||||||
// 100% in parts-per-million.
|
// 100% in parts-per-million.
|
||||||
uint32 constant internal PPM_DENOMINATOR = 10**6;
|
uint32 constant internal PPM_DENOMINATOR = 10**6;
|
||||||
|
|
||||||
// The upper 16 bytes represent the pool id, so this would be pool id 1. See MixinStakinPool for more information.
|
|
||||||
bytes32 constant internal INITIAL_POOL_ID = 0x0000000000000000000000000000000100000000000000000000000000000000;
|
|
||||||
|
|
||||||
// The upper 16 bytes represent the pool id, so this would be an increment of 1. See MixinStakinPool for more information.
|
|
||||||
uint256 constant internal POOL_ID_INCREMENT_AMOUNT = 0x0000000000000000000000000000000100000000000000000000000000000000;
|
|
||||||
|
|
||||||
bytes32 constant internal NIL_POOL_ID = 0x0000000000000000000000000000000000000000000000000000000000000000;
|
bytes32 constant internal NIL_POOL_ID = 0x0000000000000000000000000000000000000000000000000000000000000000;
|
||||||
|
|
||||||
address constant internal NIL_ADDRESS = 0x0000000000000000000000000000000000000000;
|
address constant internal NIL_ADDRESS = 0x0000000000000000000000000000000000000000;
|
||||||
|
|
||||||
bytes32 constant internal UNKNOWN_STAKING_POOL_ID = 0x0000000000000000000000000000000000000000000000000000000000000000;
|
|
||||||
|
|
||||||
uint64 constant internal INITIAL_EPOCH = 0;
|
|
||||||
|
|
||||||
uint256 constant internal MIN_TOKEN_VALUE = 10**18;
|
uint256 constant internal MIN_TOKEN_VALUE = 10**18;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import "../libs/LibStakingRichErrors.sol";
|
|||||||
|
|
||||||
// solhint-disable max-states-count, no-empty-blocks
|
// solhint-disable max-states-count, no-empty-blocks
|
||||||
contract MixinStorage is
|
contract MixinStorage is
|
||||||
MixinConstants,
|
|
||||||
Authorizable
|
Authorizable
|
||||||
{
|
{
|
||||||
// address of staking contract
|
// address of staking contract
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||||
import "../interfaces/IStructs.sol";
|
import "../interfaces/IStructs.sol";
|
||||||
|
import "../immutable/MixinDeploymentConstants.sol";
|
||||||
import "./MixinStakeStorage.sol";
|
import "./MixinStakeStorage.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinStakeBalances is
|
contract MixinStakeBalances is
|
||||||
MixinStakeStorage
|
MixinStakeStorage,
|
||||||
|
MixinDeploymentConstants
|
||||||
{
|
{
|
||||||
using LibSafeMath for uint256;
|
using LibSafeMath for uint256;
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "@0x/contracts-utils/contracts/src/LibFractions.sol";
|
import "@0x/contracts-utils/contracts/src/LibFractions.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||||
import "../stake/MixinStakeBalances.sol";
|
import "../stake/MixinStakeBalances.sol";
|
||||||
|
import "../immutable/MixinConstants.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinCumulativeRewards is
|
contract MixinCumulativeRewards is
|
||||||
MixinStakeBalances
|
MixinStakeBalances,
|
||||||
|
MixinConstants
|
||||||
{
|
{
|
||||||
using LibSafeMath for uint256;
|
using LibSafeMath for uint256;
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ 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 "../immutable/MixinConstants.sol";
|
||||||
import "../interfaces/IStakingEvents.sol";
|
import "../interfaces/IStakingEvents.sol";
|
||||||
import "../libs/LibStakingRichErrors.sol";
|
import "../libs/LibStakingRichErrors.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinParams is
|
contract MixinParams is
|
||||||
IStakingEvents,
|
IStakingEvents,
|
||||||
MixinStorage
|
MixinStorage,
|
||||||
|
MixinConstants
|
||||||
{
|
{
|
||||||
/// @dev Set all configurable parameters at once.
|
/// @dev Set all configurable parameters at once.
|
||||||
/// @param _epochDurationInSeconds Minimum seconds between epochs.
|
/// @param _epochDurationInSeconds Minimum seconds between epochs.
|
||||||
|
|||||||
Reference in New Issue
Block a user