@0x/contracts-storage: Move init() out of IStaking and into IStorageInit.
This commit is contained in:
@@ -22,7 +22,7 @@ import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||
import "./libs/LibProxy.sol";
|
||||
import "./immutable/MixinStorage.sol";
|
||||
import "./immutable/MixinHyperParameters.sol";
|
||||
import "./interfaces/IStaking.sol";
|
||||
import "./interfaces/IStorageInit.sol";
|
||||
import "./interfaces/IStakingProxy.sol";
|
||||
|
||||
contract StakingProxy is
|
||||
@@ -72,7 +72,7 @@ contract StakingProxy is
|
||||
readOnlyProxyCallee = _stakingContract;
|
||||
// Call `init()` on the staking contract to initialize storage.
|
||||
(bool didInitSucceed, bytes memory initReturnData) =
|
||||
_stakingContract.delegatecall(abi.encode(IStaking(0).init.selector));
|
||||
stakingContract.delegatecall(abi.encode(IStorageInit(0).init.selector));
|
||||
if (!didInitSucceed) {
|
||||
assembly { revert(add(initReturnData, 0x20), mload(initReturnData)) }
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@ pragma solidity ^0.5.9;
|
||||
|
||||
|
||||
interface IStaking {
|
||||
/// @dev Initialize storage owned by this contract.
|
||||
/// This function should not be called directly.
|
||||
/// The StakingProxy contract will call it in `attachStakingContract()`.
|
||||
function init() external;
|
||||
|
||||
/// @dev Pays a protocol fee in ETH.
|
||||
/// @param makerAddress The address of the order's maker.
|
||||
/// @param payerAddress The address that is responsible for paying the protocol fee.
|
||||
|
||||
25
contracts/staking/contracts/src/interfaces/IStorageInit.sol
Normal file
25
contracts/staking/contracts/src/interfaces/IStorageInit.sol
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
|
||||
interface IStorageInit {
|
||||
/// @dev Initialize storage owned by this contract.
|
||||
function init() external;
|
||||
}
|
||||
Reference in New Issue
Block a user