Skip to content

Commit

Permalink
Move interfaces into separate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Oct 25, 2024
1 parent 45c78a3 commit 6ba9acb
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 17 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

interface NodeDriverI {
interface INodeDriver {
function setGenesisValidator(
address _auth,
uint256 validatorID,
Expand Down
6 changes: 6 additions & 0 deletions contracts/interfaces/INodeDriverExecutable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

interface INodeDriverExecutable {
function execute() external;
}
2 changes: 1 addition & 1 deletion contracts/sfc/SFCI.sol → contracts/interfaces/ISfc.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

interface SFCI {
interface ISfc {
event CreatedValidator(
uint256 indexed validatorID,
address indexed auth,
Expand Down
4 changes: 2 additions & 2 deletions contracts/sfc/NetworkInitializer.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import {SFCI} from "./SFCI.sol";
import {ISfc} from "../interfaces/ISfc.sol";
import {NodeDriver, NodeDriverAuth} from "./NodeDriver.sol";
import {ConstantsManager} from "./ConstantsManager.sol";
import {Decimal} from "../common/Decimal.sol";
Expand Down Expand Up @@ -40,6 +40,6 @@ contract NetworkInitializer {
consts.updateGasPriceBalancingCounterweight(3600);
consts.transferOwnership(_owner);

SFCI(_sfc).initialize(sealedEpoch, totalSupply, _auth, _lib, address(consts), _owner);
ISfc(_sfc).initialize(sealedEpoch, totalSupply, _auth, _lib, address(consts), _owner);
}
}
2 changes: 1 addition & 1 deletion contracts/sfc/NodeDriver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.9;

import {Initializable} from "../common/Initializable.sol";
import {NodeDriverAuth} from "./NodeDriverAuth.sol";
import {IEvmWriter} from "../interfaces/IEVMWriter.sol";
import {IEvmWriter} from "../interfaces/IEvmWriter.sol";

contract NodeDriver is Initializable {
NodeDriverAuth internal backend;
Expand Down
13 changes: 5 additions & 8 deletions contracts/sfc/NodeDriverAuth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ pragma solidity ^0.8.9;

import {Initializable} from "../common/Initializable.sol";
import {Ownable} from "../ownership/Ownable.sol";
import {SFCI} from "./SFCI.sol";
import {ISfc} from "../interfaces/ISfc.sol";
import {NodeDriver} from "./NodeDriver.sol";

interface NodeDriverExecutable {
function execute() external;
}
import {INodeDriverExecutable} from "../interfaces/INodeDriverExecutable.sol";

contract NodeDriverAuth is Initializable, Ownable {
SFCI internal sfc;
ISfc internal sfc;
NodeDriver internal driver;

error NotSFC();
Expand All @@ -25,7 +22,7 @@ contract NodeDriverAuth is Initializable, Ownable {
function initialize(address payable _sfc, address _driver, address _owner) external initializer {
Ownable.initialize(_owner);
driver = NodeDriver(_driver);
sfc = SFCI(_sfc);
sfc = ISfc(_sfc);
}

modifier onlySFC() {
Expand All @@ -48,7 +45,7 @@ contract NodeDriverAuth is Initializable, Ownable {

function _execute(address executable, address newOwner, bytes32 selfCodeHash, bytes32 driverCodeHash) internal {
_transferOwnership(executable);
NodeDriverExecutable(executable).execute();
INodeDriverExecutable(executable).execute();
_transferOwnership(newOwner);
//require(driver.backend() == address(this), "ownership of driver is lost");
if (_getCodeHash(address(this)) != selfCodeHash) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/sfc/Updater.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Decimal} from "../common/Decimal.sol";
import {NodeDriverAuth} from "./NodeDriverAuth.sol";
import {ConstantsManager} from "./ConstantsManager.sol";
import {SFC} from "./SFC.sol";
import {SFCI} from "./SFCI.sol";
import {ISfc} from "../interfaces/ISfc.sol";
import {Version} from "../version/Version.sol";

interface GovI {
Expand Down Expand Up @@ -104,8 +104,8 @@ contract Updater {

NodeDriverAuth nodeAuth = NodeDriverAuth(0xD100ae0000000000000000000000000000000000);
nodeAuth.upgradeCode(sfcTo, sfcFrom);
SFCI(sfcTo).updateConstsAddress(sfcConsts);
SFCI(sfcTo).updateVoteBookAddress(voteBook);
ISfc(sfcTo).updateConstsAddress(sfcConsts);
ISfc(sfcTo).updateVoteBookAddress(voteBook);
SFC(sfcTo).updateLibAddress(sfcLib);

nodeAuth.upgradeCode(govTo, govFrom);
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/StubEvmWriter.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import {IEvmWriter} from "../interfaces/IEVMWriter.sol";
import {IEvmWriter} from "../interfaces/IEvmWriter.sol";

contract StubEvmWriter is IEvmWriter {
function setBalance(address acc, uint256 value) external {}
Expand Down

0 comments on commit 6ba9acb

Please sign in to comment.