Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Do not enter estimate mode when binary flag is enabled (#102)
Browse files Browse the repository at this point in the history
* Do not enter estimate mode when binary flag is enabled

* Update README.md

* Fix assets-bridge set_admin

Co-authored-by: icodezjb <[email protected]>
  • Loading branch information
hqwangningbo and icodezjb authored Jun 9, 2022
1 parent 0cba3d8 commit 9b6057d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion contracts/AssetsBridgeErc20_OnlyOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion xpallets/assets-bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,14 @@ pub mod pallet {
origin: OriginFor<T>,
new_admin: <T::Lookup as StaticLookup>::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::<T>::RequireAdmin);

let new_admin = T::Lookup::lookup(new_admin)?;

Admin::<T>::mutate(|admin| *admin = Some(new_admin.clone()));
Expand Down

0 comments on commit 9b6057d

Please sign in to comment.