Skip to content

Commit

Permalink
chore: rename cross chian to crosschain
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 17, 2024
1 parent 694f87b commit cabbc41
Show file tree
Hide file tree
Showing 32 changed files with 397 additions and 398 deletions.
20 changes: 10 additions & 10 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 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
322 changes: 161 additions & 161 deletions 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
6 changes: 3 additions & 3 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 Down Expand Up @@ -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

0 comments on commit cabbc41

Please sign in to comment.