Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename cross chain to crosschain #750

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import (
trontypes "github.com/functionx/fx-core/v8/x/tron/types"
)

type CrossChainKeepers struct {
type CrosschainKeepers struct {
BscKeeper crosschainkeeper.Keeper
PolygonKeeper crosschainkeeper.Keeper
AvalancheKeeper crosschainkeeper.Keeper
Expand All @@ -99,7 +99,7 @@ type CrossChainKeepers struct {
Layer2Keeper crosschainkeeper.Keeper
}

func (c CrossChainKeepers) ToSlice() []crosschainkeeper.Keeper {
func (c CrosschainKeepers) ToSlice() []crosschainkeeper.Keeper {
return []crosschainkeeper.Keeper{
c.BscKeeper, c.PolygonKeeper, c.AvalancheKeeper, c.EthKeeper,
c.TronKeeper, c.ArbitrumKeeper, c.OptimismKeeper, c.Layer2Keeper,
Expand Down Expand Up @@ -140,7 +140,7 @@ type AppKeepers struct {
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

CrosschainRouterKeeper crosschainkeeper.RouterKeeper
CrossChainKeepers
CrosschainKeepers

EvmKeeper *fxevmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper
Expand Down Expand Up @@ -329,8 +329,8 @@ func NewAppKeeper(
appKeepers.GetSubspace(feemarkettypes.ModuleName),
)

// cross chain precompile
precompileRouter := crosschainprecompile.NewRouter()
// crosschain precompile
crosschainPrecompileRouter := crosschainprecompile.NewRouter()
evmKeeper := evmkeeper.NewKeeper(
appCodec,
appKeepers.keys[evmtypes.StoreKey],
Expand All @@ -345,7 +345,7 @@ func NewAppKeeper(
[]evmkeeper.CustomContractFn{
func(_ sdk.Context, _ ethparams.Rules) vm.PrecompiledContract {
return crosschainprecompile.NewPrecompiledContract(
appKeepers.BankKeeper, appKeepers.GovKeeper, precompileRouter)
appKeepers.BankKeeper, appKeepers.GovKeeper, crosschainPrecompileRouter)
},
func(_ sdk.Context, _ ethparams.Rules) vm.PrecompiledContract {
return stakingprecompile.NewPrecompiledContract(
Expand All @@ -371,7 +371,7 @@ func NewAppKeeper(
authAddr,
)

// init cross chain module
// init crosschain module
appKeepers.BscKeeper = crosschainkeeper.NewKeeper(
appCodec,
bsctypes.ModuleName,
Expand Down Expand Up @@ -507,8 +507,8 @@ func NewAppKeeper(

appKeepers.CrosschainRouterKeeper = crosschainkeeper.NewRouterKeeper(crosschainRouter)

// cross chain precompile
precompileRouter.
// crosschain precompile
crosschainPrecompileRouter.
AddRoute(bsctypes.ModuleName, appKeepers.BscKeeper).
AddRoute(polygontypes.ModuleName, appKeepers.PolygonKeeper).
AddRoute(avalanchetypes.ModuleName, appKeepers.AvalancheKeeper).
Expand All @@ -517,6 +517,7 @@ func NewAppKeeper(
AddRoute(optimismtypes.ModuleName, appKeepers.OptimismKeeper).
AddRoute(layer2types.ModuleName, appKeepers.Layer2Keeper).
AddRoute(trontypes.ModuleName, appKeepers.TronKeeper)
crosschainPrecompileRouter.Seal()

// register the proposal types
govRouter := govv1beta1.NewRouter()
Expand Down Expand Up @@ -550,8 +551,7 @@ func NewAppKeeper(
appCodec,
authAddr,
)
appKeepers.IBCMiddlewareKeeper = ibcmiddlewarekeeper.NewKeeper(appCodec, appKeepers.EvmKeeper,
appKeepers.EthKeeper) // TODO: replace by crosschain keeper
appKeepers.IBCMiddlewareKeeper = ibcmiddlewarekeeper.NewKeeper(appCodec, appKeepers.EvmKeeper, appKeepers.EthKeeper)
ibcTransferModule := ibctransfer.NewIBCModule(appKeepers.IBCTransferKeeper)
transferIBCModule := ibcmiddleware.NewIBCMiddleware(appKeepers.IBCMiddlewareKeeper, appKeepers.IBCKeeper.ChannelKeeper, ibcTransferModule)

Expand Down
2 changes: 1 addition & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func appModules(
layer2.NewAppModule(app.Layer2Keeper),
fxevm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)),
feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)),
erc20.NewAppModule(app.GetKey(erc20types.StoreKey), appCodec, app.Erc20Keeper, app.BankKeeper, app.CrossChainKeepers.ToSlice()),
erc20.NewAppModule(app.GetKey(erc20types.StoreKey), appCodec, app.Erc20Keeper, app.BankKeeper, app.CrosschainKeepers.ToSlice()),
migrate.NewAppModule(app.MigrateKeeper),
ibctransfer.NewAppModule(app.IBCTransferKeeper),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
Expand Down
322 changes: 161 additions & 161 deletions contract/ICrossChain.go → contract/ICrosschain.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions contract/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ echo "===> Compiling contracts"
[[ ! -d "$project_dir/contract/artifacts" ]] && mkdir -p "$project_dir/contract/artifacts"

# add core contracts
contracts=(WFXUpgradable FIP20Upgradable ICrossChain IStaking IFxBridgeLogic IBridgeCallback IError IBridgeFeeQuote)
contracts_test=(CrossChainTest StakingTest)
contracts=(WFXUpgradable FIP20Upgradable ICrosschain IStaking IFxBridgeLogic IBridgeCallback IError IBridgeFeeQuote)
contracts_test=(CrosschainTest StakingTest)
# add 3rd party contracts
contracts+=(ERC1967Proxy)
contracts_test+=(ERC721TokenTest)
Expand Down
2 changes: 1 addition & 1 deletion contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
WFXLogicAddress = "0x0000000000000000000000000000000000001002"

StakingAddress = "0x0000000000000000000000000000000000001003"
CrossChainAddress = "0x0000000000000000000000000000000000001004"
CrosschainAddress = "0x0000000000000000000000000000000000001004"
)

var (
Expand Down
10 changes: 5 additions & 5 deletions solidity/contracts/bridge/BridgeFeeOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {EnumerableSetUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import {IBridgeFeeOracle} from "./IBridgeFee.sol";
import {ICrossChain} from "./ICrossChain.sol";
import {ICrosschain} from "./ICrosschain.sol";

contract BridgeFeeOracle is
IBridgeFeeOracle,
Expand All @@ -20,7 +20,7 @@ contract BridgeFeeOracle is

bytes32 public constant QUOTE_ROLE = keccak256("QUOTE_ROLE");

address public crossChainContract;
address public crosschainContract;
address public defaultOracle;

struct State {
Expand All @@ -36,7 +36,7 @@ contract BridgeFeeOracle is
__UUPSUpgradeable_init();
__ReentrancyGuard_init();

crossChainContract = _crossChain;
crosschainContract = _crossChain;

_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
Expand All @@ -53,11 +53,11 @@ contract BridgeFeeOracle is
) external onlyRole(QUOTE_ROLE) nonReentrant returns (bool) {
if (oracleStatus[_oracle].isActive) return true;
if (oracleStatus[_oracle].isBlacklisted) return false;
if (!ICrossChain(crossChainContract).hasOracle(_chainName, _oracle)) {
if (!ICrosschain(crosschainContract).hasOracle(_chainName, _oracle)) {
return false;
}
if (
!ICrossChain(crossChainContract).isOracleOnline(_chainName, _oracle)
!ICrosschain(crosschainContract).isOracleOnline(_chainName, _oracle)
) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {IBridgeCall} from "./IBridgeCall.sol";

// NOTE: if using an interface to invoke the precompiled contract
// need to use solidity version 0.8.10 and later.
interface ICrossChain is IBridgeCall {
interface ICrosschain is IBridgeCall {
// Deprecated: please use `IBridgeCall.bridgeCall`
function crossChain(
address _token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
pragma solidity ^0.8.0;

/* solhint-disable no-global-import */
import "../bridge/ICrossChain.sol";
import "../bridge/ICrosschain.sol";
import "../fip20/IFIP20Upgradable.sol";

/* solhint-enable no-global-import */
/* solhint-disable custom-errors */

contract CrossChainTest {
contract CrosschainTest {
address public constant CROSS_CHAIN_ADDRESS =
address(0x0000000000000000000000000000000000001004);

Expand Down Expand Up @@ -50,7 +50,7 @@ contract CrossChainTest {
}

return
ICrossChain(CROSS_CHAIN_ADDRESS).crossChain{value: msg.value}(
ICrosschain(CROSS_CHAIN_ADDRESS).crossChain{value: msg.value}(
_token,
_receipt,
_amount,
Expand All @@ -65,7 +65,7 @@ contract CrossChainTest {
bytes32 _target
) external view returns (uint256) {
return
ICrossChain(CROSS_CHAIN_ADDRESS).bridgeCoinAmount(_token, _target);
ICrosschain(CROSS_CHAIN_ADDRESS).bridgeCoinAmount(_token, _target);
}

function bridgeCall(
Expand All @@ -79,7 +79,7 @@ contract CrossChainTest {
bytes memory _memo
) internal returns (uint256) {
return
ICrossChain(CROSS_CHAIN_ADDRESS).bridgeCall(
ICrosschain(CROSS_CHAIN_ADDRESS).bridgeCall(
_dstChain,
_receiver,
_tokens,
Expand Down
Loading
Loading