diff --git a/Cargo.lock b/Cargo.lock index 34a55699..8a788446 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1585,7 +1585,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "async-trait", "fc-db", @@ -1604,7 +1604,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fc-db", "fp-consensus", @@ -1635,7 +1635,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "ethereum-types", @@ -1677,7 +1677,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "ethereum-types", @@ -1784,7 +1784,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "parity-scale-codec", @@ -1796,7 +1796,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "evm", "parity-scale-codec", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "ethereum-types", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "frame-support", @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "parity-scale-codec", ] @@ -4665,7 +4665,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "frame-support", "frame-system", @@ -4747,7 +4747,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "ethereum", "ethereum-types", @@ -4787,7 +4787,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "evm", "fp-evm", @@ -4813,7 +4813,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", ] @@ -4821,7 +4821,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", "sp-core", @@ -4831,7 +4831,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", "frame-support", @@ -4841,7 +4841,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", "num", @@ -4850,7 +4850,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", "tiny-keccak", @@ -4859,7 +4859,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#4e91f788ba02a0add42f09cae21bf96e3d346330" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18#eb579d4dda77724be438bf090596b347ca6a5a37" dependencies = [ "fp-evm", "ripemd", diff --git a/README.md b/README.md index 20074e5d..ff4106d1 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,8 @@ How to use/test locally ## 1. Supported dependencies It should at least work until the following commits - -- polkadot.js.org (apps v0.98.2-106) -- Polkadot release-v0.9.11 @ `eb9f107e3a04687dcf80111563f2bcea7d5b15d3` -- Substrate polkadot-v0.9.18 @ `57346f6b24875f8935280dba51fa8ab0a9ba1e39` +- Substrate: polkadot-v0.9.18 @ `fc3fd073d3a0acf9933c3994b660ebd7b5833f65` +- ChainX frontier: polkadot-v0.9.18 @ `eb579d4dda77724be438bf090596b347ca6a5a37` ## 2. Local Test diff --git a/contracts/AssetsBridgeErc20_OnlyOwner.sol b/contracts/AssetsBridgeErc20_OnlyOwner.sol index e9453c76..a29ee4d7 100644 --- a/contracts/AssetsBridgeErc20_OnlyOwner.sol +++ b/contracts/AssetsBridgeErc20_OnlyOwner.sol @@ -10,7 +10,6 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contr import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/access/Ownable.sol"; import "./AssetsBridgeAdaptor.sol"; -import "./erc20-contracts/contracts/AssetsBridgeAdaptor.sol"; /** * @dev Implementation of the {IERC20} interface. diff --git a/xpallets/assets-bridge/src/lib.rs b/xpallets/assets-bridge/src/lib.rs index 89e0b936..1eca2e65 100644 --- a/xpallets/assets-bridge/src/lib.rs +++ b/xpallets/assets-bridge/src/lib.rs @@ -569,7 +569,14 @@ pub mod pallet { origin: OriginFor, new_admin: ::Source, ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; + let require = match ensure_signed_or_root(origin) { + Ok(s) if s == Self::admin_key() => true, + Ok(None) => true, + _ => false + }; + + ensure!(require, Error::::RequireAdmin); + let new_admin = T::Lookup::lookup(new_admin)?; Admin::::mutate(|admin| *admin = Some(new_admin.clone()));