Skip to content

Commit

Permalink
feat: modify repo structure and rename BC_fusion/System.sol to System…
Browse files Browse the repository at this point in the history
…V2.sol (#588)

* feat: modify repo structure and rename BC_fusion/System.sol to SystemV2.sol

* feat: modify genesis generate script since repo structure changed

* chores: modify lint cmt to fit repo structure changes

* chores: lint contracts code

* feat: add deprecated folder and move some contracts to it

* fix: genesis generate script

* fix: update foundry toolchain version

* chores: lint contracts

* feat: remove BC_fusion folder and move contracts to root dir

* fix: genesis generate script

* chores: modify fmt script

* chores: modify foundry toolchain

* feat: rename lib and interface folder

* feat: remove unused BEP20Token.template

* feat: remove unused mock
  • Loading branch information
cosinlink authored Aug 23, 2024
1 parent 93c2e37 commit c2638fb
Show file tree
Hide file tree
Showing 63 changed files with 152 additions and 833 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorTimelo
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorPreventLateQuorumUpgradeable.sol";

import "./System.sol";
import "./SystemV2.sol";
import "./extension/Protectable.sol";
import "./lib/Utils.sol";
import "./interface/IGovToken.sol";
import "./lib/0.8.x/Utils.sol";
import "./interface/0.8.x/IGovToken.sol";

contract BSCGovernor is
System,
SystemV2,
Initializable,
Protectable,
GovernorUpgradeable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity 0.8.17;

import "@openzeppelin/contracts-upgradeable/governance/TimelockControllerUpgradeable.sol";

import "./System.sol";
import "./lib/Utils.sol";
import "./SystemV2.sol";
import "./lib/0.8.x/Utils.sol";

contract BSCTimelock is System, Initializable, TimelockControllerUpgradeable {
contract BSCTimelock is SystemV2, Initializable, TimelockControllerUpgradeable {
using Utils for bytes;
using Utils for string;

Expand Down
28 changes: 14 additions & 14 deletions contracts/BSCValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ pragma solidity 0.6.4;
pragma experimental ABIEncoderV2;

import "./System.sol";
import "./lib/BytesLib.sol";
import "./lib/BytesToTypes.sol";
import "./lib/Memory.sol";
import "./interface/ILightClient.sol";
import "./interface/ISlashIndicator.sol";
import "./interface/ITokenHub.sol";
import "./interface/IRelayerHub.sol";
import "./interface/IParamSubscriber.sol";
import "./interface/IBSCValidatorSet.sol";
import "./interface/IApplication.sol";
import "./interface/IStakeHub.sol";
import "./lib/SafeMath.sol";
import "./lib/RLPDecode.sol";
import "./lib/CmnPkg.sol";
import "./lib/0.6.x/BytesLib.sol";
import "./lib/0.6.x/BytesToTypes.sol";
import "./lib/0.6.x/Memory.sol";
import "./interface/0.6.x/ILightClient.sol";
import "./interface/0.6.x/ISlashIndicator.sol";
import "./interface/0.6.x/ITokenHub.sol";
import "./interface/0.6.x/IRelayerHub.sol";
import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/IBSCValidatorSet.sol";
import "./interface/0.6.x/IApplication.sol";
import "./interface/0.6.x/IStakeHub.sol";
import "./lib/0.6.x/SafeMath.sol";
import "./lib/0.6.x/RLPDecode.sol";
import "./lib/0.6.x/CmnPkg.sol";

interface ICrossChain {
function registeredContractChannelMap(address, uint8) external view returns (bool);
Expand Down
14 changes: 7 additions & 7 deletions contracts/GovHub.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pragma solidity 0.6.4;

import "./System.sol";
import "./lib/BytesToTypes.sol";
import "./lib/Memory.sol";
import "./lib/BytesLib.sol";
import "./interface/IParamSubscriber.sol";
import "./interface/IApplication.sol";
import "./lib/RLPDecode.sol";
import "./lib/CmnPkg.sol";
import "./lib/0.6.x/BytesToTypes.sol";
import "./lib/0.6.x/Memory.sol";
import "./lib/0.6.x/BytesLib.sol";
import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/IApplication.sol";
import "./lib/0.6.x/RLPDecode.sol";
import "./lib/0.6.x/CmnPkg.sol";

contract GovHub is System, IApplication {
using RLPDecode for *;
Expand Down
6 changes: 3 additions & 3 deletions contracts/BC_fusion/GovToken.sol → contracts/GovToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20Burnable
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";

import "./System.sol";
import "./interface/IStakeCredit.sol";
import "./SystemV2.sol";
import "./interface/0.8.x/IStakeCredit.sol";

contract GovToken is
System,
SystemV2,
Initializable,
ERC20Upgradeable,
ERC20BurnableUpgradeable,
Expand Down
26 changes: 13 additions & 13 deletions contracts/SlashIndicator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ pragma solidity 0.6.4;
pragma experimental ABIEncoderV2;

import "./System.sol";
import "./lib/BytesToTypes.sol";
import "./lib/TypesToBytes.sol";
import "./lib/BytesLib.sol";
import "./lib/Memory.sol";
import "./interface/ISlashIndicator.sol";
import "./interface/IApplication.sol";
import "./interface/IBSCValidatorSet.sol";
import "./interface/IParamSubscriber.sol";
import "./interface/ICrossChain.sol";
import "./interface/ISystemReward.sol";
import "./interface/IStakeHub.sol";
import "./lib/CmnPkg.sol";
import "./lib/RLPEncode.sol";
import "./lib/0.6.x/BytesToTypes.sol";
import "./lib/0.6.x/TypesToBytes.sol";
import "./lib/0.6.x/BytesLib.sol";
import "./lib/0.6.x/Memory.sol";
import "./interface/0.6.x/ISlashIndicator.sol";
import "./interface/0.6.x/IApplication.sol";
import "./interface/0.6.x/IBSCValidatorSet.sol";
import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/ICrossChain.sol";
import "./interface/0.6.x/ISystemReward.sol";
import "./interface/0.6.x/IStakeHub.sol";
import "./lib/0.6.x/CmnPkg.sol";
import "./lib/0.6.x/RLPEncode.sol";

contract SlashIndicator is ISlashIndicator, System, IParamSubscriber, IApplication {
using RLPEncode for *;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/DoubleEndedQueueUpgradeable.sol";

import "./System.sol";
import "./interface/IStakeHub.sol";
import "./SystemV2.sol";
import "./interface/0.8.x/IStakeHub.sol";

contract StakeCredit is System, Initializable, ReentrancyGuardUpgradeable, ERC20Upgradeable {
contract StakeCredit is SystemV2, Initializable, ReentrancyGuardUpgradeable, ERC20Upgradeable {
using CountersUpgradeable for CountersUpgradeable.Counter;
using DoubleEndedQueueUpgradeable for DoubleEndedQueueUpgradeable.Bytes32Deque;

Expand Down
20 changes: 10 additions & 10 deletions contracts/BC_fusion/StakeHub.sol → contracts/StakeHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.so
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./System.sol";
import "./SystemV2.sol";
import "./extension/Protectable.sol";
import "./interface/IBSCValidatorSet.sol";
import "./interface/ICrossChain.sol";
import "./interface/IGovToken.sol";
import "./interface/IStakeCredit.sol";
import "./interface/ITokenHub.sol";
import "./lib/RLPDecode.sol";
import "./lib/Utils.sol";

contract StakeHub is System, Initializable, Protectable {
import "./interface/0.8.x/IBSCValidatorSet.sol";
import "./interface/0.8.x/ICrossChain.sol";
import "./interface/0.8.x/IGovToken.sol";
import "./interface/0.8.x/IStakeCredit.sol";
import "./interface/0.8.x/ITokenHub.sol";
import "./lib/0.8.x/RLPDecode.sol";
import "./lib/0.8.x/Utils.sol";

contract StakeHub is SystemV2, Initializable, Protectable {
using RLPDecode for *;
using Utils for string;
using Utils for bytes;
Expand Down
6 changes: 3 additions & 3 deletions contracts/System.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma solidity 0.6.4;

import "./interface/ISystemReward.sol";
import "./interface/IRelayerHub.sol";
import "./interface/ILightClient.sol";
import "./interface/0.6.x/ISystemReward.sol";
import "./interface/0.6.x/IRelayerHub.sol";
import "./interface/0.6.x/ILightClient.sol";

contract System {
bool public alreadyInit;
Expand Down
6 changes: 3 additions & 3 deletions contracts/SystemReward.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pragma solidity 0.6.4;

import "./System.sol";
import "./lib/Memory.sol";
import "./interface/IParamSubscriber.sol";
import "./interface/ISystemReward.sol";
import "./lib/0.6.x/Memory.sol";
import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/ISystemReward.sol";

contract SystemReward is System, IParamSubscriber, ISystemReward {
uint256 public constant MAX_REWARDS = 5e18;
Expand Down
2 changes: 1 addition & 1 deletion contracts/BC_fusion/System.sol → contracts/SystemV2.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.17;

contract System {
contract SystemV2 {
/*----------------- constants -----------------*/
uint8 public constant STAKING_CHANNELID = 0x08;
uint8 public constant BC_FUSION_CHANNELID = 0x11; // new channel id for cross-chain redelegate from Beacon Chain to Smart Chain after Feynman upgrade
Expand Down
22 changes: 11 additions & 11 deletions contracts/TokenHub.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
pragma solidity 0.6.4;

import "./interface/IBEP20.sol";
import "./interface/ITokenHub.sol";
import "./interface/IParamSubscriber.sol";
import "./interface/IApplication.sol";
import "./interface/ICrossChain.sol";
import "./interface/ISystemReward.sol";
import "./lib/SafeMath.sol";
import "./lib/RLPEncode.sol";
import "./lib/RLPDecode.sol";
import "./lib/BytesToTypes.sol";
import "./lib/Memory.sol";
import "./interface/0.6.x/IBEP20.sol";
import "./interface/0.6.x/ITokenHub.sol";
import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/IApplication.sol";
import "./interface/0.6.x/ICrossChain.sol";
import "./interface/0.6.x/ISystemReward.sol";
import "./lib/0.6.x/SafeMath.sol";
import "./lib/0.6.x/RLPEncode.sol";
import "./lib/0.6.x/RLPDecode.sol";
import "./lib/0.6.x/BytesToTypes.sol";
import "./lib/0.6.x/Memory.sol";
import "./System.sol";

contract TokenHub is ITokenHub, System, IParamSubscriber, IApplication, ISystemReward {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

import "./System.sol";
import "./SystemV2.sol";
import "./extension/Protectable.sol";
import "./interface/ITokenHub.sol";
import "./interface/ITokenRecoverPortal.sol";
import "./lib/Utils.sol";
import "./interface/0.8.x/ITokenHub.sol";
import "./interface/0.8.x/ITokenRecoverPortal.sol";
import "./lib/0.8.x/Utils.sol";

/**
* @title TokenRecoverPortal is used to recover the token from BC users.
Expand All @@ -18,7 +18,7 @@ import "./lib/Utils.sol";
* The BC users can recover the token from TokenHub after the merkle tree root is generated.
* For more details, please refer to the BEP-299(https://github.com/bnb-chain/BEPs/pull/299).
*/
contract TokenRecoverPortal is System, Initializable, ReentrancyGuardUpgradeable, Protectable {
contract TokenRecoverPortal is SystemV2, Initializable, ReentrancyGuardUpgradeable, Protectable {
using Utils for string;
using Utils for bytes;

Expand Down
Loading

0 comments on commit c2638fb

Please sign in to comment.