diff --git a/Dockerfile b/Dockerfile index a167d86c09..34d3228c5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2019-2021 Liebi Technologies. +# Copyright 2019-2022 Liebi Technologies. # This file is part of Bifrost. # Bifrost is free software: you can redistribute it and/or modify diff --git a/HEADER-GPL3 b/HEADER-GPL3 index cfcd19c576..ac118b2034 100644 --- a/HEADER-GPL3 +++ b/HEADER-GPL3 @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/integration_tests.rs b/integration-tests/src/integration_tests.rs index b839cadec9..0716e85e4d 100644 --- a/integration-tests/src/integration_tests.rs +++ b/integration-tests/src/integration_tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/kusama_cross_chain_transact.rs b/integration-tests/src/kusama_cross_chain_transact.rs index 5d39e186cf..add892affe 100644 --- a/integration-tests/src/kusama_cross_chain_transact.rs +++ b/integration-tests/src/kusama_cross_chain_transact.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/kusama_cross_chain_transfer.rs b/integration-tests/src/kusama_cross_chain_transfer.rs index b572d8afae..1f64f493d7 100644 --- a/integration-tests/src/kusama_cross_chain_transfer.rs +++ b/integration-tests/src/kusama_cross_chain_transfer.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 98f2b41233..71ea0e46ad 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 4f3f300463..55eea40123 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/integration-tests/src/statemine.rs b/integration-tests/src/statemine.rs index 40fb28303e..8177fb3fc0 100644 --- a/integration-tests/src/statemine.rs +++ b/integration-tests/src/statemine.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/cli/build.rs b/node/cli/build.rs index 78600242d3..685c43aaa0 100644 --- a/node/cli/build.rs +++ b/node/cli/build.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index fadd90dca8..3ca1572f5f 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 304d66ebbe..67c68d32df 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index e1105b2205..8b021b620a 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/cli/src/main.rs b/node/cli/src/main.rs index ea84337502..59bdc6f271 100644 --- a/node/cli/src/main.rs +++ b/node/cli/src/main.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/inspect/src/cli.rs b/node/inspect/src/cli.rs index 27133373b8..7c885a5a57 100644 --- a/node/inspect/src/cli.rs +++ b/node/inspect/src/cli.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/inspect/src/command.rs b/node/inspect/src/command.rs index caf13c7580..28671958af 100644 --- a/node/inspect/src/command.rs +++ b/node/inspect/src/command.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/inspect/src/lib.rs b/node/inspect/src/lib.rs index 7b2851c554..1c84a10eda 100644 --- a/node/inspect/src/lib.rs +++ b/node/inspect/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/bridge.rs b/node/primitives/src/bridge.rs index 4a8ef4ad1a..88aa4fded9 100644 --- a/node/primitives/src/bridge.rs +++ b/node/primitives/src/bridge.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/currency.rs b/node/primitives/src/currency.rs index 8bc08360e1..0a1b47f75b 100644 --- a/node/primitives/src/currency.rs +++ b/node/primitives/src/currency.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index 82ab0204e9..3bfbb36518 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/salp.rs b/node/primitives/src/salp.rs index 97cb5dd9ca..7c80b157fb 100644 --- a/node/primitives/src/salp.rs +++ b/node/primitives/src/salp.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/tests.rs b/node/primitives/src/tests.rs index c2a6c7cd3f..a678c27373 100644 --- a/node/primitives/src/tests.rs +++ b/node/primitives/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/traits.rs b/node/primitives/src/traits.rs index d51e532e25..6e0903e55a 100644 --- a/node/primitives/src/traits.rs +++ b/node/primitives/src/traits.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/primitives/src/xcm.rs b/node/primitives/src/xcm.rs index 668e1de394..3134779da9 100644 --- a/node/primitives/src/xcm.rs +++ b/node/primitives/src/xcm.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs index 47895ba143..e44a2c3a07 100644 --- a/node/rpc/src/lib.rs +++ b/node/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/chain_spec/asgard.rs b/node/service/src/chain_spec/asgard.rs index f30ede53ff..8d19d00c40 100644 --- a/node/service/src/chain_spec/asgard.rs +++ b/node/service/src/chain_spec/asgard.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/chain_spec/bifrost_kusama.rs b/node/service/src/chain_spec/bifrost_kusama.rs index 8957ff8ea4..00661b516d 100644 --- a/node/service/src/chain_spec/bifrost_kusama.rs +++ b/node/service/src/chain_spec/bifrost_kusama.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/chain_spec/bifrost_polkadot.rs b/node/service/src/chain_spec/bifrost_polkadot.rs index 7ffdab309f..fe78c488eb 100644 --- a/node/service/src/chain_spec/bifrost_polkadot.rs +++ b/node/service/src/chain_spec/bifrost_polkadot.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/chain_spec/mod.rs b/node/service/src/chain_spec/mod.rs index 738912770a..868f594e0f 100644 --- a/node/service/src/chain_spec/mod.rs +++ b/node/service/src/chain_spec/mod.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/collator_kusama.rs b/node/service/src/collator_kusama.rs index 8d8ef12664..e41d8603c2 100644 --- a/node/service/src/collator_kusama.rs +++ b/node/service/src/collator_kusama.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/collator_polkadot.rs b/node/service/src/collator_polkadot.rs index 92e270bce3..4ca3279c22 100644 --- a/node/service/src/collator_polkadot.rs +++ b/node/service/src/collator_polkadot.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/dev.rs b/node/service/src/dev.rs index 60250f85ea..62dd2cc936 100644 --- a/node/service/src/dev.rs +++ b/node/service/src/dev.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 93d1fb5abe..f070bc7f4d 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/assets/src/lib.rs b/pallets/assets/src/lib.rs index d2096faf89..7468d5f22b 100644 --- a/pallets/assets/src/lib.rs +++ b/pallets/assets/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/assets/src/mock.rs b/pallets/assets/src/mock.rs index a218170d46..e6895b7fe9 100644 --- a/pallets/assets/src/mock.rs +++ b/pallets/assets/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/assets/src/tests.rs b/pallets/assets/src/tests.rs index 912a47202e..c991db7d22 100644 --- a/pallets/assets/src/tests.rs +++ b/pallets/assets/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/rpc/runtime-api/src/lib.rs b/pallets/bancor/rpc/runtime-api/src/lib.rs index fb36ec2bb6..47c084f4c2 100644 --- a/pallets/bancor/rpc/runtime-api/src/lib.rs +++ b/pallets/bancor/rpc/runtime-api/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/rpc/src/lib.rs b/pallets/bancor/rpc/src/lib.rs index b82e7350d1..548c4b6cab 100644 --- a/pallets/bancor/rpc/src/lib.rs +++ b/pallets/bancor/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/src/benchmarking.rs b/pallets/bancor/src/benchmarking.rs index 376f854cb5..a65f2325d6 100644 --- a/pallets/bancor/src/benchmarking.rs +++ b/pallets/bancor/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/src/lib.rs b/pallets/bancor/src/lib.rs index 6bed3f7f67..b087e44193 100644 --- a/pallets/bancor/src/lib.rs +++ b/pallets/bancor/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/src/mock.rs b/pallets/bancor/src/mock.rs index 22ebc2b693..8d7ad09293 100644 --- a/pallets/bancor/src/mock.rs +++ b/pallets/bancor/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/src/tests.rs b/pallets/bancor/src/tests.rs index 8bcce6e726..026ceb62ce 100644 --- a/pallets/bancor/src/tests.rs +++ b/pallets/bancor/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bancor/src/weights.rs b/pallets/bancor/src/weights.rs index 85d1ebe635..483b525591 100644 --- a/pallets/bancor/src/weights.rs +++ b/pallets/bancor/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bid/src/lib.rs b/pallets/bid/src/lib.rs index 2201bfe78a..7189502725 100644 --- a/pallets/bid/src/lib.rs +++ b/pallets/bid/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bid/src/mock.rs b/pallets/bid/src/mock.rs index 84b8f933bb..3f10ff30eb 100644 --- a/pallets/bid/src/mock.rs +++ b/pallets/bid/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bid/src/tests.rs b/pallets/bid/src/tests.rs index db44fa8754..9efc49a196 100644 --- a/pallets/bid/src/tests.rs +++ b/pallets/bid/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bridge-eos/src/lib.rs b/pallets/bridge-eos/src/lib.rs index a5a33986b4..98372d46e1 100644 --- a/pallets/bridge-eos/src/lib.rs +++ b/pallets/bridge-eos/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -21,41 +21,50 @@ extern crate alloc; use alloc::string::{String, ToString}; -use core::{convert::TryFrom, ops::Div, str::FromStr, fmt::Debug}; -use crate::transaction::TxOut; +use core::{convert::TryFrom, fmt::Debug, ops::Div, str::FromStr}; + use codec::{Decode, Encode}; use eos_chain::{ - Action, ActionTransfer, ActionReceipt, Asset, Checksum256, Digest, IncrementalMerkle, - ProducerSchedule, SignedBlockHeader, Symbol, SymbolCode, Read, verify_proof, ActionName, - ProducerAuthoritySchedule, ProducerAuthority, + verify_proof, Action, ActionName, ActionReceipt, ActionTransfer, Asset, Checksum256, Digest, + IncrementalMerkle, ProducerAuthority, ProducerAuthoritySchedule, ProducerSchedule, Read, + SignedBlockHeader, Symbol, SymbolCode, }; use eos_keys::secret::SecretKey; -use sp_std::prelude::*; -use sp_core::offchain::StorageKind; -use sp_runtime::{ - traits::{Member, SaturatedConversion, Saturating, AtLeast32Bit, MaybeSerializeDeserialize, Zero}, - transaction_validity::{ - InvalidTransaction, TransactionLongevity, TransactionPriority, - TransactionValidity, ValidTransaction, TransactionSource - }, -}; use frame_support::{ - decl_event, decl_module, decl_storage, decl_error, ensure, Parameter, traits::Get, - dispatch::DispatchResult, weights::{DispatchClass, Weight, Pays}, IterableStorageMap, StorageValue, + decl_error, decl_event, decl_module, decl_storage, + dispatch::DispatchResult, + ensure, + traits::Get, + weights::{DispatchClass, Pays, Weight}, + IterableStorageMap, Parameter, StorageValue, }; use frame_system::{ - self as system, ensure_root, ensure_none, ensure_signed, offchain::{SubmitTransaction, SendTransactionTypes} + self as system, ensure_none, ensure_root, ensure_signed, + offchain::{SendTransactionTypes, SubmitTransaction}, }; use node_primitives::{ - BridgeAssetBalance, BridgeAssetTo, BridgeAssetSymbol, BlockchainType, - VtokenMintExt, CurrencyId, CurrencyIdExt, TokenInfo, + BlockchainType, BridgeAssetBalance, BridgeAssetSymbol, BridgeAssetTo, CurrencyId, + CurrencyIdExt, TokenInfo, VtokenMintExt, }; -use sp_application_crypto::RuntimeAppPublic; use orml_traits::{MultiCurrency, MultiReservableCurrency}; +use sp_application_crypto::RuntimeAppPublic; +use sp_core::offchain::StorageKind; +use sp_runtime::{ + traits::{ + AtLeast32Bit, MaybeSerializeDeserialize, Member, SaturatedConversion, Saturating, Zero, + }, + transaction_validity::{ + InvalidTransaction, TransactionLongevity, TransactionPriority, TransactionSource, + TransactionValidity, ValidTransaction, + }, +}; +use sp_std::prelude::*; + +use crate::transaction::TxOut; -mod transaction; mod mock; mod tests; +mod transaction; pub trait WeightInfo { fn clear_cross_trade_times() -> Weight; @@ -74,19 +83,45 @@ pub trait WeightInfo { } impl WeightInfo for () { - fn clear_cross_trade_times() -> Weight { Default::default() } - fn bridge_enable() -> Weight { Default::default() } - fn save_producer_schedule() -> Weight { Default::default() } - fn init_schedule() -> Weight { Default::default() } - fn grant_crosschain_privilege() -> Weight { Default::default() } - fn remove_crosschain_privilege() -> Weight { Default::default() } - fn set_contract_accounts() -> Weight { Default::default() } - fn change_schedule() -> Weight { Default::default() } - fn prove_action() -> Weight { Default::default() } - fn bridge_tx_report() -> Weight { Default::default() } - fn update_bridge_trx_status() -> Weight { Default::default() } - fn trial_on_trx_status() -> Weight { Default::default() } - fn cross_to_eos(_: Weight) -> Weight { Default::default() } + fn clear_cross_trade_times() -> Weight { + Default::default() + } + fn bridge_enable() -> Weight { + Default::default() + } + fn save_producer_schedule() -> Weight { + Default::default() + } + fn init_schedule() -> Weight { + Default::default() + } + fn grant_crosschain_privilege() -> Weight { + Default::default() + } + fn remove_crosschain_privilege() -> Weight { + Default::default() + } + fn set_contract_accounts() -> Weight { + Default::default() + } + fn change_schedule() -> Weight { + Default::default() + } + fn prove_action() -> Weight { + Default::default() + } + fn bridge_tx_report() -> Weight { + Default::default() + } + fn update_bridge_trx_status() -> Weight { + Default::default() + } + fn trial_on_trx_status() -> Weight { + Default::default() + } + fn cross_to_eos(_: Weight) -> Weight { + Default::default() + } } lazy_static::lazy_static! { @@ -113,8 +148,8 @@ pub mod sr25519 { impl From for Public { fn from(acct: sp_runtime::AccountId32) -> Self { - let mut data = [0u8;32]; - let acct_data: &[u8;32] = acct.as_ref(); + let mut data = [0u8; 32]; + let acct_data: &[u8; 32] = acct.as_ref(); for (index, val) in acct_data.iter().enumerate() { data[index] = *val; } @@ -137,7 +172,7 @@ pub mod sr25519 { pub mod ed25519 { mod app_ed25519 { - use sp_application_crypto::{app_crypto, key_types::ACCOUNT, ed25519}; + use sp_application_crypto::{app_crypto, ed25519, key_types::ACCOUNT}; app_crypto!(ed25519, ACCOUNT); } @@ -156,8 +191,9 @@ pub mod ed25519 { const EOS_NODE_URL: &[u8] = b"EOS_NODE_URL"; const EOS_SECRET_KEY: &[u8] = b"EOS_SECRET_KEY"; -pub type CurrencyIdOf = -<::CurrenciesHandler as MultiCurrency<::AccountId>>::CurrencyId; +pub type CurrencyIdOf = <::CurrenciesHandler as MultiCurrency< + ::AccountId, +>>::CurrencyId; #[derive(Encode, Decode, Clone, PartialEq, Debug, Copy)] #[non_exhaustive] @@ -272,7 +308,11 @@ decl_error! { pub trait Config: SendTransactionTypes> + pallet_authorship::Config { /// The identifier type for an authority. - type AuthorityId: Member + Parameter + RuntimeAppPublic + Default + Ord + type AuthorityId: Member + + Parameter + + RuntimeAppPublic + + Default + + Ord + From<::AccountId>; type Event: From> + Into<::Event>; @@ -284,10 +324,10 @@ pub trait Config: SendTransactionTypes> + pallet_authorship::Config { type Precision: Member + Parameter + AtLeast32Bit + Default + Copy + MaybeSerializeDeserialize; type CurrenciesHandler: MultiCurrency - + MultiReservableCurrency; + + MultiReservableCurrency; /// vtoken-mint module handler - type VtokenPoolHandler: VtokenMintExt; + type VtokenPoolHandler: VtokenMintExt; /// A dispatchable call type. type Call: From>; @@ -783,7 +823,13 @@ impl Module { Self::calculate_block_header_merkle_root(&mut merkle, &block_header, &block_ids)?; // verify block header signature - Self::verify_block_header_signature(schedule_hash, producer_schedule, block_header, &merkle.get_root()).map_err(|_| Error::::SignatureVerificationFailure)?; + Self::verify_block_header_signature( + schedule_hash, + producer_schedule, + block_header, + &merkle.get_root(), + ) + .map_err(|_| Error::::SignatureVerificationFailure)?; // append current block id let block_id = block_header.id().map_err(|_| Error::::FailureOnGetBlockId)?; @@ -800,7 +846,9 @@ impl Module { expected_mroot: &Checksum256, ) -> Result<(), Error> { let pk = producer_schedule.get_producer_key(block_header.block_header.producer); - block_header.verify(*expected_mroot, *schedule_hash, pk).map_err(|_| Error::::SignatureVerificationFailure)?; + block_header + .verify(*expected_mroot, *schedule_hash, pk) + .map_err(|_| Error::::SignatureVerificationFailure)?; Ok(()) } @@ -815,19 +863,21 @@ impl Module { } // append previous block id - merkle.append(block_header.block_header.previous).map_err(|_| Error::::AppendIncreMerkleError)?; + merkle + .append(block_header.block_header.previous) + .map_err(|_| Error::::AppendIncreMerkleError)?; Ok(()) } fn get_schedule_hash_and_public_key( - new_producers: Option<&ProducerSchedule> + new_producers: Option<&ProducerSchedule>, ) -> Result<(Checksum256, ProducerAuthoritySchedule), Error> { let ps = match new_producers { Some(producers) => { let schedule_version = PendingScheduleVersion::get(); if schedule_version != producers.version { - return Err(Error::::InvalidScheduleHash) + return Err(Error::::InvalidScheduleHash); } let producers = ProducerSchedules::get(schedule_version).0; let ps = ProducerAuthoritySchedule::new(schedule_version, producers); @@ -838,25 +888,32 @@ impl Module { let producers = ProducerSchedules::get(schedule_version).0; let ps = ProducerAuthoritySchedule::new(schedule_version, producers); ps - } + }, }; - let schedule_hash: Checksum256 = ps.schedule_hash().map_err(|_| Error::::InvalidScheduleHash)?; + let schedule_hash: Checksum256 = + ps.schedule_hash().map_err(|_| Error::::InvalidScheduleHash)?; Ok((schedule_hash, ps)) } fn get_action_transfer_from_action(act: &Action) -> Result> { - let action_transfer = ActionTransfer::read(&act.data, &mut 0).map_err(|_| Error::::EosChainError)?; + let action_transfer = + ActionTransfer::read(&act.data, &mut 0).map_err(|_| Error::::EosChainError)?; Ok(action_transfer) } fn transaction_from_eos_to_bifrost( - action_transfer: &ActionTransfer + action_transfer: &ActionTransfer, ) -> Result<(T::AccountId, T::Balance), Error> { - // check memo, example like "alice@bifrost:EOS", the formatter: {receiver}@{chain}:{token_symbol} - let split_memo = action_transfer.memo.as_str().split(|c| c == '@' || c == ':').collect::>(); + // check memo, example like "alice@bifrost:EOS", the formatter: + // {receiver}@{chain}:{token_symbol} + let split_memo = action_transfer + .memo + .as_str() + .split(|c| c == '@' || c == ':') + .collect::>(); // the length should be 2, either 3. if split_memo.len().gt(&3) || split_memo.len().lt(&2) { @@ -872,17 +929,15 @@ impl Module { let token_id = { match split_memo.len() { 2 => eos_id, - 3 => { - match split_memo[2] { - "" | "vEOS" => v_eos_id, - "EOS" => eos_id, - _ => { - log::error!("A invalid token type, default token type will be vtoken"); - return Err(Error::::InvalidMemo); - } - } - } - _ => unreachable!("previous step checked he length of split_memo.") + 3 => match split_memo[2] { + "" | "vEOS" => v_eos_id, + "EOS" => eos_id, + _ => { + log::error!("A invalid token type, default token type will be vtoken"); + return Err(Error::::InvalidMemo); + }, + }, + _ => unreachable!("previous step checked he length of split_memo."), } }; // todo, vEOS or EOS, all asset will be added to EOS asset, instead of vEOS or EOS @@ -901,18 +956,25 @@ impl Module { Error::::EOSSymbolMismatch ); - let token_balances = (action_transfer.quantity.amount as u128) * 10u128.pow(12 - symbol_precision as u32); - let new_balance: T::Balance = TryFrom::::try_from(token_balances).map_err(|_| Error::::VtokenMintBalanceError)?; + let token_balances = + (action_transfer.quantity.amount as u128) * 10u128.pow(12 - symbol_precision as u32); + let new_balance: T::Balance = TryFrom::::try_from(token_balances) + .map_err(|_| Error::::VtokenMintBalanceError)?; if token_id.is_vtoken() { // according vtoken mint pool to mint EOS vEOS - let vtoken_balances: T::Balance = - new_balance.saturating_mul(T::VtokenPoolHandler::get_mint_pool(v_eos_id)) / T::VtokenPoolHandler::get_mint_pool(eos_id); + let vtoken_balances: T::Balance = new_balance + .saturating_mul(T::VtokenPoolHandler::get_mint_pool(v_eos_id)) / + T::VtokenPoolHandler::get_mint_pool(eos_id); <::CurrenciesHandler as MultiCurrency< - ::AccountId>>::deposit(v_eos_id, &target, vtoken_balances).map_err(|_| Error::::DepositError)?; + ::AccountId, + >>::deposit(v_eos_id, &target, vtoken_balances) + .map_err(|_| Error::::DepositError)?; } else { <::CurrenciesHandler as MultiCurrency< - ::AccountId>>::deposit(eos_id, &target, new_balance).map_err(|_| Error::::DepositError)?; + ::AccountId, + >>::deposit(eos_id, &target, new_balance) + .map_err(|_| Error::::DepositError)?; } Ok((target, new_balance)) @@ -920,7 +982,7 @@ impl Module { fn transaction_from_bifrost_to_eos( pending_trx_id: Checksum256, - action_transfer: &ActionTransfer + action_transfer: &ActionTransfer, ) -> Result> { let (processing_trx, trade_index) = ProcessingBridgeTrx::::get(&pending_trx_id); @@ -929,7 +991,8 @@ impl Module { let target = from.clone(); let all_vtoken_balances = <::CurrenciesHandler as MultiCurrency< - ::AccountId>>::free_balance(asset_id, &target); + ::AccountId, + >>::free_balance(asset_id, &target); let symbol = action_transfer.quantity.symbol; let symbol_code = symbol.code().to_string().into_bytes(); @@ -943,8 +1006,10 @@ impl Module { Error::::EOSSymbolMismatch ); - let token_balances = (action_transfer.quantity.amount as u128) * 10u128.pow(12 - symbol_precision as u32); - let vtoken_balances = TryFrom::::try_from(token_balances).map_err(|_| Error::::VtokenMintBalanceError)?; + let token_balances = (action_transfer.quantity.amount as u128) * + 10u128.pow(12 - symbol_precision as u32); + let vtoken_balances = TryFrom::::try_from(token_balances) + .map_err(|_| Error::::VtokenMintBalanceError)?; if all_vtoken_balances.lt(&vtoken_balances) { log::warn!("origin account balance must be greater than or equal to the transfer amount."); @@ -953,7 +1018,8 @@ impl Module { // the trade is verified, unlock asset <::CurrenciesHandler as MultiReservableCurrency< - ::AccountId>>::unreserve(asset_id, &target, vtoken_balances); + ::AccountId, + >>::unreserve(asset_id, &target, vtoken_balances); // update times of trade from Bifrost => EOS if LowLimitOnCrossChain::::get() <= vtoken_balances { @@ -969,7 +1035,7 @@ impl Module { ProcessingBridgeTrx::::remove(pending_trx_id); return Ok(target.clone()); - } + }, _ => (), } @@ -979,7 +1045,8 @@ impl Module { /// check receiver account format /// https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) fn get_account_data(receiver: &str) -> Result<[u8; 32], Error> { - let decoded_ss58 = bs58::decode(receiver).into_vec().map_err(|_| Error::::InvalidAccountId)?; + let decoded_ss58 = + bs58::decode(receiver).into_vec().map_err(|_| Error::::InvalidAccountId)?; // todo, decoded_ss58.first() == Some(&42) || Some(&6) || ... if decoded_ss58.len() == 35 { @@ -1000,21 +1067,35 @@ impl Module { raw_to: Vec, bridge_asset: BridgeAssetBalance, P, B>, ) -> Result>, Error> - where - P: AtLeast32Bit + Copy, - B: AtLeast32Bit + Copy, + where + P: AtLeast32Bit + Copy, + B: AtLeast32Bit + Copy, { let (raw_from, threshold) = BridgeContractAccount::get(); - let memo = core::str::from_utf8(&bridge_asset.memo).map_err(|_| Error::::ParseUtf8Error)?.to_string(); - let amount = Self::convert_to_eos_asset::, P, B>(&bridge_asset)?; - - let tx_out = TxOut::>::init(raw_from, raw_to, amount, threshold, &memo, bridge_asset.from.clone(), bridge_asset.asset_id)?; + let memo = core::str::from_utf8(&bridge_asset.memo) + .map_err(|_| Error::::ParseUtf8Error)? + .to_string(); + let amount = + Self::convert_to_eos_asset::, P, B>(&bridge_asset)?; + + let tx_out = TxOut::>::init( + raw_from, + raw_to, + amount, + threshold, + &memo, + bridge_asset.from.clone(), + bridge_asset.asset_id, + )?; CrossTradeIndex::::mutate(&bridge_asset.from, |index| { *index += 1; }); - BridgeTrxStatus::::insert((&tx_out, CrossTradeIndex::::get(&bridge_asset.from)), TransactionStatus::Initialized); + BridgeTrxStatus::::insert( + (&tx_out, CrossTradeIndex::::get(&bridge_asset.from)), + TransactionStatus::Initialized, + ); Ok(tx_out) } @@ -1026,25 +1107,32 @@ impl Module { let sk = SecretKey::from_wif(&sk_str).map_err(|_| Error::::ParseSecretKeyError)?; let mut changed_status_trxs = Vec::new(); - for ((trx, index), status) in BridgeTrxStatus::::iter() - .filter(|(_, status)| - status == &TransactionStatus::Initialized || + for ((trx, index), status) in BridgeTrxStatus::::iter().filter(|(_, status)| { + status == &TransactionStatus::Initialized || status == &TransactionStatus::Created || status == &TransactionStatus::SignComplete - ) - { + }) { match (trx.clone(), status) { - (TxOut::>::Initialized(_), TransactionStatus::Initialized) => { - match trx.clone().generate::(node_url.as_str()) { - Ok(generated_trx) => { - changed_status_trxs.push(((generated_trx, index), TransactionStatus::Created, (trx.clone(), index), None)); - } - Err(e) => { - log::error!("failed to get latest block due to: {:?}", e); - } - } - } - (TxOut::>::Created(_), TransactionStatus::Created) => { + ( + TxOut::>::Initialized(_), + TransactionStatus::Initialized, + ) => match trx.clone().generate::(node_url.as_str()) { + Ok(generated_trx) => { + changed_status_trxs.push(( + (generated_trx, index), + TransactionStatus::Created, + (trx.clone(), index), + None, + )); + }, + Err(e) => { + log::error!("failed to get latest block due to: {:?}", e); + }, + }, + ( + TxOut::>::Created(_), + TransactionStatus::Created, + ) => { let author = >::author(); // ensure current node has the right to sign a cross trade if NotaryKeys::::get().contains(&author) { @@ -1052,42 +1140,63 @@ impl Module { Ok(signed_trx) => { // ensure this transaction collects enough signatures let status = { - if let TxOut::>::Created(_) = signed_trx { + if let TxOut::>::Created(_) = + signed_trx + { TransactionStatus::Created } else { TransactionStatus::SignComplete } }; - changed_status_trxs.push(((signed_trx, index), status, (trx.clone(), index), None)); - } + changed_status_trxs.push(( + (signed_trx, index), + status, + (trx.clone(), index), + None, + )); + }, Err(e) => { log::error!("failed to get latest block due to: {:?}", e); - } - } - } - } - (TxOut::>::SignComplete(_), TransactionStatus::SignComplete) => { - match trx.clone().send::(node_url.as_str()) { - Ok(processing_trx) => { - let trx_id = match processing_trx { - TxOut::Sent { tx_id, .. } => Some(tx_id.clone()), - _ => None, - }; - changed_status_trxs.push(((processing_trx, index), TransactionStatus::Sent, (trx.clone(), index), trx_id)); - } - Err(e) => { - match e { - Error::::SendingDuplicatedTransaction => { - changed_status_trxs.push(((trx.clone(), index), TransactionStatus::Sent, (trx, index), None)); - } - Error::::TransactionExpired => { - changed_status_trxs.push(((trx.clone(), index), TransactionStatus::Sent, (trx, index), None)); - } - _ => {} - } + }, } } - } + }, + ( + TxOut::>::SignComplete(_), + TransactionStatus::SignComplete, + ) => match trx.clone().send::(node_url.as_str()) { + Ok(processing_trx) => { + let trx_id = match processing_trx { + TxOut::Sent { tx_id, .. } => Some(tx_id.clone()), + _ => None, + }; + changed_status_trxs.push(( + (processing_trx, index), + TransactionStatus::Sent, + (trx.clone(), index), + trx_id, + )); + }, + Err(e) => match e { + Error::::SendingDuplicatedTransaction => { + changed_status_trxs.push(( + (trx.clone(), index), + TransactionStatus::Sent, + (trx, index), + None, + )); + }, + Error::::TransactionExpired => { + changed_status_trxs.push(( + (trx.clone(), index), + TransactionStatus::Sent, + (trx, index), + None, + )); + }, + _ => {}, + }, + }, _ => continue, } } @@ -1104,40 +1213,55 @@ impl Module { } fn convert_to_eos_asset( - bridge_asset: &BridgeAssetBalance + bridge_asset: &BridgeAssetBalance, ) -> Result> - where - P: AtLeast32Bit + Copy, - B: AtLeast32Bit + Copy + where + P: AtLeast32Bit + Copy, + B: AtLeast32Bit + Copy, { let precision = bridge_asset.symbol.precision.saturated_into::(); - let symbol_str = core::str::from_utf8(&bridge_asset.symbol.symbol).map_err(|_| Error::::ParseUtf8Error)?; - let symbol_code = SymbolCode::try_from(symbol_str).map_err(|_| Error::::ParseUtf8Error)?; + let symbol_str = core::str::from_utf8(&bridge_asset.symbol.symbol) + .map_err(|_| Error::::ParseUtf8Error)?; + let symbol_code = + SymbolCode::try_from(symbol_str).map_err(|_| Error::::ParseUtf8Error)?; let symbol = Symbol::new_with_code(precision, symbol_code); - let amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(12 - precision as u32))) as i64; + let amount = (bridge_asset.amount.saturated_into::() / + (10u128.pow(12 - precision as u32))) as i64; Ok(Asset::new(amount, symbol)) } fn get_offchain_storage(key: &[u8]) -> Result> { - let value = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, key, ).ok_or(Error::::NoLocalStorage)?; + let value = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, key) + .ok_or(Error::::NoLocalStorage)?; Ok(String::from_utf8(value).map_err(|_| Error::::ParseUtf8Error)?) } } -impl BridgeAssetTo, T::Precision, T::Balance> for Module { +impl BridgeAssetTo, T::Precision, T::Balance> + for Module +{ type Error = crate::Error; - fn bridge_asset_to(target: Vec, bridge_asset: BridgeAssetBalance, T::Precision, T::Balance>) -> Result<(), Self::Error> { + fn bridge_asset_to( + target: Vec, + bridge_asset: BridgeAssetBalance, T::Precision, T::Balance>, + ) -> Result<(), Self::Error> { let _ = Self::tx_transfer_to(target, bridge_asset)?; Ok(()) } - fn redeem(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { Ok(()) } - fn stake(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { Ok(()) } - fn unstake(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { Ok(()) } + fn redeem(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { + Ok(()) + } + fn stake(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { + Ok(()) + } + fn unstake(_: CurrencyIdOf, _: T::Balance, _: Vec) -> Result<(), Self::Error> { + Ok(()) + } } #[allow(deprecated)] diff --git a/pallets/bridge-eos/src/mock.rs b/pallets/bridge-eos/src/mock.rs index ab49686d22..c244d659aa 100644 --- a/pallets/bridge-eos/src/mock.rs +++ b/pallets/bridge-eos/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/bridge-eos/src/tests.rs b/pallets/bridge-eos/src/tests.rs index ba06baf979..b3b51746fd 100644 --- a/pallets/bridge-eos/src/tests.rs +++ b/pallets/bridge-eos/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -18,28 +18,26 @@ #![cfg(test)] -use crate::*; -use crate::mock::*; use core::{convert::From, str::FromStr}; -use eos_chain::{ - Action, ActionReceipt, Checksum256, ProducerAuthoritySchedule, IncrementalMerkle, SignedBlockHeader -}; #[cfg(feature = "std")] -use std::{ - error::Error, - fs::File, - io::Read as StdRead, - path::Path, -}; -use sp_core::H256; -use sp_core::offchain::{ - OffchainDbExt, TransactionPoolExt, - testing::{TestOffchainExt, TestTransactionPoolExt}, +use std::{error::Error, fs::File, io::Read as StdRead, path::Path}; + +use eos_chain::{ + Action, ActionReceipt, Checksum256, IncrementalMerkle, ProducerAuthoritySchedule, + SignedBlockHeader, }; -use sp_runtime::traits::Header as HeaderT; -use sp_runtime::{generic::DigestItem, testing::Header}; -use node_primitives::{BridgeAssetSymbol, BlockchainType}; use frame_support::assert_ok; +use node_primitives::{BlockchainType, BridgeAssetSymbol}; +use sp_core::{ + offchain::{ + testing::{TestOffchainExt, TestTransactionPoolExt}, + OffchainDbExt, TransactionPoolExt, + }, + H256, +}; +use sp_runtime::{generic::DigestItem, testing::Header, traits::Header as HeaderT}; + +use crate::{mock::*, *}; #[test] fn get_latest_schedule_version_should_work() { @@ -66,17 +64,23 @@ fn test_incremental_merkle() { "4d018eda9a22334ac0492489fdf79118d696eea52af3871a7e4bf0e2d5ab5945".into(), "acba7c7ee5c1d8ba97ea1a841707fbb2147e883b56544ba821814aebe086383e".into(), "afa502d408f5bdf1660fa9fe3a1fcb432462467e7eb403a8499392ee5297d8d1".into(), - "4d723385cad26cf80c2db366f9666a3ef77679c098e07d1af48d523b64b1d460".into() + "4d723385cad26cf80c2db366f9666a3ef77679c098e07d1af48d523b64b1d460".into(), ]; let mut merkle = IncrementalMerkle::new(node_count, active_nodes); let _ = merkle.append(id); - assert_eq!("bd1dc07bd4f14bf4d9a32834ec1d35ea92eda26cc220fe91f4f65052bfb1d45a", merkle.get_root().to_string()); + assert_eq!( + "bd1dc07bd4f14bf4d9a32834ec1d35ea92eda26cc220fe91f4f65052bfb1d45a", + merkle.get_root().to_string() + ); let id = "00002461b0e90b849fe37ff9514230b4f9fc4012d0394b7d2445fedef6a45807"; // 9313 let id = Checksum256::from(id); let _ = merkle.append(id); - assert_eq!("33cef09fe2565cb5ed2c18c389209897a226a4f8c47360d88cdc2dcc17a8cfc5", merkle.get_root().to_string()); + assert_eq!( + "33cef09fe2565cb5ed2c18c389209897a226a4f8c47360d88cdc2dcc17a8cfc5", + merkle.get_root().to_string() + ); } #[test] @@ -93,7 +97,7 @@ fn block_id_append_should_be_ok() { "0000246915e14cc2f5577cad9cc75ad0b910c98f4bcb0153d8191d061176d6ff".into(), "0000246a7b047fb30b2052ad0af56787299bf123431e29f947c0f9c2a75f5cfb".into(), "0000246b53b5dae2e0e3a84c84c3a67119fa1f1cfb4983995ef7c69d1c6adba1".into(), - "0000246c6388126ca93772c79ccf476f8f1aea397895fe35c05c6b153dad4e4f".into() + "0000246c6388126ca93772c79ccf476f8f1aea397895fe35c05c6b153dad4e4f".into(), ]; let node_count = 9312; @@ -102,13 +106,16 @@ fn block_id_append_should_be_ok() { "4d018eda9a22334ac0492489fdf79118d696eea52af3871a7e4bf0e2d5ab5945".into(), "acba7c7ee5c1d8ba97ea1a841707fbb2147e883b56544ba821814aebe086383e".into(), "afa502d408f5bdf1660fa9fe3a1fcb432462467e7eb403a8499392ee5297d8d1".into(), - "bd1dc07bd4f14bf4d9a32834ec1d35ea92eda26cc220fe91f4f65052bfb1d45a".into() + "bd1dc07bd4f14bf4d9a32834ec1d35ea92eda26cc220fe91f4f65052bfb1d45a".into(), ]; let mut merkle = IncrementalMerkle::new(node_count, active_nodes); for id in ids { let _ = merkle.append(id); } - assert_eq!(merkle.get_root().to_string(), "fc30e3852df3ecde2314fa1bbd4372341d1c9b922f9f44ce04460fb209b263e4"); + assert_eq!( + merkle.get_root().to_string(), + "fc30e3852df3ecde2314fa1bbd4372341d1c9b922f9f44ce04460fb209b263e4" + ); } #[test] @@ -116,13 +123,15 @@ fn verify_block_header_signature_should_succeed() { new_test_ext().execute_with(|| { let json = "v2_data/change-schedule-27776771.json"; let signed_blocks_str = read_json_from_file(json); - let signed_blocks: Result, _> = serde_json::from_str(&signed_blocks_str.unwrap()); + let signed_blocks: Result, _> = + serde_json::from_str(&signed_blocks_str.unwrap()); assert!(signed_blocks.is_ok()); let signed_blocks_headers = signed_blocks.unwrap(); let producers_schedule_json = "v2_data/producers-schedule-42.json"; let producers_schedule_str = read_json_from_file(&producers_schedule_json).unwrap(); - let producers_schedule_v2: Result = serde_json::from_str(&producers_schedule_str); + let producers_schedule_v2: Result = + serde_json::from_str(&producers_schedule_str); assert!(producers_schedule_v2.is_ok()); let producers_schedule_v2 = producers_schedule_v2.unwrap(); @@ -130,8 +139,14 @@ fn verify_block_header_signature_should_succeed() { let signed_block_header = signed_blocks_headers.first().as_ref().unwrap().clone(); - let mroot: Checksum256 = "166c86f7ac95b10550698df6bb6741466c065e49c799a8fe92c0e293cb87a03c".into(); - let result = BridgeEos::verify_block_header_signature(&producers_schedule_v2_hash, &producers_schedule_v2, &signed_block_header, &mroot); + let mroot: Checksum256 = + "166c86f7ac95b10550698df6bb6741466c065e49c799a8fe92c0e293cb87a03c".into(); + let result = BridgeEos::verify_block_header_signature( + &producers_schedule_v2_hash, + &producers_schedule_v2, + &signed_block_header, + &mroot, + ); assert!(result.is_ok()); }); } @@ -141,7 +156,8 @@ fn verify_block_headers_should_succeed() { new_test_ext().execute_with(|| { let json = "v2_data/change-schedule-27776771.json"; let signed_blocks_str = read_json_from_file(json); - let signed_blocks: Result, _> = serde_json::from_str(&signed_blocks_str.unwrap()); + let signed_blocks: Result, _> = + serde_json::from_str(&signed_blocks_str.unwrap()); assert!(signed_blocks.is_ok()); let signed_blocks_headers = signed_blocks.unwrap(); @@ -152,16 +168,20 @@ fn verify_block_headers_should_succeed() { let producers_schedule_json = "v2_data/producers-schedule-42.json"; let producers_schedule_str = read_json_from_file(&producers_schedule_json).unwrap(); - let producers_schedule_v2: Result = serde_json::from_str(&producers_schedule_str); + let producers_schedule_v2: Result = + serde_json::from_str(&producers_schedule_str); assert!(producers_schedule_v2.is_ok()); let producers_schedule_v2 = producers_schedule_v2.unwrap(); let producers_schedule_v2_hash = producers_schedule_v2.schedule_hash(); assert!(producers_schedule_v2_hash.is_ok()); - let block_ids_list: Vec> = block_ids_list.as_ref().unwrap().iter().map(|ids| { - ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>() - }).collect::>(); + let block_ids_list: Vec> = block_ids_list + .as_ref() + .unwrap() + .iter() + .map(|ids| ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>()) + .collect::>(); let node_count = 27776769; let active_nodes: Vec = vec![ @@ -178,11 +198,17 @@ fn verify_block_headers_should_succeed() { "28e66467001758a36489e45cc20f9c1812a3b853f2827a6a662fa02935b5ee59".into(), "89c365695ac50e1342d854bf4bdb35066ca7b1954d04c6df4581915c5147b4df".into(), "9292a3e4f9af07c619ba70ca31f8aef64bae7a31154369544f32874b416b2dad".into(), - "4095785f71399bf608c063e43ca5a8b0d09500d7560b1f2ea991ad3d59be5c26".into() + "4095785f71399bf608c063e43ca5a8b0d09500d7560b1f2ea991ad3d59be5c26".into(), ]; let merkle = IncrementalMerkle::new(node_count, active_nodes); - assert_ok!(BridgeEos::verify_block_headers(merkle, &producers_schedule_v2_hash.unwrap(), &producers_schedule_v2, &signed_blocks_headers, block_ids_list)); + assert_ok!(BridgeEos::verify_block_headers( + merkle, + &producers_schedule_v2_hash.unwrap(), + &producers_schedule_v2, + &signed_blocks_headers, + block_ids_list + )); }); } @@ -192,7 +218,8 @@ fn change_schedule_should_work() { // insert producers schedule v1 in advance. let producers_schedule_json = "v2_data/producers-schedule-42.json"; let producers_schedule_str = read_json_from_file(&producers_schedule_json).unwrap(); - let producers_schedule_v2: Result = serde_json::from_str(&producers_schedule_str); + let producers_schedule_v2: Result = + serde_json::from_str(&producers_schedule_str); assert!(producers_schedule_v2.is_ok()); let producers_schedule_v2 = producers_schedule_v2.unwrap(); @@ -200,11 +227,15 @@ fn change_schedule_should_work() { assert!(producers_schedule_v2_hash.is_ok()); PendingScheduleVersion::put(producers_schedule_v2.version); - ProducerSchedules::insert(producers_schedule_v2.version, (&producers_schedule_v2.producers, producers_schedule_v2_hash.unwrap())); + ProducerSchedules::insert( + producers_schedule_v2.version, + (&producers_schedule_v2.producers, producers_schedule_v2_hash.unwrap()), + ); let block_headers_json = "v2_data/change-schedule-27776771.json"; let signed_blocks_str = read_json_from_file(block_headers_json); - let signed_blocks: Result, _> = serde_json::from_str(&signed_blocks_str.unwrap()); + let signed_blocks: Result, _> = + serde_json::from_str(&signed_blocks_str.unwrap()); assert!(signed_blocks.is_ok()); let signed_blocks_headers = signed_blocks.unwrap(); @@ -213,9 +244,12 @@ fn change_schedule_should_work() { let block_ids_list: Result>, _> = serde_json::from_str(&ids_str); assert!(block_ids_list.is_ok()); - let block_ids_list: Vec> = block_ids_list.as_ref().unwrap().iter().map(|ids| { - ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>() - }).collect::>(); + let block_ids_list: Vec> = block_ids_list + .as_ref() + .unwrap() + .iter() + .map(|ids| ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>()) + .collect::>(); let node_count = 27776769; let active_nodes: Vec = vec![ @@ -232,23 +266,31 @@ fn change_schedule_should_work() { "28e66467001758a36489e45cc20f9c1812a3b853f2827a6a662fa02935b5ee59".into(), "89c365695ac50e1342d854bf4bdb35066ca7b1954d04c6df4581915c5147b4df".into(), "9292a3e4f9af07c619ba70ca31f8aef64bae7a31154369544f32874b416b2dad".into(), - "4095785f71399bf608c063e43ca5a8b0d09500d7560b1f2ea991ad3d59be5c26".into() + "4095785f71399bf608c063e43ca5a8b0d09500d7560b1f2ea991ad3d59be5c26".into(), ]; let alice = Origin::signed(1u64); let merkle = IncrementalMerkle::new(node_count, active_nodes); - assert_ok!(BridgeEos::change_schedule(alice, Checksum256::default(), producers_schedule_v2, merkle, signed_blocks_headers, block_ids_list)); + assert_ok!(BridgeEos::change_schedule( + alice, + Checksum256::default(), + producers_schedule_v2, + merkle, + signed_blocks_headers, + block_ids_list + )); }); } #[test] fn prove_action_should_be_ok() { new_test_ext().execute_with(|| { - // save producer schedule for block signature verification + // save producer schedule for block signature verification let producers_schedule_json = "v2_data/producers-schedule-55.json"; let producers_schedule_str = read_json_from_file(&producers_schedule_json).unwrap(); - let producers_schedule_v2: Result = serde_json::from_str(&producers_schedule_str); + let producers_schedule_v2: Result = + serde_json::from_str(&producers_schedule_str); assert!(producers_schedule_v2.is_ok()); let producers_schedule_v2 = producers_schedule_v2.unwrap(); @@ -256,12 +298,16 @@ fn prove_action_should_be_ok() { assert!(producers_schedule_v2_hash.is_ok()); PendingScheduleVersion::put(producers_schedule_v2.version); - ProducerSchedules::insert(producers_schedule_v2.version, (&producers_schedule_v2.producers, producers_schedule_v2_hash.unwrap())); + ProducerSchedules::insert( + producers_schedule_v2.version, + (&producers_schedule_v2.producers, producers_schedule_v2_hash.unwrap()), + ); // get block headers let block_headers_json = "v2_data/prove-action-blockheaders.json"; let signed_blocks_str = read_json_from_file(block_headers_json); - let signed_blocks: Result, _> = serde_json::from_str(&signed_blocks_str.unwrap()); + let signed_blocks: Result, _> = + serde_json::from_str(&signed_blocks_str.unwrap()); assert!(signed_blocks.is_ok()); let signed_blocks_headers = signed_blocks.unwrap(); @@ -280,7 +326,7 @@ fn prove_action_should_be_ok() { "ca50800f17f87553c5905dcd56740e07ad8422527a9d2ca3b03a98bc2ed1aff9".into(), "89c365695ac50e1342d854bf4bdb35066ca7b1954d04c6df4581915c5147b4df".into(), "9292a3e4f9af07c619ba70ca31f8aef64bae7a31154369544f32874b416b2dad".into(), - "a40873bf277caf1bc14709cbb3f79f1391f2f7145016d8dd93e2ecf15723a007".into() + "a40873bf277caf1bc14709cbb3f79f1391f2f7145016d8dd93e2ecf15723a007".into(), ]; let merkle = IncrementalMerkle::new(node_count, active_nodes); @@ -290,15 +336,19 @@ fn prove_action_should_be_ok() { let block_ids_list: Result>, _> = serde_json::from_str(&ids_str); assert!(block_ids_list.is_ok()); - let block_ids_list: Vec> = block_ids_list.as_ref().unwrap().iter().map(|ids| { - ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>() - }).collect::>(); + let block_ids_list: Vec> = block_ids_list + .as_ref() + .unwrap() + .iter() + .map(|ids| ids.iter().map(|id| Checksum256::from_str(id).unwrap()).collect::>()) + .collect::>(); // read action merkle paths let action_merkle_paths_json = "v2_data/prove-action-merkle-paths.json"; let action_merkle_paths_str = read_json_from_file(action_merkle_paths_json); assert!(action_merkle_paths_str.is_ok()); - let action_merkle_paths: Result, _> = serde_json::from_str(&action_merkle_paths_str.unwrap()); + let action_merkle_paths: Result, _> = + serde_json::from_str(&action_merkle_paths_str.unwrap()); assert!(action_merkle_paths.is_ok()); let action_merkle_paths = action_merkle_paths.unwrap(); let _action_merkle_paths = { @@ -311,7 +361,7 @@ fn prove_action_should_be_ok() { let actual_merkle_paths = vec![ "f33eca1a95a23a69d4bac97428c67efff07e2abf9e293740d057c686eb8c7d12".into(), - "4d3498e9702fd9b6d1253a996e7f56de064c1e9f54046cbcf18dce51df6c16e2".into() + "4d3498e9702fd9b6d1253a996e7f56de064c1e9f54046cbcf18dce51df6c16e2".into(), ]; // get action @@ -343,9 +393,16 @@ fn prove_action_should_be_ok() { let alice = Origin::signed(1u64); - assert_ok!( - BridgeEos::prove_action(alice, action.clone(), action_receipt.clone(), actual_merkle_paths, merkle, signed_blocks_headers, block_ids_list, Checksum256::default()) - ); + assert_ok!(BridgeEos::prove_action( + alice, + action.clone(), + action_receipt.clone(), + actual_merkle_paths, + merkle, + signed_blocks_headers, + block_ids_list, + Checksum256::default() + )); // ensure action_receipt is saved after proved action assert_eq!(BridgeActionReceipt::get(&action_receipt), action); @@ -363,10 +420,18 @@ fn bridge_eos_offchain_should_work() { ext.execute_with(|| { System::set_block_number(1); - sp_io::offchain::local_storage_set(StorageKind::PERSISTENT, b"EOS_NODE_URL", b"http://127.0.0.1:8888/"); + sp_io::offchain::local_storage_set( + StorageKind::PERSISTENT, + b"EOS_NODE_URL", + b"http://127.0.0.1:8888/", + ); // EOS secret key of account testa - sp_io::offchain::local_storage_set(StorageKind::PERSISTENT, b"EOS_SECRET_KEY", b"5JgbL2ZnoEAhTudReWH1RnMuQS6DBeLZt4ucV6t8aymVEuYg7sr"); + sp_io::offchain::local_storage_set( + StorageKind::PERSISTENT, + b"EOS_SECRET_KEY", + b"5JgbL2ZnoEAhTudReWH1RnMuQS6DBeLZt4ucV6t8aymVEuYg7sr", + ); let raw_to = b"alice".to_vec(); let raw_symbol = b"EOS".to_vec(); @@ -382,7 +447,11 @@ fn bridge_eos_offchain_should_work() { assert_ok!(BridgeEos::offchain(1)); // EOS secret key of account testb - sp_io::offchain::local_storage_set(StorageKind::PERSISTENT, b"EOS_SECRET_KEY", b"5J6vV6xbVV2UEwBYYDRQQ8yTDcSmHJw67XqRriF4EkEzWKUFNKj"); + sp_io::offchain::local_storage_set( + StorageKind::PERSISTENT, + b"EOS_SECRET_KEY", + b"5J6vV6xbVV2UEwBYYDRQQ8yTDcSmHJw67XqRriF4EkEzWKUFNKj", + ); rotate_author(2); assert_ok!(BridgeEos::offchain(2)); @@ -413,10 +482,8 @@ fn chech_receiver_is_ss58_format() { // alice is substrate address let alice_key = "5CFK52zU59zUhC3s6mRobEJ3zm7JeXQZaS6ybvcuCDDhWwGG"; let expected_alice = [ - 8u8, 22, 254, 6, 137, 50, 46, 38, - 205, 42, 169, 192, 220, 203, 108, 68, - 133, 19, 69, 233, 111, 150, 154, 232, - 92, 143, 26, 236, 159, 180, 112, 61 + 8u8, 22, 254, 6, 137, 50, 46, 38, 205, 42, 169, 192, 220, 203, 108, 68, 133, 19, 69, 233, + 111, 150, 154, 232, 92, 143, 26, 236, 159, 180, 112, 61, ]; let data = BridgeEos::get_account_data(alice_key); @@ -446,7 +513,8 @@ fn chech_receiver_is_ss58_format() { #[cfg(feature = "std")] fn read_json_from_file(json_name: impl AsRef) -> Result> { - let path = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/")).join(json_name.as_ref()); + let path = + Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/")).join(json_name.as_ref()); let mut file = File::open(path)?; let mut json_str = String::new(); file.read_to_string(&mut json_str)?; @@ -464,28 +532,14 @@ fn seal_header(mut header: Header, author: u64) -> Header { } fn create_header(number: u64, parent_hash: H256, state_root: H256) -> Header { - Header::new( - number, - Default::default(), - state_root, - parent_hash, - Default::default(), - ) + Header::new(number, Default::default(), state_root, parent_hash, Default::default()) } fn rotate_author(author: u64) { - let mut header = seal_header( - create_header(1, Default::default(), [1; 32].into()), - author, - ); + let mut header = seal_header(create_header(1, Default::default(), [1; 32].into()), author); header.digest_mut().pop(); // pop the seal off. - System::initialize( - &1, - &Default::default(), - header.digest(), - Default::default(), - ); + System::initialize(&1, &Default::default(), header.digest(), Default::default()); assert_eq!(Authorship::author(), author); } diff --git a/pallets/bridge-eos/src/transaction.rs b/pallets/bridge-eos/src/transaction.rs index bd5e946748..6ffbbacd2a 100644 --- a/pallets/bridge-eos/src/transaction.rs +++ b/pallets/bridge-eos/src/transaction.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -16,19 +16,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -/* -This module is mainly for composing a transaction and how to send it to EOS node. -*/ +// This module is mainly for composing a transaction and how to send it to EOS node. use alloc::string::{String, ToString}; use core::{iter::FromIterator, str::FromStr}; + use codec::{Decode, Encode}; -use crate::Error; use eos_chain::{Action, Asset, Checksum256, Read, SerializeData, Signature, Transaction}; use eos_keys::secret::SecretKey; use sp_core::offchain::Duration; use sp_std::prelude::*; +use crate::Error; + #[derive(Encode, Decode, Clone, PartialEq, Debug, Default)] pub struct TxSig { signature: Vec, @@ -46,10 +46,7 @@ pub struct MultiSig { impl MultiSig { fn new(threshold: u8) -> Self { - MultiSig { - signatures: Default::default(), - threshold, - } + MultiSig { signatures: Default::default(), threshold } } /// check whether a transaction is complete @@ -65,10 +62,7 @@ impl MultiSig { impl Default for MultiSig { fn default() -> Self { - Self { - signatures: Default::default(), - threshold: 1, - } + Self { signatures: Default::default(), threshold: 1 } } } @@ -106,12 +100,12 @@ pub enum TxOut { }, /// Eos multi-sig transaction processed successfully, so only save tx id Succeeded { - tx_id: Checksum256 + tx_id: Checksum256, }, /// Eos multi-sig transaction processed failed Failed { tx_id: Vec, - reason: Vec + reason: Vec, }, } @@ -130,13 +124,14 @@ impl TxOut Result> { let eos_from = core::str::from_utf8(&raw_from).map_err(|_| Error::::ParseUtf8Error)?; let eos_to = core::str::from_utf8(&raw_to).map_err(|_| Error::::ParseUtf8Error)?; // Construct action - let action = Action::transfer(eos_from, eos_to, amount.to_string().as_ref(), memo).map_err(|_| Error::::EosChainError)?; + let action = Action::transfer(eos_from, eos_to, amount.to_string().as_ref(), memo) + .map_err(|_| Error::::EosChainError)?; // Construct transaction let multi_sig_tx = MultiSigTx { @@ -157,28 +152,37 @@ impl TxOut { // fetch info let (chain_id, head_block_id) = eos_rpc::get_info(eos_node_url)?; - let chain_id: Vec = hex::decode(chain_id).map_err(|_| Error::::DecodeHexError)?; + let chain_id: Vec = + hex::decode(chain_id).map_err(|_| Error::::DecodeHexError)?; // fetch block - let (ref_block_num, ref_block_prefix) = eos_rpc::get_block(eos_node_url, head_block_id)?; - + let (ref_block_num, ref_block_prefix) = + eos_rpc::get_block(eos_node_url, head_block_id)?; + let actions = vec![multi_sig_tx.action.clone()]; - // Construct transaction, and it will expire after one hour if doesn't send it EOS network + // Construct transaction, and it will expire after one hour if doesn't send it EOS + // network let expiration = (sp_io::offchain::timestamp() .add(Duration::from_millis(600 * 1000)) - .unix_millis() as f64 / 1000.0) as u32; + .unix_millis() as f64 / + 1000.0) as u32; let tx = Transaction::new(expiration, ref_block_num, ref_block_prefix, actions); - multi_sig_tx.raw_tx = tx.to_serialize_data().map_err(|_| Error::::EosChainError)?; + multi_sig_tx.raw_tx = + tx.to_serialize_data().map_err(|_| Error::::EosChainError)?; multi_sig_tx.chain_id = chain_id; Ok(TxOut::Created(multi_sig_tx)) }, - _ => Err(Error::::InvalidGeneratedTxOutType) + _ => Err(Error::::InvalidGeneratedTxOutType), } } /// sign the transaction - pub fn sign(self, sk: SecretKey, author: AccountId) -> Result> { + pub fn sign( + self, + sk: SecretKey, + author: AccountId, + ) -> Result> { match self { TxOut::Created(mut multi_sig_tx) => { if multi_sig_tx.multi_sig.has_signed(author.clone()) { @@ -186,15 +190,26 @@ impl TxOut::EosChainError)?; - let sig: Signature = trx.sign(sk, chain_id.clone()).map_err(|_| Error::::EosChainError)?; - let sig_hex_data = sig.to_serialize_data().map_err(|_| Error::::EosChainError)?; - - if multi_sig_tx.multi_sig.signatures.iter().any(|signed| signed.signature.eq(&sig_hex_data)) { + let trx = Transaction::read(&multi_sig_tx.raw_tx, &mut 0) + .map_err(|_| Error::::EosChainError)?; + let sig: Signature = + trx.sign(sk, chain_id.clone()).map_err(|_| Error::::EosChainError)?; + let sig_hex_data = + sig.to_serialize_data().map_err(|_| Error::::EosChainError)?; + + if multi_sig_tx + .multi_sig + .signatures + .iter() + .any(|signed| signed.signature.eq(&sig_hex_data)) + { return Ok(TxOut::Created(multi_sig_tx)); } - - multi_sig_tx.multi_sig.signatures.push(TxSig {author, signature: sig_hex_data}); + + multi_sig_tx + .multi_sig + .signatures + .push(TxSig { author, signature: sig_hex_data }); if multi_sig_tx.multi_sig.reach_threshold() { Ok(TxOut::SignComplete(multi_sig_tx)) @@ -203,7 +218,7 @@ impl TxOut Ok(self), - _ => Err(Error::::InvalidSignedTxOutType) + _ => Err(Error::::InvalidSignedTxOutType), } } @@ -215,38 +230,37 @@ impl TxOut::ParseUtf8Error)?; - let tx_id = Checksum256::from_str(&transaction_id).map_err(|_| Error::::InvalidChecksum256)?; + let transaction_id = core::str::from_utf8(transaction_vec.as_slice()) + .map_err(|_| Error::::ParseUtf8Error)?; + let tx_id = Checksum256::from_str(&transaction_id) + .map_err(|_| Error::::InvalidChecksum256)?; - Ok(TxOut::Sent { - tx_id, - from: multi_sig_tx.from, - asset_id: multi_sig_tx.asset_id, - }) + Ok(TxOut::Sent { tx_id, from: multi_sig_tx.from, asset_id: multi_sig_tx.asset_id }) }, - _ => Err(Error::::InvalidSendTxOutType) + _ => Err(Error::::InvalidSendTxOutType), } } } pub(crate) mod eos_rpc { - /* - Compose a transaction and push a transaction to EOS net by rpc interafce, surely rpc API can be found - at: https://developers.eos.io/manuals/eos/latest/nodeos/plugins/chain_api_plugin/api-reference/index - And there're three APIs we need here: - 1. get_info: Returns an object containing various details about the blockchain. - 2. get_block: Returns an object containing various details about a specific block on the blockchain. - 3. get_block: Returns an object containing various details about a specific block on the blockchain. - */ - use alloc::collections::btree_map::BTreeMap; - use alloc::string::ToString; - use crate::Error; + // Compose a transaction and push a transaction to EOS net by rpc interafce, surely rpc API can + // be found at: https://developers.eos.io/manuals/eos/latest/nodeos/plugins/chain_api_plugin/api-reference/index + // And there're three APIs we need here: + // 1. get_info: Returns an object containing various details about the blockchain. + // 2. get_block: Returns an object containing various details about a specific block on the + // blockchain. 3. get_block: Returns an object containing various details about a specific block + // on the blockchain. + use alloc::{collections::btree_map::BTreeMap, string::ToString}; + use lite_json::{parse_json, JsonValue, Serialize}; use sp_runtime::offchain::http; + use super::*; + use crate::Error; const CHAIN_ID: [char; 8] = ['c', 'h', 'a', 'i', 'n', '_', 'i', 'd']; // key chain_id - const HEAD_BLOCK_ID: [char; 13] = ['h', 'e', 'a', 'd', '_', 'b', 'l', 'o', 'c', 'k', '_', 'i', 'd']; // key head_block_id + const HEAD_BLOCK_ID: [char; 13] = + ['h', 'e', 'a', 'd', '_', 'b', 'l', 'o', 'c', 'k', '_', 'i', 'd']; // key head_block_id const GET_INFO_API: &'static str = "/v1/chain/get_info"; const GET_BLOCK_API: &'static str = "/v1/chain/get_block"; const PUSH_TRANSACTION_API: &'static str = "/v1/chain/push_transaction"; @@ -257,22 +271,26 @@ pub(crate) mod eos_rpc { type RefBlockPrefix = u32; /// Get EOS node information - pub(crate) fn get_info(node_url: &str) -> Result<(ChainId, HeadBlockId), Error> { + pub(crate) fn get_info( + node_url: &str, + ) -> Result<(ChainId, HeadBlockId), Error> { let req_api = format!("{}{}", node_url, GET_INFO_API); let pending = http::Request::post(&req_api, vec![b"{}"]) .add_header("Content-Type", "application/json") - .send().map_err(|_| Error::::OffchainHttpError)?; + .send() + .map_err(|_| Error::::OffchainHttpError)?; let response = pending.wait().map_err(|_| Error::::OffchainHttpError)?; let body = response.body().collect::>(); - let body_str= core::str::from_utf8(body.as_slice()).map_err(|_| Error::::ParseUtf8Error)?; + let body_str = + core::str::from_utf8(body.as_slice()).map_err(|_| Error::::ParseUtf8Error)?; let node_info = parse_json(body_str).map_err(|_| Error::::LiteJsonError)?; let mut chain_id = Default::default(); let mut head_block_id = Default::default(); match node_info { - JsonValue::Object(ref json) => { + JsonValue::Object(ref json) => for item in json.iter() { if item.0 == CHAIN_ID { chain_id = { @@ -290,8 +308,7 @@ pub(crate) mod eos_rpc { } }; } - } - } + }, _ => return Err(Error::::EOSRpcError), } if chain_id == String::default() || head_block_id == String::default() { @@ -302,34 +319,45 @@ pub(crate) mod eos_rpc { } /// Get current highest block from EOS net - pub(crate) fn get_block(node_url: &str, head_block_id: String) -> Result<(BlockNum, RefBlockPrefix), Error> { + pub(crate) fn get_block( + node_url: &str, + head_block_id: String, + ) -> Result<(BlockNum, RefBlockPrefix), Error> { let req_body = { - JsonValue::Object(vec![ - ( - "block_num_or_id".chars().collect::>(), - JsonValue::String(head_block_id.chars().collect::>()), - ), - ]).serialize() + JsonValue::Object(vec![( + "block_num_or_id".chars().collect::>(), + JsonValue::String(head_block_id.chars().collect::>()), + )]) + .serialize() }; - let pending = http::Request::post(&format!("{}{}", node_url, GET_BLOCK_API), vec![req_body.as_slice()]) - .add_header("Content-Type", "application/json") - .send().map_err(|_| Error::::OffchainHttpError)?; + let pending = http::Request::post( + &format!("{}{}", node_url, GET_BLOCK_API), + vec![req_body.as_slice()], + ) + .add_header("Content-Type", "application/json") + .send() + .map_err(|_| Error::::OffchainHttpError)?; let response = pending.wait().map_err(|_| Error::::OffchainHttpError)?; let body = response.body().collect::>(); - let body_str = core::str::from_utf8(body.as_slice()).map_err(|_| Error::::ParseUtf8Error)?; - - let maps = body_str.trim_matches(|c| c == '{' || c == '}') - .split(',').into_iter().filter_map(|i| { - if i.rfind("block_num").is_some() || i.rfind("ref_block_prefix").is_some() { - match i.split(':').collect::>().as_slice() { - [key, val] => Some((key.clone(), val.clone())), - _ => None + let body_str = + core::str::from_utf8(body.as_slice()).map_err(|_| Error::::ParseUtf8Error)?; + + let maps = body_str + .trim_matches(|c| c == '{' || c == '}') + .split(',') + .into_iter() + .filter_map(|i| { + if i.rfind("block_num").is_some() || i.rfind("ref_block_prefix").is_some() { + match i.split(':').collect::>().as_slice() { + [key, val] => Some((key.clone(), val.clone())), + _ => None, + } + } else { + None } - } else { - None - } - }).collect::>(); + }) + .collect::>(); if maps.is_empty() { return Err(Error::::EOSRpcError); @@ -350,8 +378,14 @@ pub(crate) mod eos_rpc { } /// Push transaction to EOS net - pub(crate) fn push_transaction(node_url: &str, signed_trx: Vec) -> Result, Error>{ - let pending = http::Request::post(&format!("{}{}", node_url, PUSH_TRANSACTION_API), vec![signed_trx]).send().map_err(|_| Error::::OffchainHttpError)?; + pub(crate) fn push_transaction( + node_url: &str, + signed_trx: Vec, + ) -> Result, Error> { + let pending = + http::Request::post(&format!("{}{}", node_url, PUSH_TRANSACTION_API), vec![signed_trx]) + .send() + .map_err(|_| Error::::OffchainHttpError)?; let response = pending.wait().map_err(|_| Error::::OffchainHttpError)?; let body = response.body().collect::>(); @@ -369,11 +403,15 @@ pub(crate) mod eos_rpc { Ok(tx_id.into_bytes()) } - pub(crate) fn serialize_push_transaction_params(multi_sig_tx: &MultiSigTx) -> Result, Error> { + pub(crate) fn serialize_push_transaction_params( + multi_sig_tx: &MultiSigTx, + ) -> Result, Error> { let serialized_signatures = { - let mut serialized_signatures = Vec::with_capacity(multi_sig_tx.multi_sig.signatures.len()); + let mut serialized_signatures = + Vec::with_capacity(multi_sig_tx.multi_sig.signatures.len()); for tx_sig in multi_sig_tx.multi_sig.signatures.iter() { - let sig = Signature::read(&tx_sig.signature, &mut 0).map_err(|_| Error::::EosChainError)?; + let sig = Signature::read(&tx_sig.signature, &mut 0) + .map_err(|_| Error::::EosChainError)?; let val = JsonValue::String(sig.to_string().chars().collect()); serialized_signatures.push(val); } @@ -381,40 +419,40 @@ pub(crate) mod eos_rpc { }; let signed_trx = JsonValue::Object(vec![ - ( - "signatures".chars().collect::>(), - JsonValue::Array(serialized_signatures), - ), + ("signatures".chars().collect::>(), JsonValue::Array(serialized_signatures)), ( "compression".chars().collect::>(), JsonValue::String("none".chars().collect()), ), - ( - "packed_context_free_data".chars().collect::>(), - JsonValue::String(Vec::new()), - ), + ("packed_context_free_data".chars().collect::>(), JsonValue::String(Vec::new())), ( "packed_trx".chars().collect::>(), - JsonValue::String( - hex::encode(&multi_sig_tx.raw_tx).chars().collect() - ), + JsonValue::String(hex::encode(&multi_sig_tx.raw_tx).chars().collect()), ), - ]).serialize(); + ]) + .serialize(); Ok(signed_trx) } - pub(crate) fn get_transaction_id(trx_response: &str) -> Result> { + pub(crate) fn get_transaction_id( + trx_response: &str, + ) -> Result> { // error happens while pushing transaction to EOS node if !trx_response.contains("transaction_id") && !trx_response.contains("processed") { return Err(Error::::EOSRpcError); } let mut trx_id = String::new(); - let splited_strs: Vec<&str> = trx_response.trim_matches(|c| c == '{' || c == '}').split("processed").collect(); + let splited_strs: Vec<&str> = + trx_response.trim_matches(|c| c == '{' || c == '}').split("processed").collect(); for s in &splited_strs { if s.contains("transaction_id") { - trx_id = s.replace("transaction_id", "").chars().filter(|c| c.is_numeric() || c.is_alphabetic()).collect(); + trx_id = s + .replace("transaction_id", "") + .chars() + .filter(|c| c.is_numeric() || c.is_alphabetic()) + .collect(); break; } } diff --git a/pallets/bridge-iost/src/lib.rs b/pallets/bridge-iost/src/lib.rs index f21c83c1ee..7d135d641b 100644 --- a/pallets/bridge-iost/src/lib.rs +++ b/pallets/bridge-iost/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -20,6 +20,12 @@ #[macro_use] extern crate alloc; +use alloc::{ + collections::btree_map::BTreeMap, + string::{String, ToString}, +}; +use core::{convert::TryFrom, fmt::Debug, iter::FromIterator}; + use base64; use codec::{Decode, Encode}; use frame_support::{ @@ -34,9 +40,17 @@ use frame_system::{ self as system, ensure_none, ensure_root, ensure_signed, offchain::{SendTransactionTypes, SubmitTransaction}, }; -use iost_chain::spv::{Head, VERIFIER_NUM, VOTE_INTERVAL}; -use iost_chain::{verify::BlockHead, ActionTransfer, IostAction}; +use iost_chain::{ + spv::{Head, VERIFIER_NUM, VOTE_INTERVAL}, + verify::BlockHead, + ActionTransfer, IostAction, +}; use lite_json::{parse_json, JsonValue}; +use node_primitives::{ + BlockchainType, BridgeAssetBalance, BridgeAssetSymbol, BridgeAssetTo, CurrencyId, + CurrencyIdExt, TokenInfo, VtokenMintExt, +}; +use orml_traits::{MultiCurrency, MultiReservableCurrency}; use sp_application_crypto::RuntimeAppPublic; use sp_core::offchain::StorageKind; use sp_runtime::{ @@ -48,15 +62,6 @@ use sp_runtime::{ }; use sp_std::prelude::*; -use alloc::collections::btree_map::BTreeMap; -use alloc::string::{String, ToString}; -use core::{convert::TryFrom, fmt::Debug, iter::FromIterator}; -use node_primitives::{BlockchainType, BridgeAssetBalance, - BridgeAssetSymbol,BridgeAssetTo, -}; -use node_primitives::{CurrencyId, CurrencyIdExt, TokenInfo, VtokenMintExt}; -use orml_traits::{MultiCurrency, MultiReservableCurrency}; - use crate::transaction::IostTxOut; mod transaction; @@ -147,8 +152,9 @@ const IOST_ACCOUNT_NAME: &[u8] = b"IOST_ACCOUNT_NAME"; const IOST_SECRET_KEY: &[u8] = b"IOST_SECRET_KEY"; const IOST_ACCOUNT_SIG_ALOG: &[u8] = b"IOST_ACCOUNT_SIG_ALOG"; -pub type CurrencyIdOf = -<::CurrenciesHandler as MultiCurrency<::AccountId>>::CurrencyId; +pub type CurrencyIdOf = <::CurrenciesHandler as MultiCurrency< + ::AccountId, +>>::CurrencyId; decl_error! { pub enum Error for Module { @@ -256,8 +262,8 @@ pub trait Config: SendTransactionTypes> + pallet_authorship::Config { + MultiReservableCurrency; /// vtoken-mint module handler - type VtokenPoolHandler: VtokenMintExt; - + type VtokenPoolHandler: VtokenMintExt; + /// A dispatchable call type. type Call: From>; @@ -582,7 +588,7 @@ impl Module { let node_info = parse_json(data).map_err(|_| Error::::LiteJsonError)?; match node_info { - JsonValue::Array(ref json) => { + JsonValue::Array(ref json) => for (i, item) in json.iter().enumerate() { match item { JsonValue::String(ref chars) => { @@ -595,11 +601,10 @@ impl Module { 4 => action_transfer.memo = v, _ => (), } - } + }, _ => return Err(Error::::IOSTRpcError), } - } - } + }, _ => return Err(Error::::IOSTRpcError), } Ok(action_transfer) @@ -608,7 +613,8 @@ impl Module { fn transaction_from_iost_to_bifrost( action_transfer: &ActionTransfer, ) -> Result> { - // check memo, example like "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY@bifrost:IOST", the formatter: {receiver}@{chain}:{token_symbol} + // check memo, example like "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY@bifrost:IOST", + // the formatter: {receiver}@{chain}:{token_symbol} let split_memo = action_transfer .memo .as_str() @@ -636,7 +642,7 @@ impl Module { _ => { log::error!("A invalid token type, default token type will be vtoken"); return Err(Error::::InvalidMemo); - } + }, }, _ => unreachable!("previous step checked he length of split_memo."), } @@ -663,13 +669,18 @@ impl Module { if token_id.is_vtoken() { // according convert pool to convert EOS to vEOS - let vtoken_balances: T::Balance = - new_balance.saturating_mul(T::VtokenPoolHandler::get_mint_pool(v_iost_id)) / T::VtokenPoolHandler::get_mint_pool(iost_id); + let vtoken_balances: T::Balance = new_balance + .saturating_mul(T::VtokenPoolHandler::get_mint_pool(v_iost_id)) / + T::VtokenPoolHandler::get_mint_pool(iost_id); <::CurrenciesHandler as MultiCurrency< - ::AccountId>>::deposit(v_iost_id, &target, vtoken_balances).map_err(|_| Error::::DepositError)?; + ::AccountId, + >>::deposit(v_iost_id, &target, vtoken_balances) + .map_err(|_| Error::::DepositError)?; } else { <::CurrenciesHandler as MultiCurrency< - ::AccountId>>::deposit(iost_id, &target, new_balance).map_err(|_| Error::::DepositError)?; + ::AccountId, + >>::deposit(iost_id, &target, new_balance) + .map_err(|_| Error::::DepositError)?; } Ok(target) @@ -684,21 +695,19 @@ impl Module { // core::str::from_utf8(&pending_trx_id).map_err(|_| Error::::ParseUtf8Error)?; for trx in bridge_tx_outs.iter() { match trx { - IostTxOut::Processing { - tx_id, - multi_sig_tx, - } => { + IostTxOut::Processing { tx_id, multi_sig_tx } => { let tx = bs58::encode(tx_id).into_string(); // let tx = - // core::str::from_utf8(&tx_id).map_err(|_| Error::::ParseUtf8Error)?; + // core::str::from_utf8(&tx_id).map_err(|_| Error::::ParseUtf8Error)?; if pending_trx.ne(tx.as_str()) { continue; } let target = &multi_sig_tx.from; let _token_symbol = multi_sig_tx.token_type; let asset_id = Self::iost_asset_id(); - let all_vtoken_balances =<::CurrenciesHandler as MultiCurrency< - ::AccountId>>::free_balance(asset_id, &target); + let all_vtoken_balances = <::CurrenciesHandler as MultiCurrency< + ::AccountId, + >>::free_balance(asset_id, &target); // let amount = action_transfer.amount.clone(); let token_balances: u128 = action_transfer @@ -716,10 +725,11 @@ impl Module { // the trade is verified, unlock asset <::CurrenciesHandler as MultiReservableCurrency< - ::AccountId>>::unreserve(asset_id, &target, vtoken_balances); + ::AccountId, + >>::unreserve(asset_id, &target, vtoken_balances); return Ok(target.clone()); - } + }, _ => continue, } } @@ -728,9 +738,8 @@ impl Module { } fn get_account_data(receiver: &str) -> Result<[u8; 32], Error> { - let decoded_ss58 = bs58::decode(receiver) - .into_vec() - .map_err(|_| Error::::InvalidAccountId)?; + let decoded_ss58 = + bs58::decode(receiver).into_vec().map_err(|_| Error::::InvalidAccountId)?; // todo, decoded_ss58.first() == Some(&42) || Some(&6) || ... if decoded_ss58.len() == 35 { @@ -771,7 +780,7 @@ impl Module { vote_block_number as IostBlockNumber, )); Ok(()) - } + }, Err(e) => Err(e), } } @@ -819,7 +828,7 @@ impl Module { } match valid_witness.get(&b.witness) { - None => { + None => for produce_arr in producers.iter() { let produce = core::str::from_utf8(&produce_arr) .map_err(|_| Error::::ParseUtf8Error)?; @@ -828,9 +837,8 @@ impl Module { valid_witness_count = valid_witness_count + 1; break; } - } - } - _ => {} + }, + _ => {}, } parent_block_number = b.number; parent_hash = b.hash(); @@ -857,7 +865,8 @@ impl Module { let memo = core::str::from_utf8(&bridge_asset.memo) .map_err(|_| Error::::ParseUtf8Error)? .to_string(); - // let amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(12 - precision as u32))) as i64; + // let amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(12 - precision + // as u32))) as i64; let original_amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(4))) as u128; @@ -890,7 +899,8 @@ impl Module { log::info!(target: "bridge-iost", "IOST_SECRET_KEY ------------- {:?}.", sk_str.as_str()); log::info!(target: "bridge-iost", "IOST_ACCOUNT_SIG_ALOG ------------- {:?}.", sig_algorithm.as_str()); - let bridge_tx_outs = bridge_tx_outs.into_iter() + let bridge_tx_outs = bridge_tx_outs + .into_iter() .map(|bto| { match bto { // generate raw transactions @@ -901,55 +911,55 @@ impl Module { log::info!(target: "bridge-iost", "bto.generate {:?}",generated_bto); log::info!("bto.generate"); generated_bto - } + }, Err(e) => { log::info!("failed to get latest block due to: {:?}", e); bto - } + }, } - } + }, _ => bto, } }) - .map(|bto| { - match bto { - IostTxOut::>::Generated(_) => { - let _author = >::author(); - let mut ret = bto.clone(); - let decoded_sk = bs58::decode(sk_str.as_str()).into_vec().map_err(|_| Error::::IostKeysError).unwrap(); - - match bto.sign::(decoded_sk, account_name.as_str(), sig_algorithm.as_str()) { - Ok(signed_bto) => { - has_change.set(true); - log::info!(target: "bridge-iost", "bto.sign {:?}", signed_bto); - ret = signed_bto; - } - Err(e) => log::warn!("bto.sign with failure: {:?}", e), - } - ret + .map(|bto| match bto { + IostTxOut::>::Generated(_) => { + let _author = >::author(); + let mut ret = bto.clone(); + let decoded_sk = bs58::decode(sk_str.as_str()) + .into_vec() + .map_err(|_| Error::::IostKeysError) + .unwrap(); + + match bto.sign::(decoded_sk, account_name.as_str(), sig_algorithm.as_str()) { + Ok(signed_bto) => { + has_change.set(true); + log::info!(target: "bridge-iost", "bto.sign {:?}", signed_bto); + ret = signed_bto; + }, + Err(e) => log::warn!("bto.sign with failure: {:?}", e), } - _ => bto, - } + ret + }, + _ => bto, }) - .map(|bto| { - match bto { - IostTxOut::>::Signed(_) => { - match bto.clone().send::(node_url.as_str()) { - Ok(sent_bto) => { - has_change.set(true); - log::info!(target: "bridge-iost", "bto.send {:?}", sent_bto,); - log::info!("bto.send"); - sent_bto - } - Err(e) => { - log::warn!("error happened while pushing transaction: {:?}", e); - bto - } - } + .map(|bto| match bto { + IostTxOut::>::Signed(_) => { + match bto.clone().send::(node_url.as_str()) { + Ok(sent_bto) => { + has_change.set(true); + log::info!(target: "bridge-iost", "bto.send {:?}", sent_bto,); + log::info!("bto.send"); + sent_bto + }, + Err(e) => { + log::warn!("error happened while pushing transaction: {:?}", e); + bto + }, } - _ => bto, - } - }).collect::>(); + }, + _ => bto, + }) + .collect::>(); if has_change.get() { // BridgeTxOuts::::put(bridge_tx_outs.clone()); // update transaction list @@ -958,7 +968,7 @@ impl Module { match SubmitTransaction::>::submit_unsigned_transaction(call.into()) { Ok(_) => { log::info!(target: "bridge-iost", "Call::bridge_tx_report {:?}", bridge_tx_outs) - } + }, Err(e) => log::warn!("submit transaction with failure: {:?}", e), } } @@ -966,20 +976,21 @@ impl Module { } // fn convert_to_iost_asset( - // bridge_asset: &BridgeAssetBalance + // bridge_asset: &BridgeAssetBalance // ) -> Result> - // where - // P: AtLeast32Bit + Copy, - // B: AtLeast32Bit + Copy + // where + // P: AtLeast32Bit + Copy, + // B: AtLeast32Bit + Copy // { - // let precision = bridge_asset.symbol.precision.saturated_into::(); - // let symbol_str = core::str::from_utf8(&bridge_asset.symbol.symbol).map_err(|_| Error::::ParseUtf8Error)?; - // let symbol_code = SymbolCode::try_from(symbol_str).map_err(|_| Error::::ParseUtf8Error)?; - // let symbol = Symbol::new_with_code(precision, symbol_code); + // let precision = bridge_asset.symbol.precision.saturated_into::(); + // let symbol_str = core::str::from_utf8(&bridge_asset.symbol.symbol).map_err(|_| + // Error::::ParseUtf8Error)?; let symbol_code = SymbolCode::try_from(symbol_str).map_err(|_| + // Error::::ParseUtf8Error)?; let symbol = Symbol::new_with_code(precision, symbol_code); // - // let amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(12 - precision as u32))) as i64; + // let amount = (bridge_asset.amount.saturated_into::() / (10u128.pow(12 - precision as + // u32))) as i64; // - // Ok(Asset::new(amount, symbol)) + // Ok(Asset::new(amount, symbol)) // } fn get_offchain_storage(key: &[u8]) -> Result> { @@ -990,7 +1001,9 @@ impl Module { } } -impl BridgeAssetTo, T::Precision, T::Balance> for Module { +impl BridgeAssetTo, T::Precision, T::Balance> + for Module +{ type Error = crate::Error; fn bridge_asset_to( target: Vec, diff --git a/pallets/bridge-iost/src/transaction.rs b/pallets/bridge-iost/src/transaction.rs index 8c7638e0f7..6a0be5ef29 100644 --- a/pallets/bridge-iost/src/transaction.rs +++ b/pallets/bridge-iost/src/transaction.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -42,19 +42,13 @@ pub struct MultiSig { impl MultiSig { fn new(threshold: u8) -> Self { - MultiSig { - signatures: Default::default(), - threshold, - } + MultiSig { signatures: Default::default(), threshold } } } impl Default for MultiSig { fn default() -> Self { - Self { - signatures: Default::default(), - threshold: 1, - } + Self { signatures: Default::default(), threshold: 1 } } } @@ -84,10 +78,7 @@ pub enum IostTxOut { /// Signed Eos multi-sig transaction Signed(IostMultiSigTx), /// Sending Eos multi-sig transaction to and fetching tx id from Eos node - Processing { - tx_id: Vec, - multi_sig_tx: IostMultiSigTx, - }, + Processing { tx_id: Vec, multi_sig_tx: IostMultiSigTx }, /// Eos multi-sig transaction processed successfully, so only save tx id Success(Vec), /// Eos multi-sig transaction processed failed @@ -138,24 +129,20 @@ impl IostTxOut::IostChainError)?; + multi_sig_tx.raw_tx = + tx.to_serialize_data().map_err(|_| Error::::IostChainError)?; multi_sig_tx.chain_id = chain_id; // tx.sign("admin".to_string(), iost_keys::algorithm::SECP256K1, - // bs58::decode("3BZ3HWs2nWucCCvLp7FRFv1K7RR3fAjjEQccf9EJrTv4").into_vec().unwrap().as_slice()); - // log::info!(target: "bridge-iost", "tx verify {:?}", tx.verify()); + // bs58::decode("3BZ3HWs2nWucCCvLp7FRFv1K7RR3fAjjEQccf9EJrTv4").into_vec(). + // unwrap().as_slice()); log::info!(target: "bridge-iost", "tx verify {:?}", + // tx.verify()); Ok(IostTxOut::Generated(multi_sig_tx)) - } + }, _ => Err(Error::::InvalidTxOutType), } } @@ -174,14 +161,13 @@ impl IostTxOut { - multi_sig_tx.raw_tx = tx - .to_serialize_data() - .map_err(|_| Error::::IostChainError)?; + multi_sig_tx.raw_tx = + tx.to_serialize_data().map_err(|_| Error::::IostChainError)?; Ok(IostTxOut::Signed(multi_sig_tx)) - } + }, _ => Err(Error::::IostChainError), } - } + }, _ => Err(Error::::InvalidTxOutType), } } @@ -193,11 +179,8 @@ impl IostTxOut Err(Error::::InvalidTxOutType), } } @@ -207,15 +190,13 @@ pub(crate) mod iost_rpc { use lite_json::{parse_json, JsonValue}; use sp_runtime::offchain::http; - use crate::Error; - use super::*; + use crate::Error; const HASH: [char; 4] = ['h', 'a', 's', 'h']; // tx hash const CHAIN_ID: [char; 8] = ['c', 'h', 'a', 'i', 'n', '_', 'i', 'd']; // key chain_id - const HEAD_BLOCK_HASH: [char; 15] = [ - 'h', 'e', 'a', 'd', '_', 'b', 'l', 'o', 'c', 'k', '_', 'h', 'a', 's', 'h', - ]; // key head_block_hash + const HEAD_BLOCK_HASH: [char; 15] = + ['h', 'e', 'a', 'd', '_', 'b', 'l', 'o', 'c', 'k', '_', 'h', 'a', 's', 'h']; // key head_block_hash const GET_INFO_API: &'static str = "/getChainInfo"; const PUSH_TRANSACTION_API: &'static str = "/sendTx"; @@ -240,7 +221,7 @@ pub(crate) mod iost_rpc { let mut head_block_hash = Default::default(); match node_info { - JsonValue::Object(ref json) => { + JsonValue::Object(ref json) => for item in json.iter() { if item.0 == CHAIN_ID { chain_id = { @@ -258,8 +239,7 @@ pub(crate) mod iost_rpc { } }; } - } - } + }, _ => return Err(Error::::IOSTRpcError), } log::info!(target: "bridge-iost", "chain_id -- {:?} head_block_hash -- {:?}.", chain_id, head_block_hash); @@ -282,22 +262,19 @@ pub(crate) mod iost_rpc { node_url: &str, signed_trx: Vec, ) -> Result, Error> { - // log::info!(target: "bridge-iost", "signed_trx -- {:?}.", String::from_utf8_lossy(&signed_trx[..])); - - let pending = http::Request::post( - &format!("{}{}", node_url, PUSH_TRANSACTION_API), - vec![signed_trx], - ) - .send() - .map_err(|_| Error::::OffchainHttpError)?; + // log::info!(target: "bridge-iost", "signed_trx -- {:?}.", + // String::from_utf8_lossy(&signed_trx[..])); + + let pending = + http::Request::post(&format!("{}{}", node_url, PUSH_TRANSACTION_API), vec![signed_trx]) + .send() + .map_err(|_| Error::::OffchainHttpError)?; let response = pending.wait().map_err(|_| Error::::OffchainHttpError)?; let body = response.body().collect::>(); let body_str = String::from_utf8(body).map_err(|_| Error::::ParseUtf8Error)?; let tx_id = get_transaction_id(&body_str)?; - bs58::decode(tx_id) - .into_vec() - .map_err(|_| Error::::DecodeBase58Error) + bs58::decode(tx_id).into_vec().map_err(|_| Error::::DecodeBase58Error) } pub(crate) fn get_transaction_id( @@ -313,7 +290,7 @@ pub(crate) mod iost_rpc { let node_info = parse_json(trx_response).map_err(|_| Error::::LiteJsonError)?; match node_info { - JsonValue::Object(ref json) => { + JsonValue::Object(ref json) => for item in json.iter() { if item.0 == HASH { trx_id = { @@ -323,8 +300,7 @@ pub(crate) mod iost_rpc { } }; } - } - } + }, _ => return Err(Error::::IOSTRpcError), } diff --git a/pallets/call-switchgear/src/benchmarking.rs b/pallets/call-switchgear/src/benchmarking.rs index 53d2f56c5a..e095840b3d 100644 --- a/pallets/call-switchgear/src/benchmarking.rs +++ b/pallets/call-switchgear/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/call-switchgear/src/lib.rs b/pallets/call-switchgear/src/lib.rs index 098312fdcd..23802ec73b 100644 --- a/pallets/call-switchgear/src/lib.rs +++ b/pallets/call-switchgear/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/call-switchgear/src/mock.rs b/pallets/call-switchgear/src/mock.rs index b2ecfaa977..5eeb6178fe 100644 --- a/pallets/call-switchgear/src/mock.rs +++ b/pallets/call-switchgear/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/call-switchgear/src/tests.rs b/pallets/call-switchgear/src/tests.rs index 8c90c7bd33..54fb26e6ce 100644 --- a/pallets/call-switchgear/src/tests.rs +++ b/pallets/call-switchgear/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/call-switchgear/src/weights.rs b/pallets/call-switchgear/src/weights.rs index e4bc8a055a..b34b874c36 100644 --- a/pallets/call-switchgear/src/weights.rs +++ b/pallets/call-switchgear/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/rpc/runtime-api/src/lib.rs b/pallets/flexible-fee/rpc/runtime-api/src/lib.rs index 0edb2b42ca..5252aca996 100644 --- a/pallets/flexible-fee/rpc/runtime-api/src/lib.rs +++ b/pallets/flexible-fee/rpc/runtime-api/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/rpc/src/lib.rs b/pallets/flexible-fee/rpc/src/lib.rs index db30b6a9b9..723d1957a6 100644 --- a/pallets/flexible-fee/rpc/src/lib.rs +++ b/pallets/flexible-fee/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/benchmarking.rs b/pallets/flexible-fee/src/benchmarking.rs index 2f1e15c3c3..01bf0c805c 100644 --- a/pallets/flexible-fee/src/benchmarking.rs +++ b/pallets/flexible-fee/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/fee_dealer.rs b/pallets/flexible-fee/src/fee_dealer.rs index 9ef6a73bce..fd7aaec300 100644 --- a/pallets/flexible-fee/src/fee_dealer.rs +++ b/pallets/flexible-fee/src/fee_dealer.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/lib.rs b/pallets/flexible-fee/src/lib.rs index a50fd9e124..0b4223460f 100644 --- a/pallets/flexible-fee/src/lib.rs +++ b/pallets/flexible-fee/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/misc_fees.rs b/pallets/flexible-fee/src/misc_fees.rs index 02fb363194..a0e8d11a11 100644 --- a/pallets/flexible-fee/src/misc_fees.rs +++ b/pallets/flexible-fee/src/misc_fees.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/mock.rs b/pallets/flexible-fee/src/mock.rs index ef5d3a5639..d9440eb9ab 100644 --- a/pallets/flexible-fee/src/mock.rs +++ b/pallets/flexible-fee/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/tests.rs b/pallets/flexible-fee/src/tests.rs index 3f7b0ca01f..e5d6621c4c 100644 --- a/pallets/flexible-fee/src/tests.rs +++ b/pallets/flexible-fee/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/flexible-fee/src/weights.rs b/pallets/flexible-fee/src/weights.rs index 6995b4f474..f6049ef93d 100644 --- a/pallets/flexible-fee/src/weights.rs +++ b/pallets/flexible-fee/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/lightening-redeem/src/benchmarking.rs b/pallets/lightening-redeem/src/benchmarking.rs index bc024b004d..18de886339 100644 --- a/pallets/lightening-redeem/src/benchmarking.rs +++ b/pallets/lightening-redeem/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/lightening-redeem/src/lib.rs b/pallets/lightening-redeem/src/lib.rs index d92be55380..6f77cca87f 100644 --- a/pallets/lightening-redeem/src/lib.rs +++ b/pallets/lightening-redeem/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/lightening-redeem/src/mock.rs b/pallets/lightening-redeem/src/mock.rs index f86b3d9a25..3e86ddbc64 100644 --- a/pallets/lightening-redeem/src/mock.rs +++ b/pallets/lightening-redeem/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/lightening-redeem/src/tests.rs b/pallets/lightening-redeem/src/tests.rs index 2fd1abacd5..8db879c7f3 100644 --- a/pallets/lightening-redeem/src/tests.rs +++ b/pallets/lightening-redeem/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/lightening-redeem/src/weights.rs b/pallets/lightening-redeem/src/weights.rs index 380b575e11..95c911be1e 100644 --- a/pallets/lightening-redeem/src/weights.rs +++ b/pallets/lightening-redeem/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/rpc/runtime-api/src/lib.rs b/pallets/liquidity-mining/rpc/runtime-api/src/lib.rs index 63058cd547..fc15ef5f7a 100644 --- a/pallets/liquidity-mining/rpc/runtime-api/src/lib.rs +++ b/pallets/liquidity-mining/rpc/runtime-api/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/rpc/src/lib.rs b/pallets/liquidity-mining/rpc/src/lib.rs index 630dbaf097..67e34dcb2d 100644 --- a/pallets/liquidity-mining/rpc/src/lib.rs +++ b/pallets/liquidity-mining/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/benchmarking.rs b/pallets/liquidity-mining/src/benchmarking.rs index d9afe1ba17..f8afc1a217 100644 --- a/pallets/liquidity-mining/src/benchmarking.rs +++ b/pallets/liquidity-mining/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/lib.rs b/pallets/liquidity-mining/src/lib.rs index f11924d262..27b3a6979f 100644 --- a/pallets/liquidity-mining/src/lib.rs +++ b/pallets/liquidity-mining/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/migration.rs b/pallets/liquidity-mining/src/migration.rs index 13d33d1920..71e9f34f4c 100644 --- a/pallets/liquidity-mining/src/migration.rs +++ b/pallets/liquidity-mining/src/migration.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/mock.rs b/pallets/liquidity-mining/src/mock.rs index 0ec9562f57..19d30f12b6 100644 --- a/pallets/liquidity-mining/src/mock.rs +++ b/pallets/liquidity-mining/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/tests.rs b/pallets/liquidity-mining/src/tests.rs index 57d33db1e0..5637b7b750 100644 --- a/pallets/liquidity-mining/src/tests.rs +++ b/pallets/liquidity-mining/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/liquidity-mining/src/weights.rs b/pallets/liquidity-mining/src/weights.rs index b92e17026c..c281b31cc3 100644 --- a/pallets/liquidity-mining/src/weights.rs +++ b/pallets/liquidity-mining/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/minter-reward/src/benchmarking.rs b/pallets/minter-reward/src/benchmarking.rs index bfcc45b7de..a53816b612 100644 --- a/pallets/minter-reward/src/benchmarking.rs +++ b/pallets/minter-reward/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/minter-reward/src/lib.rs b/pallets/minter-reward/src/lib.rs index cb58a438f5..d3c4cd3be4 100644 --- a/pallets/minter-reward/src/lib.rs +++ b/pallets/minter-reward/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/minter-reward/src/mock.rs b/pallets/minter-reward/src/mock.rs index 713b21b3f0..53e3fd075c 100644 --- a/pallets/minter-reward/src/mock.rs +++ b/pallets/minter-reward/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/minter-reward/src/tests.rs b/pallets/minter-reward/src/tests.rs index 7c93767030..580cc336bb 100644 --- a/pallets/minter-reward/src/tests.rs +++ b/pallets/minter-reward/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/minter-reward/src/weights.rs b/pallets/minter-reward/src/weights.rs index e053bc0786..ea33034755 100644 --- a/pallets/minter-reward/src/weights.rs +++ b/pallets/minter-reward/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/poa-manager/src/lib.rs b/pallets/poa-manager/src/lib.rs index e5d8a13d26..db0b992c89 100644 --- a/pallets/poa-manager/src/lib.rs +++ b/pallets/poa-manager/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/proxy-validator/src/lib.rs b/pallets/proxy-validator/src/lib.rs index 8134fe18dd..4c340f5e14 100644 --- a/pallets/proxy-validator/src/lib.rs +++ b/pallets/proxy-validator/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -21,16 +21,25 @@ mod mock; mod tests; -use codec::{Encode, Decode}; -use core::convert::{From, Into}; -use frame_support::storage::{StorageMap, IterableStorageDoubleMap}; -use frame_support::{weights::Weight,decl_event, decl_error, decl_module, decl_storage, ensure, debug, Parameter}; +use core::{ + convert::{From, Into}, + ops::Div, +}; + +use codec::{Decode, Encode}; +use frame_support::{ + debug, decl_error, decl_event, decl_module, decl_storage, ensure, + storage::{IterableStorageDoubleMap, StorageMap}, + weights::Weight, + Parameter, +}; use frame_system::{ensure_root, ensure_signed}; use node_primitives::{AssetTrait, BridgeAssetTo, RewardHandler, TokenSymbol}; -use sp_runtime::RuntimeDebug; -use sp_runtime::traits::{Member, Saturating, AtLeast32Bit, Zero}; +use sp_runtime::{ + traits::{AtLeast32Bit, Member, Saturating, Zero}, + RuntimeDebug, +}; use sp_std::prelude::*; -use core::ops::Div; pub trait WeightInfo { fn set_global_asset() -> Weight; @@ -44,14 +53,30 @@ pub trait WeightInfo { } impl WeightInfo for () { - fn set_global_asset() -> Weight { Default::default() } - fn stake() -> Weight { Default::default() } - fn unstake() -> Weight { Default::default() } - fn validator_register() -> Weight { Default::default() } - fn set_need_amount() -> Weight { Default::default() } - fn set_reward_per_block() -> Weight { Default::default() } - fn deposit() -> Weight { Default::default() } - fn withdraw() -> Weight { Default::default() } + fn set_global_asset() -> Weight { + Default::default() + } + fn stake() -> Weight { + Default::default() + } + fn unstake() -> Weight { + Default::default() + } + fn validator_register() -> Weight { + Default::default() + } + fn set_need_amount() -> Weight { + Default::default() + } + fn set_reward_per_block() -> Weight { + Default::default() + } + fn deposit() -> Weight { + Default::default() + } + fn withdraw() -> Weight { + Default::default() + } } pub type ValidatorAddress = Vec; @@ -84,17 +109,8 @@ pub struct ProxyValidatorRegister { } impl ProxyValidatorRegister { - fn new( - need: Balance, - reward_per_block: Balance, - validator_address: ValidatorAddress - ) -> Self { - Self { - need, - validator_address, - reward_per_block, - ..Default::default() - } + fn new(need: Balance, reward_per_block: Balance, validator_address: ValidatorAddress) -> Self { + Self { need, validator_address, reward_per_block, ..Default::default() } } } @@ -112,13 +128,19 @@ pub trait Config: frame_system::Config { /// The units in which we record asset precision. type Precision: Member + Parameter + AtLeast32Bit + Default + Copy; /// Asset handler - type AssetTrait: AssetTrait; + type AssetTrait: AssetTrait< + Self::AssetId, + Self::AccountId, + Self::Balance, + Self::Cost, + Self::Income, + >; /// Bridge asset handler type BridgeAssetTo: BridgeAssetTo; /// Reward handler type RewardHandler: RewardHandler; /// Set default weight - type WeightInfo : WeightInfo; + type WeightInfo: WeightInfo; } decl_event! { @@ -402,7 +424,7 @@ impl Module { fn asset_lock( account_id: T::AccountId, token_symbol: TokenSymbol, - amount: T::Balance + amount: T::Balance, ) -> Result<(), Error> { // check if has enough balance let account_asset = T::AssetTrait::get_account_asset(token_symbol, &account_id); @@ -422,11 +444,14 @@ impl Module { fn asset_unlock( account_id: T::AccountId, token_symbol: TokenSymbol, - amount: T::Balance + amount: T::Balance, ) -> Result<(), Error> { // check if has enough locked_balance ensure!(LockedBalances::::contains_key(&account_id), Error::::LockedBalanceNotEnough); - ensure!(LockedBalances::::get(&account_id) >= amount, Error::::LockedBalanceNotEnough); + ensure!( + LockedBalances::::get(&account_id) >= amount, + Error::::LockedBalanceNotEnough + ); // unlock asset to this module LockedBalances::::mutate(&account_id, |locked_balance| { @@ -446,24 +471,25 @@ impl Module { let redeem_duration = asset_config.redeem_duration; let min_reward_per_block = asset_config.min_reward_per_block; - let reward; - let min_reward = val.staking.saturating_mul( - min_reward_per_block.saturating_mul(redeem_duration.into()) - ).div(1_000_000.into()).div(1_000_000.into()); + let reward; + let min_reward = val + .staking + .saturating_mul(min_reward_per_block.saturating_mul(redeem_duration.into())) + .div(1_000_000.into()) + .div(1_000_000.into()); if min_reward >= val.deposit { // call redeem by bridge-eos - T::BridgeAssetTo::redeem( - token_symbol, - val.deposit, - val.validator_address.clone() - ).map_err(|_| Error::::BridgeEOSRedeemError)?; + T::BridgeAssetTo::redeem(token_symbol, val.deposit, val.validator_address.clone()) + .map_err(|_| Error::::BridgeEOSRedeemError)?; reward = val.deposit; val.deposit = Zero::zero(); } else { let blocks = now_block - val.last_block; - reward = val.staking.saturating_mul( - val.reward_per_block.saturating_mul(blocks.into()) - ).div(1_000_000.into()).div(1_000_000.into()); + reward = val + .staking + .saturating_mul(val.reward_per_block.saturating_mul(blocks.into())) + .div(1_000_000.into()) + .div(1_000_000.into()); val.deposit = val.deposit.saturating_sub(reward); } diff --git a/pallets/proxy-validator/src/mock.rs b/pallets/proxy-validator/src/mock.rs index 1e99972823..01e2492947 100644 --- a/pallets/proxy-validator/src/mock.rs +++ b/pallets/proxy-validator/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/proxy-validator/src/tests.rs b/pallets/proxy-validator/src/tests.rs index 165843ec82..7d7b4d0bc6 100644 --- a/pallets/proxy-validator/src/tests.rs +++ b/pallets/proxy-validator/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -20,11 +20,11 @@ #![cfg(test)] -use crate::mock::*; -use crate::*; use frame_support::{assert_noop, assert_ok}; use node_primitives::{Token, TokenSymbol}; +use crate::{mock::*, *}; + fn set_global_asset(token_symbol: TokenSymbol) { let redeem_duration = 100; let min_reward_per_block = 1; diff --git a/pallets/salp-lite/src/benchmarking.rs b/pallets/salp-lite/src/benchmarking.rs index 9154d79d92..3f1ea6447f 100644 --- a/pallets/salp-lite/src/benchmarking.rs +++ b/pallets/salp-lite/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp-lite/src/lib.rs b/pallets/salp-lite/src/lib.rs index 366464852e..e53a380a36 100644 --- a/pallets/salp-lite/src/lib.rs +++ b/pallets/salp-lite/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp-lite/src/mock.rs b/pallets/salp-lite/src/mock.rs index 52bac83538..7d09905195 100644 --- a/pallets/salp-lite/src/mock.rs +++ b/pallets/salp-lite/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp-lite/src/tests.rs b/pallets/salp-lite/src/tests.rs index f5a966e937..1f37ef4530 100644 --- a/pallets/salp-lite/src/tests.rs +++ b/pallets/salp-lite/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/rpc/runtime-api/src/lib.rs b/pallets/salp/rpc/runtime-api/src/lib.rs index a8a2f4f0bc..2927d8707e 100644 --- a/pallets/salp/rpc/runtime-api/src/lib.rs +++ b/pallets/salp/rpc/runtime-api/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/rpc/src/lib.rs b/pallets/salp/rpc/src/lib.rs index 8810e5d3dc..25339db175 100644 --- a/pallets/salp/rpc/src/lib.rs +++ b/pallets/salp/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/src/benchmarking.rs b/pallets/salp/src/benchmarking.rs index dd0fa5bb8d..a74b996612 100644 --- a/pallets/salp/src/benchmarking.rs +++ b/pallets/salp/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/src/lib.rs b/pallets/salp/src/lib.rs index 75e58dfff9..1dbcb54370 100644 --- a/pallets/salp/src/lib.rs +++ b/pallets/salp/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/src/mock.rs b/pallets/salp/src/mock.rs index f5e580b38f..afbd98db86 100644 --- a/pallets/salp/src/mock.rs +++ b/pallets/salp/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/salp/src/tests.rs b/pallets/salp/src/tests.rs index c8b18ba2c9..e49121eaba 100644 --- a/pallets/salp/src/tests.rs +++ b/pallets/salp/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/settlement/src/lib.rs b/pallets/settlement/src/lib.rs index 7792abf01a..7bc9bc1826 100644 --- a/pallets/settlement/src/lib.rs +++ b/pallets/settlement/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -19,13 +19,11 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +use codec::{Decode, Encode}; +use frame_support::{decl_event, decl_module, decl_storage, traits::Get, Parameter}; +use node_primitives::{AssetIssue, ClearingHandler}; +use sp_runtime::traits::{AtLeast32Bit, Member, One, SaturatedConversion, Saturating, Zero}; use sp_std::prelude::*; -use codec::{Encode, Decode}; -use node_primitives::{ClearingHandler, AssetIssue}; -use frame_support::{ - Parameter, decl_module, decl_event, decl_storage, traits::Get -}; -use sp_runtime::traits::{Member, AtLeast32Bit, One, Zero, SaturatedConversion, Saturating}; mod mock; mod tests; @@ -40,7 +38,8 @@ pub struct BalanceDuration { value: Duration, } -impl BalanceDuration where +impl BalanceDuration +where BlockNumber: Copy + AtLeast32Bit, Balance: Copy + AtLeast32Bit + From, Duration: Copy + AtLeast32Bit + From, @@ -51,9 +50,9 @@ impl BalanceDuration Self - where - SettlementId: Copy + AtLeast32Bit, - SettlementPeriod: Get, + where + SettlementId: Copy + AtLeast32Bit, + SettlementPeriod: Get, { let stl_index = stl_id.saturated_into::(); let stl_period = SettlementPeriod::get().saturated_into::(); @@ -61,11 +60,7 @@ impl BalanceDuration ClearingHandler for Module { +impl ClearingHandler + for Module +{ fn asset_clearing( asset_id: T::AssetId, target: T::AccountId, @@ -210,16 +207,16 @@ impl Module { let stl_blocks = T::SettlementPeriod::get(); // Update token's balance duration - for ((asset_id, stl_id), _clearing_token) in >::enumerate() - .filter(|((_, stl_id), _)| *stl_id < curr_stl_id) + for ((asset_id, stl_id), _clearing_token) in + >::enumerate().filter(|((_, stl_id), _)| *stl_id < curr_stl_id) { let last_block = stl_blocks * (stl_id + One::one()).into() - One::one(); let token = >::get(asset_id); Self::token_clearing(asset_id, last_block, token.total_supply, token.total_supply); } - for (index, _clearing_asset) in >::enumerate() - .filter(|((_, _, stl_id), _)| *stl_id < curr_stl_id) + for (index, _clearing_asset) in + >::enumerate().filter(|((_, _, stl_id), _)| *stl_id < curr_stl_id) { let (asset_id, target, stl_id) = index.clone(); diff --git a/pallets/settlement/src/mock.rs b/pallets/settlement/src/mock.rs index d222145dee..e62a4ac21f 100644 --- a/pallets/settlement/src/mock.rs +++ b/pallets/settlement/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -20,11 +20,16 @@ #![cfg(test)] -use crate as pallet_settlement; use frame_support::{construct_runtime, parameter_types}; use sp_core::H256; -use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + Perbill, +}; + use super::*; +use crate as pallet_settlement; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; diff --git a/pallets/settlement/src/tests.rs b/pallets/settlement/src/tests.rs index 07f14b5c30..0e4288f173 100644 --- a/pallets/settlement/src/tests.rs +++ b/pallets/settlement/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -20,10 +20,11 @@ #![cfg(test)] -use crate::mock::{Assets, Settlement, Origin, System, new_test_ext}; use frame_support::assert_ok; -use sp_runtime::traits::{OnInitialize, OnFinalize}; +use sp_runtime::traits::{OnFinalize, OnInitialize}; + use super::*; +use crate::mock::{new_test_ext, Assets, Origin, Settlement, System}; const SETTLEMENT_PERIOD: u64 = 24 * 60 * 10; @@ -33,42 +34,40 @@ fn issuing_asset_clearing_should_work() { assert_ok!(Assets::create(Origin::root(), vec![0x12, 0x34], 8)); assert_ok!(Assets::issue(Origin::root(), 0, 1, 10000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); - assert_eq!(Settlement::clearing_tokens((0, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); + assert_eq!( + Settlement::clearing_tokens((0, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); System::set_block_number(100); assert_ok!(Assets::issue(Origin::root(), 0, 2, 20000)); - assert_eq!(Settlement::clearing_assets((0, 2, 0)), BalanceDuration { - last_block: 100, - last_balance: 20000, - value: 0, - }); - assert_eq!(Settlement::clearing_tokens((0, 0)), BalanceDuration { - last_block: 100, - last_balance: 30000, - value: 10000 * (100 - 1), - }); + assert_eq!( + Settlement::clearing_assets((0, 2, 0)), + BalanceDuration { last_block: 100, last_balance: 20000, value: 0 } + ); + assert_eq!( + Settlement::clearing_tokens((0, 0)), + BalanceDuration { last_block: 100, last_balance: 30000, value: 10000 * (100 - 1) } + ); System::set_block_number(200); assert_ok!(Assets::issue(Origin::root(), 0, 2, 30000)); - assert_eq!(Settlement::clearing_assets((0, 2, 0)), BalanceDuration { - last_block: 200, - last_balance: 50000, - value: 20000 * (200 - 100), - }); - assert_eq!(Settlement::clearing_tokens((0, 0)), BalanceDuration { - last_block: 200, - last_balance: 60000, - value: 10000 * (100 - 1) + 30000 * (200 - 100), - }); + assert_eq!( + Settlement::clearing_assets((0, 2, 0)), + BalanceDuration { last_block: 200, last_balance: 50000, value: 20000 * (200 - 100) } + ); + assert_eq!( + Settlement::clearing_tokens((0, 0)), + BalanceDuration { + last_block: 200, + last_balance: 60000, + value: 10000 * (100 - 1) + 30000 * (200 - 100), + } + ); }); } @@ -78,24 +77,21 @@ fn transfer_asset_clearing_should_work() { assert_ok!(Assets::create(Origin::root(), vec![0x12, 0x34], 8)); assert_ok!(Assets::issue(Origin::root(), 0, 1, 10000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); System::set_block_number(100); assert_ok!(Assets::transfer(Origin::signed(1), 0, 2, 1000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 100, - last_balance: 9000, - value: 10000 * (100 - 1), - }); - assert_eq!(Settlement::clearing_assets((0, 2, 0)), BalanceDuration { - last_block: 100, - last_balance: 1000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 100, last_balance: 9000, value: 10000 * (100 - 1) } + ); + assert_eq!( + Settlement::clearing_assets((0, 2, 0)), + BalanceDuration { last_block: 100, last_balance: 1000, value: 0 } + ); }); } @@ -105,27 +101,28 @@ fn destroy_asset_clearing_should_work() { assert_ok!(Assets::create(Origin::root(), vec![0x12, 0x34], 8)); assert_ok!(Assets::issue(Origin::root(), 0, 1, 10000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); System::set_block_number(100); assert_ok!(Assets::destroy(Origin::signed(1), 0, 1000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 100, - last_balance: 9000, - value: 10000 * (100 - 1), - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 100, last_balance: 9000, value: 10000 * (100 - 1) } + ); System::set_block_number(200); assert_ok!(Assets::destroy(Origin::signed(1), 0, 500)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 200, - last_balance: 8500, - value: 10000 * (100 - 1) + 9000 * (200 - 100), - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { + last_block: 200, + last_balance: 8500, + value: 10000 * (100 - 1) + 9000 * (200 - 100), + } + ); }); } @@ -151,20 +148,16 @@ fn destroy_clearing_record_should_work() { assert_ok!(Assets::create(Origin::root(), vec![0x12, 0x34], 8)); assert_ok!(Assets::issue(Origin::root(), 0, 1, 10000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); System::set_block_number(100); assert_ok!(Assets::destroy(Origin::signed(1), 0, 1000)); - assert_eq!(Settlement::clearing_assets((0, 1, Settlement::current_settlement_id())), - BalanceDuration { - last_block: 100, - last_balance: 9000, - value: 10000 * (100 - 1), - } + assert_eq!( + Settlement::clearing_assets((0, 1, Settlement::current_settlement_id())), + BalanceDuration { last_block: 100, last_balance: 9000, value: 10000 * (100 - 1) } ); System::set_block_number(SETTLEMENT_PERIOD + 100); @@ -172,13 +165,16 @@ fn destroy_clearing_record_should_work() { let curr_stl_id = Settlement::current_settlement_id(); assert_eq!(curr_stl_id, 1); assert_eq!(Settlement::next_settlement_id(), 2); - // System::set_block_number(200); + // System::set_block_number(200); assert_ok!(Assets::destroy(Origin::signed(1), 0, 500)); - assert_eq!(Settlement::clearing_assets((0, 1, curr_stl_id)), BalanceDuration { - last_block: SETTLEMENT_PERIOD + 100, - last_balance: 8500, - value: 9000 * 100, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, curr_stl_id)), + BalanceDuration { + last_block: SETTLEMENT_PERIOD + 100, + last_balance: 8500, + value: 9000 * 100, + } + ); }); } @@ -190,18 +186,16 @@ fn enumerate_should_work() { assert_ok!(Assets::create(Origin::root(), vec![0x12, 0x34], 8)); assert_ok!(Assets::issue(Origin::root(), 0, 1, 10000)); - assert_eq!(Settlement::clearing_assets((0, 1, 0)), BalanceDuration { - last_block: 1, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 1, 0)), + BalanceDuration { last_block: 1, last_balance: 10000, value: 0 } + ); assert_ok!(Assets::issue(Origin::root(), 0, 2, 5000)); - assert_eq!(Settlement::clearing_assets((0, 2, 0)), BalanceDuration { - last_block: 1, - last_balance: 5000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 2, 0)), + BalanceDuration { last_block: 1, last_balance: 5000, value: 0 } + ); Settlement::on_finalize(0); const SETTLEMENT_PERIOD: u64 = 24 * 60 * 10; @@ -209,12 +203,11 @@ fn enumerate_should_work() { Settlement::on_initialize(SETTLEMENT_PERIOD); assert_ok!(Assets::issue(Origin::root(), 0, 2, 5000)); - assert_eq!(Settlement::clearing_assets((0, 2, 1)), BalanceDuration { - last_block: 14400, - last_balance: 10000, - value: 0, - }); + assert_eq!( + Settlement::clearing_assets((0, 2, 1)), + BalanceDuration { last_block: 14400, last_balance: 10000, value: 0 } + ); -// Settlement::on_finalize(SETTLEMENT_PERIOD); + // Settlement::on_finalize(SETTLEMENT_PERIOD); }); } diff --git a/pallets/staking-reward/src/lib.rs b/pallets/staking-reward/src/lib.rs index e2f40b2700..c85236e727 100644 --- a/pallets/staking-reward/src/lib.rs +++ b/pallets/staking-reward/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -132,7 +132,7 @@ impl RewardTrait> for Modul // The total statistics let sum: T::Balance = { if record_vec.len() >= LEN { - record_vec[.. LEN] + record_vec[..LEN] .iter() .fold(T::Balance::from(0u32), |acc, x| acc.saturating_add(x.record_amount)) } else { @@ -143,7 +143,7 @@ impl RewardTrait> for Modul }; // Dispatch reward let length = if record_vec.len() < LEN { record_vec.len() } else { LEN }; - for referer in record_vec[0 .. length].iter() { + for referer in record_vec[0..length].iter() { let reward = referer.record_amount.saturating_mul(staking_profit) / sum; // Check dispatch reward if reward.ne(&T::Balance::from(0u32)) { diff --git a/pallets/staking-reward/src/mock.rs b/pallets/staking-reward/src/mock.rs index 8da0159b84..4cf80e857b 100644 --- a/pallets/staking-reward/src/mock.rs +++ b/pallets/staking-reward/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/staking-reward/src/tests.rs b/pallets/staking-reward/src/tests.rs index abf8aa1594..2b094adefc 100644 --- a/pallets/staking-reward/src/tests.rs +++ b/pallets/staking-reward/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -149,7 +149,7 @@ fn more_than_256_dispatch_reward_is_be_ok() { assert_ok!(>::record_reward(vdot_id, 100, referer_one)); assert_ok!(>::record_reward(vdot_id, 100, referer_two)); // Add other referer data - for i in 1 .. 300 { + for i in 1..300 { assert_ok!(>::record_reward(vdot_id, 100, referer_two + i)); } diff --git a/pallets/swap/src/lib.rs b/pallets/swap/src/lib.rs index 32a233242a..ccba85ee35 100644 --- a/pallets/swap/src/lib.rs +++ b/pallets/swap/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/swap/src/mock.rs b/pallets/swap/src/mock.rs index 5e522b634b..7481f77ccb 100644 --- a/pallets/swap/src/mock.rs +++ b/pallets/swap/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/swap/src/tests.rs b/pallets/swap/src/tests.rs index ee7d5e2187..635d8eaba8 100644 --- a/pallets/swap/src/tests.rs +++ b/pallets/swap/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/token-issuer/src/benchmarking.rs b/pallets/token-issuer/src/benchmarking.rs index 2a33065f20..01d0bed5fa 100644 --- a/pallets/token-issuer/src/benchmarking.rs +++ b/pallets/token-issuer/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/token-issuer/src/lib.rs b/pallets/token-issuer/src/lib.rs index 60fbcb8504..fabc902467 100644 --- a/pallets/token-issuer/src/lib.rs +++ b/pallets/token-issuer/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/token-issuer/src/mock.rs b/pallets/token-issuer/src/mock.rs index f62a39a91c..a6b7c2fdc4 100644 --- a/pallets/token-issuer/src/mock.rs +++ b/pallets/token-issuer/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/token-issuer/src/tests.rs b/pallets/token-issuer/src/tests.rs index 14f7bf3204..3bff3a2255 100644 --- a/pallets/token-issuer/src/tests.rs +++ b/pallets/token-issuer/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/token-issuer/src/weights.rs b/pallets/token-issuer/src/weights.rs index 52369611d3..64409030c0 100644 --- a/pallets/token-issuer/src/weights.rs +++ b/pallets/token-issuer/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vesting/src/benchmarking.rs b/pallets/vesting/src/benchmarking.rs index 1ecf748140..bb9ef7cb82 100644 --- a/pallets/vesting/src/benchmarking.rs +++ b/pallets/vesting/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vesting/src/lib.rs b/pallets/vesting/src/lib.rs index 46cd6ffafe..d66488a122 100644 --- a/pallets/vesting/src/lib.rs +++ b/pallets/vesting/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vesting/src/weights.rs b/pallets/vesting/src/weights.rs index a4333ca25d..c94d3cdce0 100644 --- a/pallets/vesting/src/weights.rs +++ b/pallets/vesting/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/voucher/src/lib.rs b/pallets/voucher/src/lib.rs index 02157d15c7..f1188720a3 100644 --- a/pallets/voucher/src/lib.rs +++ b/pallets/voucher/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/benchmarking.rs b/pallets/vsbond-auction/src/benchmarking.rs index ea0823ee7b..9ec11dd371 100644 --- a/pallets/vsbond-auction/src/benchmarking.rs +++ b/pallets/vsbond-auction/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/lib.rs b/pallets/vsbond-auction/src/lib.rs index 4f95d7147a..c50ca3e2e5 100644 --- a/pallets/vsbond-auction/src/lib.rs +++ b/pallets/vsbond-auction/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/migration.rs b/pallets/vsbond-auction/src/migration.rs index b380c2c2f5..2f8234a9d9 100644 --- a/pallets/vsbond-auction/src/migration.rs +++ b/pallets/vsbond-auction/src/migration.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/mock.rs b/pallets/vsbond-auction/src/mock.rs index f92449577c..6eefb5b167 100644 --- a/pallets/vsbond-auction/src/mock.rs +++ b/pallets/vsbond-auction/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/tests.rs b/pallets/vsbond-auction/src/tests.rs index 3ab7c4fa93..a6b86511e3 100644 --- a/pallets/vsbond-auction/src/tests.rs +++ b/pallets/vsbond-auction/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vsbond-auction/src/weights.rs b/pallets/vsbond-auction/src/weights.rs index 1f515608cd..befce733df 100644 --- a/pallets/vsbond-auction/src/weights.rs +++ b/pallets/vsbond-auction/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/rpc/runtime-api/src/lib.rs b/pallets/vtoken-mint/rpc/runtime-api/src/lib.rs index 33bc4e627c..a0cc3620b2 100644 --- a/pallets/vtoken-mint/rpc/runtime-api/src/lib.rs +++ b/pallets/vtoken-mint/rpc/runtime-api/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/rpc/src/lib.rs b/pallets/vtoken-mint/rpc/src/lib.rs index a10ebb97cc..81943bd8c1 100644 --- a/pallets/vtoken-mint/rpc/src/lib.rs +++ b/pallets/vtoken-mint/rpc/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/src/benchmarking.rs b/pallets/vtoken-mint/src/benchmarking.rs index 9fd4b9b9f5..0687491dc8 100644 --- a/pallets/vtoken-mint/src/benchmarking.rs +++ b/pallets/vtoken-mint/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/src/lib.rs b/pallets/vtoken-mint/src/lib.rs index 5e1999e350..1b69bdd239 100644 --- a/pallets/vtoken-mint/src/lib.rs +++ b/pallets/vtoken-mint/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/src/mock.rs b/pallets/vtoken-mint/src/mock.rs index c7edb8cb6d..7b6b7882b3 100644 --- a/pallets/vtoken-mint/src/mock.rs +++ b/pallets/vtoken-mint/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/src/tests.rs b/pallets/vtoken-mint/src/tests.rs index 7799840889..f7ebecab8a 100644 --- a/pallets/vtoken-mint/src/tests.rs +++ b/pallets/vtoken-mint/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/pallets/vtoken-mint/src/weights.rs b/pallets/vtoken-mint/src/weights.rs index 81fb9adf1b..26edfbd52d 100644 --- a/pallets/vtoken-mint/src/weights.rs +++ b/pallets/vtoken-mint/src/weights.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/build.rs b/runtime/asgard/build.rs index 26e0497ca6..fde521d7e1 100644 --- a/runtime/asgard/build.rs +++ b/runtime/asgard/build.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/benchmarking/currencies.rs b/runtime/asgard/src/benchmarking/currencies.rs index e9f2f9091d..338e6ae90f 100644 --- a/runtime/asgard/src/benchmarking/currencies.rs +++ b/runtime/asgard/src/benchmarking/currencies.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/benchmarking/mod.rs b/runtime/asgard/src/benchmarking/mod.rs index a5906c6a1e..321c404348 100644 --- a/runtime/asgard/src/benchmarking/mod.rs +++ b/runtime/asgard/src/benchmarking/mod.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/benchmarking/tokens.rs b/runtime/asgard/src/benchmarking/tokens.rs index d7686d0f49..18d1f1a03a 100644 --- a/runtime/asgard/src/benchmarking/tokens.rs +++ b/runtime/asgard/src/benchmarking/tokens.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/constants.rs b/runtime/asgard/src/constants.rs index 3724f0268c..26697e91f5 100644 --- a/runtime/asgard/src/constants.rs +++ b/runtime/asgard/src/constants.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/lib.rs b/runtime/asgard/src/lib.rs index 98fce89fce..5bc0600d54 100644 --- a/runtime/asgard/src/lib.rs +++ b/runtime/asgard/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_bancor.rs b/runtime/asgard/src/weights/bifrost_bancor.rs index b6cf808ac7..d3cf6c7818 100644 --- a/runtime/asgard/src/weights/bifrost_bancor.rs +++ b/runtime/asgard/src/weights/bifrost_bancor.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_call_switchgear.rs b/runtime/asgard/src/weights/bifrost_call_switchgear.rs index 5e7ae2f84e..d0e6b57112 100644 --- a/runtime/asgard/src/weights/bifrost_call_switchgear.rs +++ b/runtime/asgard/src/weights/bifrost_call_switchgear.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_flexible_fee.rs b/runtime/asgard/src/weights/bifrost_flexible_fee.rs index 1dd05ad0b5..c256cc1015 100644 --- a/runtime/asgard/src/weights/bifrost_flexible_fee.rs +++ b/runtime/asgard/src/weights/bifrost_flexible_fee.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_lightening_redeem.rs b/runtime/asgard/src/weights/bifrost_lightening_redeem.rs index bfd433b593..780de7f9bc 100644 --- a/runtime/asgard/src/weights/bifrost_lightening_redeem.rs +++ b/runtime/asgard/src/weights/bifrost_lightening_redeem.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_minter_reward.rs b/runtime/asgard/src/weights/bifrost_minter_reward.rs index a3a322c964..6fb0a2c0dc 100644 --- a/runtime/asgard/src/weights/bifrost_minter_reward.rs +++ b/runtime/asgard/src/weights/bifrost_minter_reward.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_salp.rs b/runtime/asgard/src/weights/bifrost_salp.rs index 3620a4616b..0b11b33a4c 100644 --- a/runtime/asgard/src/weights/bifrost_salp.rs +++ b/runtime/asgard/src/weights/bifrost_salp.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_salp_lite.rs b/runtime/asgard/src/weights/bifrost_salp_lite.rs index d4b9831670..7921bfb841 100644 --- a/runtime/asgard/src/weights/bifrost_salp_lite.rs +++ b/runtime/asgard/src/weights/bifrost_salp_lite.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_token_issuer.rs b/runtime/asgard/src/weights/bifrost_token_issuer.rs index 488d2fe533..f2c86b8350 100644 --- a/runtime/asgard/src/weights/bifrost_token_issuer.rs +++ b/runtime/asgard/src/weights/bifrost_token_issuer.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_vsbond_auction.rs b/runtime/asgard/src/weights/bifrost_vsbond_auction.rs index 54fe29a10f..5778ce165d 100644 --- a/runtime/asgard/src/weights/bifrost_vsbond_auction.rs +++ b/runtime/asgard/src/weights/bifrost_vsbond_auction.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/bifrost_vtoken_mint.rs b/runtime/asgard/src/weights/bifrost_vtoken_mint.rs index 3b2b1a14e5..36769a5f1e 100644 --- a/runtime/asgard/src/weights/bifrost_vtoken_mint.rs +++ b/runtime/asgard/src/weights/bifrost_vtoken_mint.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/mod.rs b/runtime/asgard/src/weights/mod.rs index d46e1b3163..dd455facc9 100644 --- a/runtime/asgard/src/weights/mod.rs +++ b/runtime/asgard/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/orml_currencies.rs b/runtime/asgard/src/weights/orml_currencies.rs index 8824e64801..a84b32909a 100644 --- a/runtime/asgard/src/weights/orml_currencies.rs +++ b/runtime/asgard/src/weights/orml_currencies.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/orml_tokens.rs b/runtime/asgard/src/weights/orml_tokens.rs index 95d189bae9..02e261c574 100644 --- a/runtime/asgard/src/weights/orml_tokens.rs +++ b/runtime/asgard/src/weights/orml_tokens.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/asgard/src/weights/pallet_vesting.rs b/runtime/asgard/src/weights/pallet_vesting.rs index 86dac90d23..413da665dd 100644 --- a/runtime/asgard/src/weights/pallet_vesting.rs +++ b/runtime/asgard/src/weights/pallet_vesting.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/build.rs b/runtime/bifrost-kusama/build.rs index 26e0497ca6..fde521d7e1 100644 --- a/runtime/bifrost-kusama/build.rs +++ b/runtime/bifrost-kusama/build.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/constants.rs b/runtime/bifrost-kusama/src/constants.rs index 344a96fb76..f6a6a1ae00 100644 --- a/runtime/bifrost-kusama/src/constants.rs +++ b/runtime/bifrost-kusama/src/constants.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 7b3512190b..42107b870c 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_call_switchgear.rs b/runtime/bifrost-kusama/src/weights/bifrost_call_switchgear.rs index 5e7ae2f84e..d0e6b57112 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_call_switchgear.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_call_switchgear.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_flexible_fee.rs b/runtime/bifrost-kusama/src/weights/bifrost_flexible_fee.rs index 2533124134..098483b4c6 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_flexible_fee.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_flexible_fee.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_lightening_redeem.rs b/runtime/bifrost-kusama/src/weights/bifrost_lightening_redeem.rs index 4f6da45348..0a66650e7f 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_lightening_redeem.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_lightening_redeem.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_liquidity_mining.rs b/runtime/bifrost-kusama/src/weights/bifrost_liquidity_mining.rs index bd76cd72d5..56f1c8b54b 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_liquidity_mining.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_liquidity_mining.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_salp.rs b/runtime/bifrost-kusama/src/weights/bifrost_salp.rs index 8079937b61..bca0f282ae 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_salp.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_salp.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_salp_lite.rs b/runtime/bifrost-kusama/src/weights/bifrost_salp_lite.rs index 31de70c5d9..1ebf8a96b6 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_salp_lite.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_salp_lite.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_token_issuer.rs b/runtime/bifrost-kusama/src/weights/bifrost_token_issuer.rs index 0f104ee62a..8e446b3044 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_token_issuer.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_token_issuer.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/bifrost_vsbond_auction.rs b/runtime/bifrost-kusama/src/weights/bifrost_vsbond_auction.rs index a45a120135..14c901e733 100644 --- a/runtime/bifrost-kusama/src/weights/bifrost_vsbond_auction.rs +++ b/runtime/bifrost-kusama/src/weights/bifrost_vsbond_auction.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/frame_system.rs b/runtime/bifrost-kusama/src/weights/frame_system.rs index 9a34bf0220..7094635c3f 100644 --- a/runtime/bifrost-kusama/src/weights/frame_system.rs +++ b/runtime/bifrost-kusama/src/weights/frame_system.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/mod.rs b/runtime/bifrost-kusama/src/weights/mod.rs index d0f8239c59..6b8f262855 100644 --- a/runtime/bifrost-kusama/src/weights/mod.rs +++ b/runtime/bifrost-kusama/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/orml_currencies.rs b/runtime/bifrost-kusama/src/weights/orml_currencies.rs index 8824e64801..a84b32909a 100644 --- a/runtime/bifrost-kusama/src/weights/orml_currencies.rs +++ b/runtime/bifrost-kusama/src/weights/orml_currencies.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/orml_tokens.rs b/runtime/bifrost-kusama/src/weights/orml_tokens.rs index 95d189bae9..02e261c574 100644 --- a/runtime/bifrost-kusama/src/weights/orml_tokens.rs +++ b/runtime/bifrost-kusama/src/weights/orml_tokens.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_balances.rs b/runtime/bifrost-kusama/src/weights/pallet_balances.rs index 1df173a892..451734cb35 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_balances.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_balances.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_bounties.rs b/runtime/bifrost-kusama/src/weights/pallet_bounties.rs index 1ce6d2f33d..a8a4484cef 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_bounties.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_bounties.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_indices.rs b/runtime/bifrost-kusama/src/weights/pallet_indices.rs index 219fc805df..087481eecb 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_indices.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_indices.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_scheduler.rs b/runtime/bifrost-kusama/src/weights/pallet_scheduler.rs index 136c0042f1..fdec4aade7 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_scheduler.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_scheduler.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_timestamp.rs b/runtime/bifrost-kusama/src/weights/pallet_timestamp.rs index 300a57b234..98a8168654 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_timestamp.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_treasury.rs b/runtime/bifrost-kusama/src/weights/pallet_treasury.rs index 99fe095343..65560d022d 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_treasury.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_treasury.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_utility.rs b/runtime/bifrost-kusama/src/weights/pallet_utility.rs index 60bfea216c..abfdefacee 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_utility.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_utility.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-kusama/src/weights/pallet_vesting.rs b/runtime/bifrost-kusama/src/weights/pallet_vesting.rs index 89c3da1b32..2eaaaa4321 100644 --- a/runtime/bifrost-kusama/src/weights/pallet_vesting.rs +++ b/runtime/bifrost-kusama/src/weights/pallet_vesting.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/build.rs b/runtime/bifrost-polkadot/build.rs index 26e0497ca6..fde521d7e1 100644 --- a/runtime/bifrost-polkadot/build.rs +++ b/runtime/bifrost-polkadot/build.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/constants.rs b/runtime/bifrost-polkadot/src/constants.rs index 0885f32e62..a834904a03 100644 --- a/runtime/bifrost-polkadot/src/constants.rs +++ b/runtime/bifrost-polkadot/src/constants.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 32f7196dc5..8a18954bee 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/frame_system.rs b/runtime/bifrost-polkadot/src/weights/frame_system.rs index 9a34bf0220..7094635c3f 100644 --- a/runtime/bifrost-polkadot/src/weights/frame_system.rs +++ b/runtime/bifrost-polkadot/src/weights/frame_system.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/mod.rs b/runtime/bifrost-polkadot/src/weights/mod.rs index a4f290fc44..11801a2f2c 100644 --- a/runtime/bifrost-polkadot/src/weights/mod.rs +++ b/runtime/bifrost-polkadot/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_balances.rs b/runtime/bifrost-polkadot/src/weights/pallet_balances.rs index 1df173a892..451734cb35 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_balances.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_balances.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_bounties.rs b/runtime/bifrost-polkadot/src/weights/pallet_bounties.rs index 1ce6d2f33d..a8a4484cef 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_bounties.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_bounties.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_indices.rs b/runtime/bifrost-polkadot/src/weights/pallet_indices.rs index 219fc805df..087481eecb 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_indices.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_indices.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_scheduler.rs b/runtime/bifrost-polkadot/src/weights/pallet_scheduler.rs index 136c0042f1..fdec4aade7 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_scheduler.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_scheduler.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_timestamp.rs b/runtime/bifrost-polkadot/src/weights/pallet_timestamp.rs index 300a57b234..98a8168654 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_timestamp.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_treasury.rs b/runtime/bifrost-polkadot/src/weights/pallet_treasury.rs index 99fe095343..65560d022d 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_treasury.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_treasury.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_utility.rs b/runtime/bifrost-polkadot/src/weights/pallet_utility.rs index 60bfea216c..abfdefacee 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_utility.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_utility.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/bifrost-polkadot/src/weights/pallet_vesting.rs b/runtime/bifrost-polkadot/src/weights/pallet_vesting.rs index 89c3da1b32..2eaaaa4321 100644 --- a/runtime/bifrost-polkadot/src/weights/pallet_vesting.rs +++ b/runtime/bifrost-polkadot/src/weights/pallet_vesting.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/constants.rs b/runtime/common/src/constants.rs index fc3c4accc9..4fa3339b1a 100644 --- a/runtime/common/src/constants.rs +++ b/runtime/common/src/constants.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/impl.rs b/runtime/common/src/impl.rs index 1f7bf52584..853661d558 100644 --- a/runtime/common/src/impl.rs +++ b/runtime/common/src/impl.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index e6985c3131..66387c5883 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/tests.rs b/runtime/common/src/tests.rs index 4f7cc1cbb0..a5701a456d 100644 --- a/runtime/common/src/tests.rs +++ b/runtime/common/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/xcm-support/src/calls.rs b/xcm-support/src/calls.rs index 1eea7be969..9f3fb07d29 100644 --- a/xcm-support/src/calls.rs +++ b/xcm-support/src/calls.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/xcm-support/src/lib.rs b/xcm-support/src/lib.rs index b7802c4cbf..30f5fa3370 100644 --- a/xcm-support/src/lib.rs +++ b/xcm-support/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/xcm-support/src/traits.rs b/xcm-support/src/traits.rs index a8fc88ebc5..7512c9cc36 100644 --- a/xcm-support/src/traits.rs +++ b/xcm-support/src/traits.rs @@ -1,6 +1,6 @@ // This file is part of Bifrost. -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. +// Copyright (C) 2019-2022 Liebi Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify