diff --git a/CHANGELOG.md b/CHANGELOG.md index c11bc5e..8d6e6a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v0.9.30-mainnet.159 + +- enable polygon chain bridge +- fix node rpc compile error + # v0.9.30-node.158 - release-sidecar diff --git a/pallets/chainbridge-handler/src/mock.rs b/pallets/chainbridge-handler/src/mock.rs index f0104cc..b92c268 100644 --- a/pallets/chainbridge-handler/src/mock.rs +++ b/pallets/chainbridge-handler/src/mock.rs @@ -125,6 +125,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId = 3; pub const NativeChainId: ChainId = 42; pub const BurnTAOwhenIssue: Balance =10_000_000_000_000_000_000; } @@ -143,6 +144,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/pallets/chainbridge/src/mock.rs b/pallets/chainbridge/src/mock.rs index 32a2025..6fa8c5d 100644 --- a/pallets/chainbridge/src/mock.rs +++ b/pallets/chainbridge/src/mock.rs @@ -93,6 +93,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId = 3; pub const NativeChainId: ChainId = 42; pub NativeResourceId: ResourceId = derive_resource_id(42, 0, b"TAO").unwrap(); // native token id pub const TreasuryAccount: AccountId = AccountId::new([5u8; 32]); @@ -113,6 +114,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/pallets/fuso-support/src/external_chain.rs b/pallets/fuso-support/src/external_chain.rs index 9834f3c..c1c0bde 100644 --- a/pallets/fuso-support/src/external_chain.rs +++ b/pallets/fuso-support/src/external_chain.rs @@ -26,6 +26,7 @@ pub enum XToken { BEP20(Vec, Vec, Balance, bool, u8), // symbol, total FND10(Vec, Balance), + POLYGON(Vec, Vec, Balance, bool, u8), } impl XToken { @@ -33,6 +34,7 @@ impl XToken { match self { XToken::NEP141(_, _, _, stable, _) | XToken::ERC20(_, _, _, stable, _) + | XToken::POLYGON(_, _, _, stable, _) | XToken::BEP20(_, _, _, stable, _) => *stable, XToken::FND10(_, _) => false, } @@ -42,6 +44,7 @@ impl XToken { match self { XToken::NEP141(symbol, _, _, _, _) | XToken::ERC20(symbol, _, _, _, _) + | XToken::POLYGON(symbol, _, _, _, _) | XToken::BEP20(symbol, _, _, _, _) | XToken::FND10(symbol, _) => symbol.clone(), } @@ -51,6 +54,7 @@ impl XToken { match self { XToken::NEP141(_, contract, _, _, _) | XToken::ERC20(_, contract, _, _, _) + | XToken::POLYGON(_, contract, _, _, _) | XToken::BEP20(_, contract, _, _, _) => contract.clone(), XToken::FND10(_, _) => Vec::new(), } diff --git a/pallets/market/src/mock.rs b/pallets/market/src/mock.rs index e8a56ac..194ed98 100644 --- a/pallets/market/src/mock.rs +++ b/pallets/market/src/mock.rs @@ -88,6 +88,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId =3; pub const NativeChainId: ChainId = 42; pub const BurnTAOwhenIssue: Balance = 10000000000000000; } @@ -108,6 +109,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/pallets/reward/src/mock.rs b/pallets/reward/src/mock.rs index 5425383..00bc74d 100644 --- a/pallets/reward/src/mock.rs +++ b/pallets/reward/src/mock.rs @@ -86,6 +86,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId = 3; pub const NativeChainId: ChainId = 42; pub const BurnTAOwhenIssue: Balance = 10_000_000_000_000_000_000; } @@ -105,6 +106,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/pallets/token/src/lib.rs b/pallets/token/src/lib.rs index 21ded99..f6cdd8d 100644 --- a/pallets/token/src/lib.rs +++ b/pallets/token/src/lib.rs @@ -94,6 +94,9 @@ pub mod pallet { #[pallet::constant] type NativeTokenId: Get; + #[pallet::constant] + type PolygonChainId: Get; + type Weight: WeightInfo; #[pallet::constant] @@ -196,6 +199,7 @@ pub mod pallet { match token_info { XToken::NEP141(_, _, _, ref mut stable, _) => *stable = true, XToken::ERC20(_, _, _, ref mut stable, _) => *stable = true, + XToken::POLYGON(_, _, _, ref mut stable, _) => *stable = true, XToken::BEP20(_, _, _, ref mut stable, _) => *stable = true, XToken::FND10(_, _) => return Err(Error::::TokenNotFound.into()), } @@ -254,6 +258,7 @@ pub mod pallet { let unified_amount = match info { XToken::NEP141(_, _, ref mut total, _, decimals) | XToken::ERC20(_, _, ref mut total, _, decimals) + | XToken::POLYGON(_, _, ref mut total, _, decimals) | XToken::BEP20(_, _, ref mut total, _, decimals) => { let unified_amount = Self::transform_decimals_to_standard(amount, decimals); *total = total @@ -300,6 +305,7 @@ pub mod pallet { let unified_amount = match info { XToken::NEP141(_, _, ref mut total, _, decimals) | XToken::ERC20(_, _, ref mut total, _, decimals) + | XToken::POLYGON(_, _, ref mut total, _, decimals) | XToken::BEP20(_, _, ref mut total, _, decimals) => { let unified_amount = Self::transform_decimals_to_standard(amount, decimals); *total = total @@ -455,6 +461,13 @@ pub mod pallet { ref mut stable, decimals, ) + | XToken::POLYGON( + ref symbol, + ref contract, + ref mut total, + ref mut stable, + decimals, + ) | XToken::BEP20( ref symbol, ref contract, @@ -625,6 +638,7 @@ pub mod pallet { match token { XToken::NEP141(_, _, total, _, _) | XToken::ERC20(_, _, total, _, _) + | XToken::POLYGON(_, _, total, _, _) | XToken::BEP20(_, _, total, _, _) => total, XToken::FND10(_, total) => total, } @@ -643,6 +657,7 @@ pub mod pallet { match token { XToken::NEP141(_, _, _, _, decimals) | XToken::ERC20(_, _, _, _, decimals) + | XToken::POLYGON(_, _, _, _, decimals) | XToken::BEP20(_, _, _, _, decimals) => Ok(decimals), XToken::FND10(_, _) => Err(Error::::TokenNotFound.into()), } @@ -895,6 +910,7 @@ pub mod pallet { .map(|info| match info { XToken::NEP141(_, _, _, _, decimals) | XToken::ERC20(_, _, _, _, decimals) + | XToken::POLYGON(_, _, _, _, decimals) | XToken::BEP20(_, _, _, _, decimals) => { Self::transform_decimals_to_standard(balance, decimals) } @@ -910,6 +926,7 @@ pub mod pallet { match token_info { XToken::NEP141(..) => T::NearChainId::get(), XToken::ERC20(..) => T::EthChainId::get(), + XToken::POLYGON(..) => T::PolygonChainId::get(), XToken::BEP20(..) => T::BnbChainId::get(), XToken::FND10(..) => T::NativeChainId::get(), } diff --git a/pallets/token/src/mock.rs b/pallets/token/src/mock.rs index 1eb0f22..c5702cb 100644 --- a/pallets/token/src/mock.rs +++ b/pallets/token/src/mock.rs @@ -84,6 +84,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId = 3; pub const NativeChainId: ChainId = 42; pub const BurnTAOwhenIssue: Balance = 10_000_000_000_000_000_000; } @@ -103,6 +104,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/pallets/verifier/src/mock.rs b/pallets/verifier/src/mock.rs index 4e947fe..9a44c83 100644 --- a/pallets/verifier/src/mock.rs +++ b/pallets/verifier/src/mock.rs @@ -86,6 +86,7 @@ parameter_types! { pub const NearChainId: ChainId = 255; pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 2; + pub const PolygonChainId: ChainId = 3; pub const NativeChainId: ChainId = 42; pub const BurnTAOwhenIssue: Balance = 10000000000000000; } @@ -105,6 +106,7 @@ impl pallet_fuso_token::Config for Test { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = u32; type Weight = (); diff --git a/rpc/src/broker/mod.rs b/rpc/src/broker/mod.rs index ac0eb81..1aec706 100644 --- a/rpc/src/broker/mod.rs +++ b/rpc/src/broker/mod.rs @@ -281,7 +281,6 @@ where async move { let key = get_broker_public(keystore) .await - .inspect_err(|e| log::error!("{:?}", e)) .map_err(|_| rpc_error!(-32102, "The broker key is not registered."))?; let r = session .relay( @@ -412,10 +411,7 @@ where "broker-prover-connector", Some("fusotao-rpc"), async move { - if let Ok(relayer) = get_broker_public(keystore) - .await - .inspect_err(|e| log::error!("{:?}", e)) - { + if let Ok(relayer) = get_broker_public(keystore).await { let _ = session .multiplex(account_id, signature, nonce, relayer.to_ss58check(), sink) .await; diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 88be35e..29ba2a7 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(result_option_inspect)] -#![feature(result_flattening)] pub mod broker; pub mod token; pub mod verifier; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index cc4108c..edeb738 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 158, + spec_version: 159, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -644,6 +644,7 @@ parameter_types! { pub const EthChainId: ChainId = 1; pub const BnbChainId: ChainId = 56; pub const NativeChainId: ChainId = 42; + pub const PolygonChainId: ChainId = 137; pub const BurnTAOwhenIssue: Balance = 10 * TAO; } @@ -657,6 +658,7 @@ impl pallet_fuso_token::Config for Runtime { type NativeChainId = NativeChainId; type NativeTokenId = NativeTokenId; type NearChainId = NearChainId; + type PolygonChainId = PolygonChainId; type RuntimeEvent = RuntimeEvent; type TokenId = TokenId; type Weight = pallet_fuso_token::weights::SubstrateWeight;