From a12874d65d16670776e10bdf0484589530a929a1 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Tue, 11 Oct 2022 09:58:16 +0100 Subject: [PATCH 01/58] Bump all versions to 1.3.4.0 --- src/FederationSetup/FederationSetup.csproj | 2 +- src/FodyNlogAdapter/FodyNlogAdapter.csproj | 2 +- src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj | 2 +- .../Stratis.Bitcoin.Features.Api.csproj | 2 +- .../Stratis.Bitcoin.Features.BlockStore.csproj | 2 +- .../Stratis.Bitcoin.Features.ColdStaking.csproj | 2 +- .../Stratis.Bitcoin.Features.Consensus.csproj | 2 +- .../Stratis.Bitcoin.Features.Dns.csproj | 2 +- .../Stratis.Bitcoin.Features.ExternalApi.csproj | 2 +- .../Stratis.Bitcoin.Features.Interop.csproj | 2 +- .../Stratis.Bitcoin.Features.LightWallet.csproj | 2 +- .../Stratis.Bitcoin.Features.MemoryPool.csproj | 2 +- .../Stratis.Bitcoin.Features.Miner.csproj | 2 +- .../Stratis.Bitcoin.Features.Notifications.csproj | 2 +- ...atis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj | 2 +- .../Stratis.Bitcoin.Features.PoA.csproj | 2 +- .../Stratis.Bitcoin.Features.RPC.csproj | 2 +- .../Stratis.Bitcoin.Features.SignalR.csproj | 2 +- .../Stratis.Bitcoin.Features.SmartContracts.csproj | 2 +- .../Stratis.Bitcoin.Features.Wallet.csproj | 2 +- .../Stratis.Bitcoin.Features.WatchOnlyWallet.csproj | 2 +- .../Stratis.Bitcoin.IntegrationTests.Common.csproj | 2 +- .../Stratis.Bitcoin.Networks.csproj | 6 +++--- .../Stratis.Bitcoin.Tests.Common.csproj | 2 +- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- src/Stratis.CirrusD/Stratis.CirrusD.csproj | 2 +- src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj | 2 +- src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj | 2 +- src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj | 2 +- .../Stratis.Features.Collateral.csproj | 2 +- .../Stratis.Features.Diagnostic.csproj | 2 +- .../Stratis.Features.FederatedPeg.csproj | 2 +- .../Stratis.Features.SQLiteWalletRepository.csproj | 2 +- .../Stratis.Sidechains.Networks.csproj | 2 +- src/Stratis.StraxD/Stratis.StraxD.csproj | 2 +- src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj | 2 +- 37 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/FederationSetup/FederationSetup.csproj b/src/FederationSetup/FederationSetup.csproj index 7e165e2028..f5ad5d0e9c 100644 --- a/src/FederationSetup/FederationSetup.csproj +++ b/src/FederationSetup/FederationSetup.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. diff --git a/src/FodyNlogAdapter/FodyNlogAdapter.csproj b/src/FodyNlogAdapter/FodyNlogAdapter.csproj index bcc45ce027..eb81e7f6cb 100644 --- a/src/FodyNlogAdapter/FodyNlogAdapter.csproj +++ b/src/FodyNlogAdapter/FodyNlogAdapter.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 FodyNlogAdapter - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. Stratis.Utils.FodyNlogAdapter diff --git a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj index 0bed6f7b02..32aa3a3d93 100644 --- a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj +++ b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj index 0d1eab4bf1..45bc1dfaf3 100644 --- a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj +++ b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj @@ -6,7 +6,7 @@ Stratis.Bitcoin.Features.Api Library Stratis.Features.Api - 1.3.3.0 + 1.3.4.0 False library diff --git a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj index 4970e85ec4..d8fb842e6a 100644 --- a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj +++ b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj index 6c0bde2df1..8e7330b5c3 100644 --- a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj +++ b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj @@ -7,7 +7,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj index aa5dc76d43..1d28ad1783 100644 --- a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj +++ b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj index 734f074b7a..6e6baa5381 100644 --- a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj +++ b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj b/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj index a298c1b017..2139b797a5 100644 --- a/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj +++ b/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis.Features.ExternalAPI Stratis.Features.ExternalAPI diff --git a/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj b/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj index a689cfc65f..c37dd5ac69 100644 --- a/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj +++ b/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis.Features.Interop Stratis.Features.Interop diff --git a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj index 9b957a8c05..62f8938e9e 100644 --- a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj +++ b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj @@ -7,7 +7,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj index 19e32fd8af..8923f71b24 100644 --- a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj +++ b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False library Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj index 31d3a529f0..e1050b0d18 100644 --- a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj +++ b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj index 47e4df0b0b..0b01fb20d3 100644 --- a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj +++ b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj index 9ed937dcdb..896f8970dc 100644 --- a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False diff --git a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj index c38ce54553..eefc97b235 100644 --- a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj +++ b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj index b75795c165..d00c53a24c 100644 --- a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj +++ b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj index 906f11ae64..6185317915 100644 --- a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj +++ b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis.Features.SignalR Stratis.Features.SignalR Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj index d3155c14a0..08e56815c2 100644 --- a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj +++ b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis.Features.SmartContracts Stratis.Features.SmartContracts diff --git a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj index 320e419382..6929b75e1f 100644 --- a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj +++ b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj index 0464071850..abde76593d 100644 --- a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj +++ b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj index 8cdb40ceb7..e3f444c264 100644 --- a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False diff --git a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj index e44ca9f567..aaf0f1e8cb 100644 --- a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj +++ b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj @@ -14,9 +14,9 @@ false false false - 1.3.3.0 - 1.3.3.0 - 1.3.3.0 + 1.3.4.0 + 1.3.4.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj index 0183b7ba28..f94a4b27e6 100644 --- a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj +++ b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index 08f952a4dc..a29ae8a586 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.3.0")] -[assembly: AssemblyFileVersion("1.3.3.0")] +[assembly: AssemblyVersion("1.3.4.0")] +[assembly: AssemblyFileVersion("1.3.4.0")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 3f44990175..d053cc4a69 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False ..\Stratis.ruleset Stratis Group Ltd. diff --git a/src/Stratis.CirrusD/Stratis.CirrusD.csproj b/src/Stratis.CirrusD/Stratis.CirrusD.csproj index bc91e1800a..fb8b80c689 100644 --- a/src/Stratis.CirrusD/Stratis.CirrusD.csproj +++ b/src/Stratis.CirrusD/Stratis.CirrusD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj index 7a18cd7572..7c81455b59 100644 --- a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj +++ b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj @@ -17,7 +17,7 @@ latest Stratis Group Ltd. - 1.3.3.0 + 1.3.4.0 diff --git a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj index 5d2f6dc5a8..083f49a1a9 100644 --- a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj +++ b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj index d9e4048156..3fc5ddd9af 100644 --- a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj +++ b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj b/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj index a5b51b2f05..eef54921af 100644 --- a/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj +++ b/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 4.0.10.0 + 4.0.11.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj index aa1c9e2acf..07b7e62d14 100644 --- a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj +++ b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 ..\None.ruleset true - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj index 6843b79ffe..859c07d5ea 100644 --- a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj +++ b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj @@ -12,7 +12,7 @@ Full ..\None.ruleset Stratis Group Ltd. - 4.0.10.0 + 4.0.11.0 diff --git a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj index dd7f939528..747e205155 100644 --- a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj +++ b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj @@ -14,7 +14,7 @@ false false false - 1.3.3.0 + 1.3.4.0 False Stratis Group Ltd. diff --git a/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj b/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj index f021813cd4..11444c2527 100644 --- a/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj +++ b/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj @@ -5,7 +5,7 @@ Full ..\None.ruleset - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. Stratis.Sidechains.Networks diff --git a/src/Stratis.StraxD/Stratis.StraxD.csproj b/src/Stratis.StraxD/Stratis.StraxD.csproj index 03d47768c4..7cb76fb027 100644 --- a/src/Stratis.StraxD/Stratis.StraxD.csproj +++ b/src/Stratis.StraxD/Stratis.StraxD.csproj @@ -16,7 +16,7 @@ latest - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. diff --git a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj index fffa182b16..efb3e12019 100644 --- a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj +++ b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj @@ -16,7 +16,7 @@ latest - 1.3.3.0 + 1.3.4.0 Stratis Group Ltd. From 309391d10b06ce234655af4812f7558a0d3cde6c Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Fri, 21 Oct 2022 14:21:16 +0100 Subject: [PATCH 02/58] Bump all versions to 1.4.0.0 --- src/FederationSetup/FederationSetup.csproj | 2 +- src/FodyNlogAdapter/FodyNlogAdapter.csproj | 2 +- src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj | 2 +- .../Stratis.Bitcoin.Features.Api.csproj | 2 +- .../Stratis.Bitcoin.Features.BlockStore.csproj | 2 +- .../Stratis.Bitcoin.Features.ColdStaking.csproj | 2 +- .../Stratis.Bitcoin.Features.Consensus.csproj | 2 +- .../Stratis.Bitcoin.Features.Dns.csproj | 2 +- .../Stratis.Bitcoin.Features.ExternalApi.csproj | 2 +- .../Stratis.Bitcoin.Features.Interop.csproj | 2 +- .../Stratis.Bitcoin.Features.LightWallet.csproj | 2 +- .../Stratis.Bitcoin.Features.MemoryPool.csproj | 2 +- .../Stratis.Bitcoin.Features.Miner.csproj | 2 +- .../Stratis.Bitcoin.Features.Notifications.csproj | 2 +- ...atis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj | 2 +- .../Stratis.Bitcoin.Features.PoA.csproj | 2 +- .../Stratis.Bitcoin.Features.RPC.csproj | 2 +- .../Stratis.Bitcoin.Features.SignalR.csproj | 2 +- .../Stratis.Bitcoin.Features.SmartContracts.csproj | 2 +- .../Stratis.Bitcoin.Features.Wallet.csproj | 2 +- .../Stratis.Bitcoin.Features.WatchOnlyWallet.csproj | 2 +- .../Stratis.Bitcoin.IntegrationTests.Common.csproj | 2 +- .../Stratis.Bitcoin.Networks.csproj | 6 +++--- .../Stratis.Bitcoin.Tests.Common.csproj | 2 +- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- src/Stratis.CirrusD/Stratis.CirrusD.csproj | 2 +- src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj | 2 +- src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj | 2 +- src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj | 2 +- .../Stratis.Features.Collateral.csproj | 2 +- .../Stratis.Features.Diagnostic.csproj | 2 +- .../Stratis.Features.FederatedPeg.csproj | 2 +- .../Stratis.Features.SQLiteWalletRepository.csproj | 2 +- .../Stratis.Sidechains.Networks.csproj | 2 +- src/Stratis.StraxD/Stratis.StraxD.csproj | 2 +- src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj | 2 +- 37 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/FederationSetup/FederationSetup.csproj b/src/FederationSetup/FederationSetup.csproj index f5ad5d0e9c..8c47423c4d 100644 --- a/src/FederationSetup/FederationSetup.csproj +++ b/src/FederationSetup/FederationSetup.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. diff --git a/src/FodyNlogAdapter/FodyNlogAdapter.csproj b/src/FodyNlogAdapter/FodyNlogAdapter.csproj index eb81e7f6cb..50d5e9547f 100644 --- a/src/FodyNlogAdapter/FodyNlogAdapter.csproj +++ b/src/FodyNlogAdapter/FodyNlogAdapter.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 FodyNlogAdapter - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. Stratis.Utils.FodyNlogAdapter diff --git a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj index 32aa3a3d93..5f6ede6b60 100644 --- a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj +++ b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj index 45bc1dfaf3..18079f88cf 100644 --- a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj +++ b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj @@ -6,7 +6,7 @@ Stratis.Bitcoin.Features.Api Library Stratis.Features.Api - 1.3.4.0 + 1.4.0.0 False library diff --git a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj index d8fb842e6a..0c1e1b698a 100644 --- a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj +++ b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj index 8e7330b5c3..2cd040162f 100644 --- a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj +++ b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj @@ -7,7 +7,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj index 1d28ad1783..dece0cc11d 100644 --- a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj +++ b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj index 6e6baa5381..3f11fed148 100644 --- a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj +++ b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj b/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj index 2139b797a5..f6b43e87fd 100644 --- a/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj +++ b/src/Stratis.Bitcoin.Features.ExternalAPI/Stratis.Bitcoin.Features.ExternalApi.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis.Features.ExternalAPI Stratis.Features.ExternalAPI diff --git a/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj b/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj index c37dd5ac69..f0f7ad0989 100644 --- a/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj +++ b/src/Stratis.Bitcoin.Features.Interop/Stratis.Bitcoin.Features.Interop.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis.Features.Interop Stratis.Features.Interop diff --git a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj index 62f8938e9e..6e6dec8b2e 100644 --- a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj +++ b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj @@ -7,7 +7,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj index 8923f71b24..a6a9dcf687 100644 --- a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj +++ b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False library Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj index e1050b0d18..99577894ce 100644 --- a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj +++ b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj index 0b01fb20d3..bc84829b8d 100644 --- a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj +++ b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj index 896f8970dc..c85f143f64 100644 --- a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False diff --git a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj index eefc97b235..1f4edd086d 100644 --- a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj +++ b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj index d00c53a24c..86e1ad06cb 100644 --- a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj +++ b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj index 6185317915..e8c7ec6fe1 100644 --- a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj +++ b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis.Features.SignalR Stratis.Features.SignalR Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj index 08e56815c2..2b4d728457 100644 --- a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj +++ b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis.Features.SmartContracts Stratis.Features.SmartContracts diff --git a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj index 6929b75e1f..e37d48f48d 100644 --- a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj +++ b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj index abde76593d..14ce85a138 100644 --- a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj +++ b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj index e3f444c264..18abf048d3 100644 --- a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False diff --git a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj index aaf0f1e8cb..fd9cc41ad7 100644 --- a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj +++ b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj @@ -14,9 +14,9 @@ false false false - 1.3.4.0 - 1.3.4.0 - 1.3.4.0 + 1.4.0.0 + 1.4.0.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj index f94a4b27e6..93844de51a 100644 --- a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj +++ b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index a29ae8a586..2fb90c6af2 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.4.0")] -[assembly: AssemblyFileVersion("1.3.4.0")] +[assembly: AssemblyVersion("1.4.0.0")] +[assembly: AssemblyFileVersion("1.4.0.0")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index d053cc4a69..a3cf12b7b7 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False ..\Stratis.ruleset Stratis Group Ltd. diff --git a/src/Stratis.CirrusD/Stratis.CirrusD.csproj b/src/Stratis.CirrusD/Stratis.CirrusD.csproj index fb8b80c689..de509c79cf 100644 --- a/src/Stratis.CirrusD/Stratis.CirrusD.csproj +++ b/src/Stratis.CirrusD/Stratis.CirrusD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj index 7c81455b59..7c93fdb055 100644 --- a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj +++ b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj @@ -17,7 +17,7 @@ latest Stratis Group Ltd. - 1.3.4.0 + 1.4.0.0 diff --git a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj index 083f49a1a9..d00ed5faf3 100644 --- a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj +++ b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis Group Ltd. diff --git a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj index 3fc5ddd9af..1356221d4a 100644 --- a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj +++ b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj b/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj index eef54921af..a5b51b2f05 100644 --- a/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj +++ b/src/Stratis.Features.Collateral/Stratis.Features.Collateral.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 4.0.11.0 + 4.0.10.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj index 07b7e62d14..72a7898d76 100644 --- a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj +++ b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 ..\None.ruleset true - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. diff --git a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj index 859c07d5ea..6843b79ffe 100644 --- a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj +++ b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj @@ -12,7 +12,7 @@ Full ..\None.ruleset Stratis Group Ltd. - 4.0.11.0 + 4.0.10.0 diff --git a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj index 747e205155..aa35dd0f2d 100644 --- a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj +++ b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj @@ -14,7 +14,7 @@ false false false - 1.3.4.0 + 1.4.0.0 False Stratis Group Ltd. diff --git a/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj b/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj index 11444c2527..feecd38272 100644 --- a/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj +++ b/src/Stratis.Sidechains.Networks/Stratis.Sidechains.Networks.csproj @@ -5,7 +5,7 @@ Full ..\None.ruleset - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. Stratis.Sidechains.Networks diff --git a/src/Stratis.StraxD/Stratis.StraxD.csproj b/src/Stratis.StraxD/Stratis.StraxD.csproj index 7cb76fb027..6b03eed33a 100644 --- a/src/Stratis.StraxD/Stratis.StraxD.csproj +++ b/src/Stratis.StraxD/Stratis.StraxD.csproj @@ -16,7 +16,7 @@ latest - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. diff --git a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj index efb3e12019..7655c03dbe 100644 --- a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj +++ b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj @@ -16,7 +16,7 @@ latest - 1.3.4.0 + 1.4.0.0 Stratis Group Ltd. From be5ccd641074cc930120c59f89368e9b48073774 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Wed, 9 Nov 2022 13:22:20 +0000 Subject: [PATCH 03/58] Set version to RC --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index bb3b89b91b..2fb90c6af2 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.7")] -[assembly: AssemblyFileVersion("1.4.0.7")] +[assembly: AssemblyVersion("1.4.0.0")] +[assembly: AssemblyFileVersion("1.4.0.0")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 4488a76c77..eb11ed8f38 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.7 + 1.4.0.0-rc False ..\Stratis.ruleset Stratis Group Ltd. From 8fcacb63c532dd286dc28560551942b577d3bbbc Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Thu, 10 Nov 2022 07:02:54 +0000 Subject: [PATCH 04/58] Always publish mining statistics --- .../Events/MiningStatisticsEvent.cs | 5 +---- src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs | 15 ++++++++------- .../Events/MiningStatisticsClientEvent.cs | 4 +--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.PoA/Events/MiningStatisticsEvent.cs b/src/Stratis.Bitcoin.Features.PoA/Events/MiningStatisticsEvent.cs index feb4ebb096..e6bb8a15f7 100644 --- a/src/Stratis.Bitcoin.Features.PoA/Events/MiningStatisticsEvent.cs +++ b/src/Stratis.Bitcoin.Features.PoA/Events/MiningStatisticsEvent.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Stratis.Bitcoin.EventBus; +using Stratis.Bitcoin.EventBus; namespace Stratis.Bitcoin.Features.PoA.Events { diff --git a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs index 29ff8ee9cf..0ddc4fd537 100644 --- a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs +++ b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs @@ -222,6 +222,8 @@ private void GatherMiningStatistics() this.miningStatisticsLog = log.ToString(); + this.signals?.Publish(new MiningStatisticsEvent(this.miningStatistics, 0)); + return; } @@ -233,6 +235,8 @@ private void GatherMiningStatistics() this.miningStatisticsLog = log.ToString(); + this.signals?.Publish(new MiningStatisticsEvent(this.miningStatistics, 0)); + return; } @@ -249,7 +253,7 @@ private void GatherMiningStatistics() // TODO: Make this a command line option. bool includeHeight = false; - log.AppendLine($"Mining information for the last { maxDepth } blocks."); + log.AppendLine($"Mining information for the last {maxDepth} blocks."); if (includeHeight) log.AppendLine("Note 'MISS' indicates a slot where a miner didn't produce a block."); else @@ -288,7 +292,7 @@ private void GatherMiningStatistics() if (includeHeight) { string strHeight = minedInThisSlot ? currentHeader.Height.ToString().PadLeft(7) : "---MISS"; - log.Append($"{strHeight}:{ pubKeyRepresentation } "); + log.Append($"{strHeight}:{pubKeyRepresentation} "); } else { @@ -304,15 +308,12 @@ private void GatherMiningStatistics() this.miningStatistics.MinerHits = hitCount; - if (this.signals != null) - { - this.signals.Publish(new MiningStatisticsEvent(this.miningStatistics, maxDepth)); - } + this.signals?.Publish(new MiningStatisticsEvent(this.miningStatistics, maxDepth)); log.Append("..."); log.AppendLine(); log.AppendLine($"Miner hits".PadRight(LoggingConfiguration.ColumnLength) + $": {hitCount} of {maxDepth}({(((float)hitCount / (float)maxDepth)).ToString("P2")})"); - log.AppendLine($"Miner idle time".PadRight(LoggingConfiguration.ColumnLength) + $": { TimeSpan.FromSeconds(this.network.ConsensusOptions.TargetSpacingSeconds * (maxDepth - hitCount)).ToString(@"hh\:mm\:ss")}"); + log.AppendLine($"Miner idle time".PadRight(LoggingConfiguration.ColumnLength) + $": {TimeSpan.FromSeconds(this.network.ConsensusOptions.TargetSpacingSeconds * (maxDepth - hitCount)).ToString(@"hh\:mm\:ss")}"); log.AppendLine(); this.miningStatisticsLog = log.ToString(); diff --git a/src/Stratis.Bitcoin.Features.SignalR/Events/MiningStatisticsClientEvent.cs b/src/Stratis.Bitcoin.Features.SignalR/Events/MiningStatisticsClientEvent.cs index 4ff77b1e5d..53889ef330 100644 --- a/src/Stratis.Bitcoin.Features.SignalR/Events/MiningStatisticsClientEvent.cs +++ b/src/Stratis.Bitcoin.Features.SignalR/Events/MiningStatisticsClientEvent.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Stratis.Bitcoin.EventBus; using Stratis.Bitcoin.Features.PoA.Events; @@ -16,7 +14,7 @@ public class MiningStatisticsClientEvent : IClientEvent public void BuildFrom(EventBase @event) { if (@event is MiningStatisticsEvent miningStatisticsEvent) - { + { this.IsMining = miningStatisticsEvent.MiningStatistics.ProducedBlockInLastRound; this.BlockProducerHit = miningStatisticsEvent.MiningStatistics.MinerHits; this.FederationMemberSize = miningStatisticsEvent.FederationMemberSize; From c14acd9f68ea7e386949b2fe7284269dbe6ce677 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Thu, 10 Nov 2022 15:22:47 +0000 Subject: [PATCH 05/58] Add activation height for multisig fee sorting --- src/Stratis.Bitcoin.Features.PoA/PoAConsensusOptions.cs | 8 ++++++++ .../Distribution/RewardDistributionManager.cs | 4 +++- src/Stratis.Sidechains.Networks/CirrusMain.cs | 3 ++- src/Stratis.Sidechains.Networks/CirrusTest.cs | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.PoA/PoAConsensusOptions.cs b/src/Stratis.Bitcoin.Features.PoA/PoAConsensusOptions.cs index 5c26d099fd..2d93d0d1d6 100644 --- a/src/Stratis.Bitcoin.Features.PoA/PoAConsensusOptions.cs +++ b/src/Stratis.Bitcoin.Features.PoA/PoAConsensusOptions.cs @@ -58,6 +58,14 @@ public class PoAConsensusOptions : ConsensusOptions /// public int Release1300ActivationHeight { get; set; } + /// + /// The height at which Release 1.4.0.0 became active. + /// + /// This was primarily used for activating ScriptPubkey sorting for paying multisig recipients. + /// + /// + public int Release1400ActivationHeight { get; set; } + /// /// The height at which inituitive mining slots become active. /// Legacy mining slots are determined by mining_slot = block_height % number_of_federation_members. diff --git a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs index 599360a789..c71cfb23c4 100644 --- a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs +++ b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs @@ -142,9 +142,11 @@ public List DistributeToMultisigNodes(uint256 depositId, Money fee) multiSigRecipients.Add(new Recipient() { Amount = feeReward, ScriptPubKey = multiSigMinerScript }); this.logger.LogDebug($"Paying multisig member '{multiSigMinerScript.ToHex()}' (hex) {feeReward} STRAX."); } - } + if (this.chainIndexer.Tip.Height >= (this.network.Consensus.Options as PoAConsensusOptions).Release1400ActivationHeight) + return multiSigRecipients.OrderBy(m => m.ScriptPubKey).ToList(); + return multiSigRecipients; } diff --git a/src/Stratis.Sidechains.Networks/CirrusMain.cs b/src/Stratis.Sidechains.Networks/CirrusMain.cs index 3743e452a5..cfd776e195 100644 --- a/src/Stratis.Sidechains.Networks/CirrusMain.cs +++ b/src/Stratis.Sidechains.Networks/CirrusMain.cs @@ -185,7 +185,8 @@ public CirrusMain() GetMiningTimestampV2ActivationHeight = 3_709_000, // Monday 14 February 00:00:00 (Estimated) GetMiningTimestampV2ActivationStrictHeight = 3_783_000, // Monday 28 February 07:00:00 (London Time) (Estimated) ContractSerializerV2ActivationHeight = 3_386_335, // Monday 13 December 16:00:00 (Estimated) - Release1300ActivationHeight = 4_334_400 + Release1300ActivationHeight = 4_334_400, + Release1400ActivationHeight = 0, }; var buriedDeployments = new BuriedDeploymentsArray diff --git a/src/Stratis.Sidechains.Networks/CirrusTest.cs b/src/Stratis.Sidechains.Networks/CirrusTest.cs index 1289f99293..a9a8c1de8e 100644 --- a/src/Stratis.Sidechains.Networks/CirrusTest.cs +++ b/src/Stratis.Sidechains.Networks/CirrusTest.cs @@ -136,7 +136,8 @@ public CirrusTest() GetMiningTimestampV2ActivationHeight = 3_000_000, // 15 January 2022 GetMiningTimestampV2ActivationStrictHeight = 3_121_500, // 17 January 2022 ContractSerializerV2ActivationHeight = 2_842_681, - Release1300ActivationHeight = 3_280_032 + Release1300ActivationHeight = 3_280_032, + Release1400ActivationHeight = 0, }; var buriedDeployments = new BuriedDeploymentsArray From 24ab5425f9cae476dffafa6ce745195eb479943e Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Fri, 11 Nov 2022 09:22:35 +0000 Subject: [PATCH 06/58] Fix GateWayPairStarts pair --- .../NodeInitialisationTests.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Stratis.Features.FederatedPeg.IntegrationTests/NodeInitialisationTests.cs b/src/Stratis.Features.FederatedPeg.IntegrationTests/NodeInitialisationTests.cs index 4dcd5d8af1..9354f5a475 100644 --- a/src/Stratis.Features.FederatedPeg.IntegrationTests/NodeInitialisationTests.cs +++ b/src/Stratis.Features.FederatedPeg.IntegrationTests/NodeInitialisationTests.cs @@ -167,17 +167,20 @@ public void GatewayPairStarts() { using (var nodeBuilder = SidechainNodeBuilder.CreateSidechainNodeBuilder(this)) { - CoreNode side = nodeBuilder.CreateSidechainFederationNode(this.sidechainNetwork, this.mainNetwork, this.sidechainNetwork.FederationKeys[0]); + CirrusRegTest collateralSidechainNetwork = new CirrusSingleCollateralRegTest(); + + CoreNode side = nodeBuilder.CreateSidechainFederationNode(collateralSidechainNetwork, this.mainNetwork, collateralSidechainNetwork.FederationKeys[0]); side.AppendToConfig("sidechain=1"); side.AppendToConfig($"redeemscript={this.scriptAndAddresses.payToMultiSig}"); - side.AppendToConfig($"publickey={this.sidechainNetwork.FederationMnemonics[0].DeriveExtKey().PrivateKey.PubKey}"); + side.AppendToConfig($"publickey={collateralSidechainNetwork.FederationMnemonics[0].DeriveExtKey().PrivateKey.PubKey}"); side.AppendToConfig("federationips=0.0.0.0,0.0.0.1"); // Placeholders side.AppendToConfig($"mindepositconfirmations={DepositConfirmations}"); - CoreNode main = nodeBuilder.CreateMainChainFederationNode(this.mainNetwork, this.sidechainNetwork).WithWallet(); + CoreNode main = nodeBuilder.CreateMainChainFederationNode(this.mainNetwork, collateralSidechainNetwork).WithWallet(); + main.AppendToConfig("addressindex=1"); main.AppendToConfig("mainchain=1"); main.AppendToConfig($"redeemscript={this.scriptAndAddresses.payToMultiSig}"); - main.AppendToConfig($"publickey={this.sidechainNetwork.FederationMnemonics[0].DeriveExtKey().PrivateKey.PubKey}"); + main.AppendToConfig($"publickey={collateralSidechainNetwork.FederationMnemonics[0].DeriveExtKey().PrivateKey.PubKey}"); main.AppendToConfig("federationips=0.0.0.0,0.0.0.1"); // Placeholders main.AppendToConfig($"mindepositconfirmations={DepositConfirmations}"); From 341746c62e460ea14d109faa5d668155a894f6da Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 13:57:38 +0000 Subject: [PATCH 07/58] Update release 1.4 activation height --- src/Stratis.Sidechains.Networks/CirrusTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Sidechains.Networks/CirrusTest.cs b/src/Stratis.Sidechains.Networks/CirrusTest.cs index a9a8c1de8e..52eedcb109 100644 --- a/src/Stratis.Sidechains.Networks/CirrusTest.cs +++ b/src/Stratis.Sidechains.Networks/CirrusTest.cs @@ -137,7 +137,7 @@ public CirrusTest() GetMiningTimestampV2ActivationStrictHeight = 3_121_500, // 17 January 2022 ContractSerializerV2ActivationHeight = 2_842_681, Release1300ActivationHeight = 3_280_032, - Release1400ActivationHeight = 0, + Release1400ActivationHeight = 4_074_250, }; var buriedDeployments = new BuriedDeploymentsArray From 06062872d8766b14e66b7fda316d2f196b272a79 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 13:58:14 +0000 Subject: [PATCH 08/58] Bump build version to 1.4.0.1 --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index 2fb90c6af2..c7d8db21fb 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.4.0.1")] +[assembly: AssemblyFileVersion("1.4.0.1")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index eb11ed8f38..5512b8ed54 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.0-rc + 1.4.0.1-rc False ..\Stratis.ruleset Stratis Group Ltd. From 2958d64a73033a250b7f5a09a339ddd965d3bbcb Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 15:05:43 +0000 Subject: [PATCH 09/58] Fix multisig fee sort --- .../Distribution/RewardDistributionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs index c71cfb23c4..0758c37040 100644 --- a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs +++ b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs @@ -145,7 +145,7 @@ public List DistributeToMultisigNodes(uint256 depositId, Money fee) } if (this.chainIndexer.Tip.Height >= (this.network.Consensus.Options as PoAConsensusOptions).Release1400ActivationHeight) - return multiSigRecipients.OrderBy(m => m.ScriptPubKey).ToList(); + return multiSigRecipients.OrderBy(m => m.ScriptPubKey.ToHex()).ToList(); return multiSigRecipients; } From d62930c9f903e79d40a829a79fbdcf8e317c88b3 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 15:06:33 +0000 Subject: [PATCH 10/58] Bump build revision to 1.4.0.2 --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index c7d8db21fb..40e160b72e 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.1")] -[assembly: AssemblyFileVersion("1.4.0.1")] +[assembly: AssemblyVersion("1.4.0.2")] +[assembly: AssemblyFileVersion("1.4.0.2")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 5512b8ed54..253a695684 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.1-rc + 1.4.0.2-rc False ..\Stratis.ruleset Stratis Group Ltd. From fa722c2abf169fb84b5749fcf108cffa3c60b874 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Wed, 16 Nov 2022 06:23:18 +0000 Subject: [PATCH 11/58] Set release 1.4 activation height --- src/Stratis.Sidechains.Networks/CirrusMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Sidechains.Networks/CirrusMain.cs b/src/Stratis.Sidechains.Networks/CirrusMain.cs index cfd776e195..e57ea5ac92 100644 --- a/src/Stratis.Sidechains.Networks/CirrusMain.cs +++ b/src/Stratis.Sidechains.Networks/CirrusMain.cs @@ -186,7 +186,7 @@ public CirrusMain() GetMiningTimestampV2ActivationStrictHeight = 3_783_000, // Monday 28 February 07:00:00 (London Time) (Estimated) ContractSerializerV2ActivationHeight = 3_386_335, // Monday 13 December 16:00:00 (Estimated) Release1300ActivationHeight = 4_334_400, - Release1400ActivationHeight = 0, + Release1400ActivationHeight = 5_345_325, // 7 December 2022 (Estimated) }; var buriedDeployments = new BuriedDeploymentsArray From 1b6c10a2487bc053f88cc5d03695e8b5fa4ead66 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 17 Nov 2022 18:35:23 +1100 Subject: [PATCH 12/58] Add WrappedToken.sol --- .../ETHClient/ContractSource/WrappedToken.sol | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol new file mode 100644 index 0000000000..711deee871 --- /dev/null +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -0,0 +1,60 @@ +// contracts/WrappedToken.sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.0; + +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; + +contract WrappedToken is ERC20, Ownable { + mapping (address => string) public withdrawalAddresses; + + constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { + _mint(msg.sender, initialSupply); + } + + /** + * @dev Creates `amount` new tokens and assigns them to `account`. + * + * See {ERC20-_mint}. + */ + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount, string memory address) public { + _burn(_msgSender(), amount); + + // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. + // Currently it is only possible to assign a single address here, so if multiple recipients are required + // the burner will have to wait until each burn is processed before proceeding with the next. + withdrawalAddresses[msg.sender] = address; + } + + /** + * @dev Destroys `amount` tokens from `account`, deducting from the caller's + * allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `amount`. + */ + function burnFrom(address account, uint256 amount, string memory address) public { + uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); + + _approve(account, _msgSender(), decreasedAllowance); + _burn(account, amount); + + // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. + // Currently it is only possible to assign a single address here, so if multiple recipients are required + // the burner will have to wait until each burn is processed before proceeding with the next. + withdrawalAddresses[msg.sender] = address; + } +} From d4a265ea17b7f7b173fc7f9bdf11ba1bf36adcca Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 17 Nov 2022 20:04:55 +1100 Subject: [PATCH 13/58] Add WrappedToken.cs --- .../ETHClient/WrappedToken.cs | 656 ++++++++++++++++++ 1 file changed, 656 insertions(+) create mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs new file mode 100644 index 0000000000..9438dc6ade --- /dev/null +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -0,0 +1,656 @@ +using System.Numerics; +using System.Threading.Tasks; +using Nethereum.ABI.FunctionEncoding.Attributes; +using Nethereum.Contracts; +using Nethereum.Contracts.ContractHandlers; +using Nethereum.Contracts.CQS; +using Nethereum.Hex.HexTypes; +using Nethereum.RPC.Eth.DTOs; +using Nethereum.Util; +using Nethereum.Web3; + +namespace Stratis.Bitcoin.Features.Interop.ETHClient2 +{ + public class WrappedTokenDeployment : ContractDeploymentMessage + { + public static string BYTECODE = // TODO + "0x60806040523480156200001157600080fd5b50604051620016ba380380620016ba833981810160405260208110156200003757600080fd5b5051604080518082018252600c81526b0aee4c2e0e0cac8a6e8e4c2f60a31b6020828101918252835180850190945260068452650aea6a8a482b60d31b9084015281519192916200008b91600391620002a0565b508051620000a1906004906020840190620002a0565b50506005805460ff19166012179055506000620000bd62000126565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506200011f33826200012a565b506200033c565b3390565b6001600160a01b03821662000186576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620001946000838362000239565b620001b0816002546200023e60201b62000ba61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001e391839062000ba66200023e821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000299576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002e357805160ff191683800117855562000313565b8280016001018555821562000313579182015b8281111562000313578251825591602001919060010190620002f6565b506200032192915062000325565b5090565b5b8082111562000321576000815560010162000326565b61136e806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637641e6f3116100a2578063979430d211610071578063979430d2146103cd578063a457c2d714610488578063a9059cbb146104b4578063dd62ed3e146104e0578063f2fde38b1461050e57610116565b80637641e6f3146102ce5780637e0518671461037b5780638da5cb5b146103a157806395d89b41146103c557610116565b8063313ce567116100e9578063313ce56714610228578063395093511461024657806340c10f191461027257806370a08231146102a0578063715018a6146102c657610116565b806306fdde031461011b578063095ea7b31461019857806318160ddd146101d857806323b872dd146101f2575b600080fd5b610123610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356105ca565b604080519115158252519081900360200190f35b6101e06105e7565b60408051918252519081900360200190f35b6101c46004803603606081101561020857600080fd5b506001600160a01b038135811691602081013590911690604001356105ed565b610230610674565b6040805160ff9092168252519081900360200190f35b6101c46004803603604081101561025c57600080fd5b506001600160a01b03813516906020013561067d565b61029e6004803603604081101561028857600080fd5b506001600160a01b0381351690602001356106cb565b005b6101e0600480360360208110156102b657600080fd5b50356001600160a01b0316610748565b61029e610763565b61029e600480360360408110156102e457600080fd5b8135919081019060408101602082013564010000000081111561030657600080fd5b82018360208201111561031857600080fd5b8035906020019184600183028401116401000000008311171561033a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610822945050505050565b6101236004803603602081101561039157600080fd5b50356001600160a01b0316610858565b6103a96108f3565b604080516001600160a01b039092168252519081900360200190f35b610123610907565b61029e600480360360608110156103e357600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561041357600080fd5b82018360208201111561042557600080fd5b8035906020019184600183028401116401000000008311171561044757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610968945050505050565b6101c46004803603604081101561049e57600080fd5b506001600160a01b0381351690602001356109e4565b6101c4600480360360408110156104ca57600080fd5b506001600160a01b038135169060200135610a4c565b6101e0600480360360408110156104f657600080fd5b506001600160a01b0381358116916020013516610a60565b61029e6004803603602081101561052457600080fd5b50356001600160a01b0316610a8b565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b820191906000526020600020905b8154815290600101906020018083116105a357829003601f168201915b5050505050905090565b60006105de6105d7610c07565b8484610c0b565b50600192915050565b60025490565b60006105fa848484610cf7565b61066a84610606610c07565b6106658560405180606001604052806028815260200161125e602891396001600160a01b038a16600090815260016020526040812090610644610c07565b6001600160a01b031681526020810191909152604001600020549190610e52565b610c0b565b5060019392505050565b60055460ff1690565b60006105de61068a610c07565b84610665856001600061069b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610ba6565b6106d3610c07565b60055461010090046001600160a01b0390811691161461073a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107448282610ee9565b5050565b6001600160a01b031660009081526020819052604090205490565b61076b610c07565b60055461010090046001600160a01b039081169116146107d2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b61083361082d610c07565b83610fd9565b336000908152600660209081526040909120825161085392840190611117565b505050565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156108eb5780601f106108c0576101008083540402835291602001916108eb565b820191906000526020600020905b8154815290600101906020018083116108ce57829003601f168201915b505050505081565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b600061099f836040518060600160405280602481526020016112866024913961099887610993610c07565b610a60565b9190610e52565b90506109b3846109ad610c07565b83610c0b565b6109bd8484610fd9565b33600090815260066020908152604090912083516109dd92850190611117565b5050505050565b60006105de6109f1610c07565b84610665856040518060600160405280602581526020016113146025913960016000610a1b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610e52565b60006105de610a59610c07565b8484610cf7565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a93610c07565b60055461010090046001600160a01b03908116911614610afa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610b3f5760405162461bcd60e51b81526004018080602001828103825260268152602001806111f06026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015610c00576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610c505760405162461bcd60e51b81526004018080602001828103825260248152602001806112f06024913960400191505060405180910390fd5b6001600160a01b038216610c955760405162461bcd60e51b81526004018080602001828103825260228152602001806112166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610d3c5760405162461bcd60e51b81526004018080602001828103825260258152602001806112cb6025913960400191505060405180910390fd5b6001600160a01b038216610d815760405162461bcd60e51b81526004018080602001828103825260238152602001806111ab6023913960400191505060405180910390fd5b610d8c838383610853565b610dc981604051806060016040528060268152602001611238602691396001600160a01b0386166000908152602081905260409020549190610e52565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610df89082610ba6565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610ee15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ea6578181015183820152602001610e8e565b50505050905090810190601f168015610ed35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610f44576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610f5060008383610853565b600254610f5d9082610ba6565b6002556001600160a01b038216600090815260208190526040902054610f839082610ba6565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661101e5760405162461bcd60e51b81526004018080602001828103825260218152602001806112aa6021913960400191505060405180910390fd5b61102a82600083610853565b611067816040518060600160405280602281526020016111ce602291396001600160a01b0385166000908152602081905260409020549190610e52565b6001600160a01b03831660009081526020819052604090205560025461108d90826110d5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610c0083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e52565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061115857805160ff1916838001178555611185565b82800160010185558215611185579182015b8281111561118557825182559160200191906001019061116a565b50611191929150611195565b5090565b5b80821115611191576000815560010161119656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cad3aac9a515bf8c31e395c1cb60e9ec8ba2edb3e0e92408c5f7db093befc84664736f6c634300060c0033"; + + public WrappedTokenDeployment() : base(BYTECODE) + { + } + + [Parameter("uint256", "totalSupply")] + public BigInteger TotalSupply { get; set; } + } + + [Function("balanceOf", "uint256")] + public class BalanceOfFunction : FunctionMessage + { + [Parameter("address", "_owner", 1)] + public string Owner { get; set; } + } + + [FunctionOutput] + public class BalanceOfOutputDTO : IFunctionOutputDTO + { + [Parameter("uint256", "balance", 1)] + public BigInteger Balance { get; set; } + } + + [Function("transfer", "bool")] + public class TransferFunction : FunctionMessage + { + [Parameter("address", "_to", 1)] + public string To { get; set; } + + [Parameter("uint256", "_value", 2)] + public BigInteger TokenAmount { get; set; } + } + + [Event("Transfer")] + public class TransferEventDTO : IEventDTO + { + [Parameter("address", "_from", 1, true)] + public string From { get; set; } + + [Parameter("address", "_to", 2, true)] + public string To { get; set; } + + [Parameter("uint256", "_value", 3, false)] + public BigInteger Value { get; set; } + } + + [Function("owner", "address")] + public class OwnerFunction : FunctionMessage + { + } + + [Function("transferOwnership")] + public class TransferOwnershipFunction : FunctionMessage + { + [Parameter("address", "newOwner", 1)] + public string NewOwner { get; set; } + } + + [Function("withdrawalAddresses", "string")] + public class WithdrawalAddressesFunction : FunctionMessage + { + [Parameter("address", "", 1)] + public string Address { get; set; } + } + + [Function("mint")] + public class MintFunction : FunctionMessage + { + [Parameter("address", "account", 1)] + public string Account { get; set; } + + [Parameter("uint256", "amount", 2)] + public BigInteger Amount { get; set; } + } + + [Function("burn")] + public class BurnFunction : FunctionMessage + { + [Parameter("uint256", "amount", 1)] + public BigInteger Amount { get; set; } + + [Parameter("string", "tokenAddress", 2)] + public string TokenAddress { get; set; } + } + + public class WrappedToken + { + public static async Task DeployContractAsync(Web3 web3, BigInteger totalSupply) + { + var deploymentMessage = new WrappedTokenDeployment() + { + TotalSupply = totalSupply + }; + + IContractDeploymentTransactionHandler deploymentHandler = web3.Eth.GetContractDeploymentHandler(); + TransactionReceipt transactionReceiptDeployment = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage).ConfigureAwait(false); + string contractAddress = transactionReceiptDeployment.ContractAddress; + + return contractAddress; + } + + public static async Task GetErc20BalanceAsync(Web3 web3, string contractAddress, string addressToQuery) + { + var balanceOfFunctionMessage = new BalanceOfFunction() + { + Owner = addressToQuery + }; + + IContractQueryHandler balanceHandler = web3.Eth.GetContractQueryHandler(); + BigInteger balance = await balanceHandler.QueryAsync(contractAddress, balanceOfFunctionMessage).ConfigureAwait(false); + + return balance; + } + + public static async Task TransferAsync(Web3 web3, string contractAddress, string recipient, BigInteger amount, BigInteger gas, BigInteger gasPrice) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferFunction() + { + To = recipient, + TokenAmount = amount, + Gas = gas, + GasPrice = Web3.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Gwei) + }; + + TransactionReceipt transactionTransferReceipt = await transferHandler.SendRequestAndWaitForReceiptAsync(contractAddress, transfer).ConfigureAwait(false); + + return transactionTransferReceipt.TransactionHash; + } + + public static async Task TransferOfflineAsync(Web3 web3, string contractAddress, string recipient, BigInteger amount, HexBigInteger nonce, BigInteger gas, BigInteger gasPrice, string fromAddress = null) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferFunction + { + To = recipient, + TokenAmount = amount, + // Nethereum internally calls its Ethereum client by default to set the GasPrice, Nonce and estimate the Gas, + // so if we want to sign the transaction for the contract completely offline we will need to set those values ourselves. + Nonce = nonce.Value, + Gas = gas, + GasPrice = Web3.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Gwei) + }; + + if (fromAddress != null) + transfer.FromAddress = fromAddress; + + string result = await transferHandler.SignTransactionAsync(contractAddress, transfer).ConfigureAwait(false); + + return result; + } + + public static async Task TransferOwnershipAsync(Web3 web3, string contractAddress, string newOwner) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferOwnershipFunction() + { + NewOwner = newOwner + }; + + TransactionReceipt transactionTransferReceipt = await transferHandler.SendRequestAndWaitForReceiptAsync(contractAddress, transfer).ConfigureAwait(false); + + return transactionTransferReceipt.TransactionHash; + } + + public static async Task GetOwnerAsync(Web3 web3, string contractAddress) + { + var ownerFunctionMessage = new OwnerFunction() + { + }; + + IContractQueryHandler ownerHandler = web3.Eth.GetContractQueryHandler(); + string owner = await ownerHandler.QueryAsync(contractAddress, ownerFunctionMessage).ConfigureAwait(false); + + return owner; + } + + public static async Task GetDestinationAddressAsync(Web3 web3, string contractAddress, string addressToQuery) + { + var withdrawalAddressesFunctionMessage = new WithdrawalAddressesFunction() + { + Address = addressToQuery + }; + + IContractQueryHandler queryHandler = web3.Eth.GetContractQueryHandler(); + string destinationAddress = await queryHandler.QueryAsync(contractAddress, withdrawalAddressesFunctionMessage).ConfigureAwait(false); + + return destinationAddress; + } + + /* + "39509351": "increaseAllowance(address,uint256)", + "dd62ed3e": "allowance(address,address)", + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "7641e6f3": "burn(uint256,string)", + "979430d2": "burnFrom(address,uint256,string)", + "313ce567": "decimals()", + "a457c2d7": "decreaseAllowance(address,uint256)", + "40c10f19": "mint(address,uint256)", + "06fdde03": "name()", + "8da5cb5b": "owner()", + "715018a6": "renounceOwnership()", + "95d89b41": "symbol()", + "18160ddd": "totalSupply()", + "a9059cbb": "transfer(address,uint256)", + "23b872dd": "transferFrom(address,address,uint256)", + "f2fde38b": "transferOwnership(address)", + "7e051867": "withdrawalAddresses(address)" + */ + + public static string ABI = @"[ + { + ""inputs"": [ + { + ""internalType"": ""string"", + ""name"": ""tokenName"", + ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenSymbol"", + ""type"": ""string"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""initialSupply"", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""constructor"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""owner"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""indexed"": false, + ""internalType"": ""uint256"", + ""name"": ""value"", + ""type"": ""uint256"" + } + ], + ""name"": ""Approval"", + ""type"": ""event"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""previousOwner"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""newOwner"", + ""type"": ""address"" + } + ], + ""name"": ""OwnershipTransferred"", + ""type"": ""event"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""from"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""to"", + ""type"": ""address"" + }, + { + ""indexed"": false, + ""internalType"": ""uint256"", + ""name"": ""value"", + ""type"": ""uint256"" + } + ], + ""name"": ""Transfer"", + ""type"": ""event"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""owner"", + ""type"": ""address"" + }, + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + } + ], + ""name"": ""allowance"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""approve"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + } + ], + ""name"": ""balanceOf"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenAddress"", + ""type"": ""string"" + } + ], + ""name"": ""burn"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenAddress"", + ""type"": ""string"" + } + ], + ""name"": ""burnFrom"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""decimals"", + ""outputs"": [ + { + ""internalType"": ""uint8"", + ""name"": """", + ""type"": ""uint8"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""subtractedValue"", + ""type"": ""uint256"" + } + ], + ""name"": ""decreaseAllowance"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""addedValue"", + ""type"": ""uint256"" + } + ], + ""name"": ""increaseAllowance"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""mint"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""name"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""owner"", + ""outputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""renounceOwnership"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""symbol"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""totalSupply"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""recipient"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""transfer"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""sender"", + ""type"": ""address"" + }, + { + ""internalType"": ""address"", + ""name"": ""recipient"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""transferFrom"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""newOwner"", + ""type"": ""address"" + } + ], + ""name"": ""transferOwnership"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""name"": ""withdrawalAddresses"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + } + ]"; + } +} From 470db601ebbd725fd18c6021a320f7454740068f Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 17:51:46 +1100 Subject: [PATCH 14/58] Changes based on feedback --- .../ETHClient/ContractSource/WrappedToken.sol | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 711deee871..1a689f0c3d 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -26,13 +26,14 @@ contract WrappedToken is ERC20, Ownable { * * See {ERC20-_burn}. */ - function burn(uint256 amount, string memory address) public { + function burn(uint256 amount, string memory address, string memory id) public { _burn(_msgSender(), amount); // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - withdrawalAddresses[msg.sender] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", id)); + withdrawalAddresses[key] = address; } /** @@ -46,7 +47,7 @@ contract WrappedToken is ERC20, Ownable { * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ - function burnFrom(address account, uint256 amount, string memory address) public { + function burnFrom(address account, uint256 amount, string memory address, string memory id) public { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); @@ -55,6 +56,7 @@ contract WrappedToken is ERC20, Ownable { // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - withdrawalAddresses[msg.sender] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", id)); + withdrawalAddresses[key] = address; } } From 0032aa66358d208bffca5a7d55e07d0c14cdb606 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 18:00:51 +1100 Subject: [PATCH 15/58] Rename --- .../ETHClient/ContractSource/WrappedToken.sol | 12 ++++++------ .../ETHClient/WrappedToken.cs | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 1a689f0c3d..7c4f068327 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -26,14 +26,14 @@ contract WrappedToken is ERC20, Ownable { * * See {ERC20-_burn}. */ - function burn(uint256 amount, string memory address, string memory id) public { + function burn(uint256 amount, string memory tokenAddress, string memory burnId) public { _burn(_msgSender(), amount); // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - string memory key = string(abi.encodePacked(msg.sender, " ", id)); - withdrawalAddresses[key] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; } /** @@ -47,7 +47,7 @@ contract WrappedToken is ERC20, Ownable { * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ - function burnFrom(address account, uint256 amount, string memory address, string memory id) public { + function burnFrom(address account, uint256 amount, string memory tokenAddress, string memory burnId) public { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); @@ -56,7 +56,7 @@ contract WrappedToken is ERC20, Ownable { // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - string memory key = string(abi.encodePacked(msg.sender, " ", id)); - withdrawalAddresses[key] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; } } diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index 9438dc6ade..b79011e108 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -398,6 +398,11 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""internalType"": ""string"", ""name"": ""tokenAddress"", ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""burnId"", + ""type"": ""string"" } ], ""name"": ""burn"", @@ -421,6 +426,11 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""internalType"": ""string"", ""name"": ""tokenAddress"", ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""burnId"", + ""type"": ""string"" } ], ""name"": ""burnFrom"", From 333a03372cfe6c1d787d41e3d45d77d4d917b15c Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 18:35:37 +1100 Subject: [PATCH 16/58] Add burnId --- src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index b79011e108..d463bd9ca9 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -98,6 +98,9 @@ public class BurnFunction : FunctionMessage [Parameter("string", "tokenAddress", 2)] public string TokenAddress { get; set; } + + [Parameter("string", "burnId", 3)] + public string BurnId { get; set; } } public class WrappedToken From 6afb5fea9d74db2a223bd508d02b60988483b3df Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 16:31:59 +1100 Subject: [PATCH 17/58] Add blacklisting --- .../ETHClient/ContractSource/WrappedToken.sol | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 7c4f068327..02b254932a 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -7,6 +7,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr contract WrappedToken is ERC20, Ownable { mapping (address => string) public withdrawalAddresses; + mapping (address => bool) public _isBlacklisted; constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { _mint(msg.sender, initialSupply); @@ -59,4 +60,27 @@ contract WrappedToken is ERC20, Ownable { string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); withdrawalAddresses[key] = tokenAddress; } + + function addToBlackList(address[] calldata addresses) public onlyOwner { + for (uint256 i; i < addresses.length; ++i) { + _isBlacklisted[addresses[i]] = true; + } + } + + function removeFromBlackList(address account) public onlyOwner { + isBlacklisted[account] = false; + } + + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + } } From 814a3acd97cc5d1f15ce763dfa20ad40b5420e74 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 18:52:59 +1100 Subject: [PATCH 18/58] Fix names --- .../ETHClient/ContractSource/WrappedToken.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 02b254932a..46db74685e 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -68,7 +68,7 @@ contract WrappedToken is ERC20, Ownable { } function removeFromBlackList(address account) public onlyOwner { - isBlacklisted[account] = false; + _isBlacklisted[account] = false; } /** @@ -76,11 +76,11 @@ contract WrappedToken is ERC20, Ownable { * * Requirements: * - * - the contract must not be paused. + * - the addresses must not be blacklisted. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); - require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted"); } } From 20276821e5458db4996ab27b05be6b4f2c0cb87b Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 18:57:28 +1100 Subject: [PATCH 19/58] Use external --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 46db74685e..a2a8157107 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -61,13 +61,13 @@ contract WrappedToken is ERC20, Ownable { withdrawalAddresses[key] = tokenAddress; } - function addToBlackList(address[] calldata addresses) public onlyOwner { + function addToBlackList(address[] calldata addresses) external onlyOwner { for (uint256 i; i < addresses.length; ++i) { _isBlacklisted[addresses[i]] = true; } } - function removeFromBlackList(address account) public onlyOwner { + function removeFromBlackList(address account) external onlyOwner { _isBlacklisted[account] = false; } From 75a0487de430978fb769ab7159d3d1539d5e1acb Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:22:34 +1100 Subject: [PATCH 20/58] Fix compilation issues --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index a2a8157107..8227ef5531 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -6,10 +6,10 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; contract WrappedToken is ERC20, Ownable { - mapping (address => string) public withdrawalAddresses; + mapping (string => string) public withdrawalAddresses; mapping (address => bool) public _isBlacklisted; - constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { + constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { _mint(msg.sender, initialSupply); } From 0113b7eb0a9636a37028b6b88541081a2397a7d4 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:31:13 +1100 Subject: [PATCH 21/58] Update ABI --- .../ETHClient/WrappedToken.cs | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index d463bd9ca9..e18bfb8f50 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -232,7 +232,7 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co "7e051867": "withdrawalAddresses(address)" */ - public static string ABI = @"[ + public static string ABI = @"[ { ""inputs"": [ { @@ -323,6 +323,38 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""name"": ""Transfer"", ""type"": ""event"" }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""name"": ""_isBlacklisted"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address[]"", + ""name"": ""addresses"", + ""type"": ""address[]"" + } + ], + ""name"": ""addToBlackList"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, { ""inputs"": [ { @@ -546,6 +578,19 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""stateMutability"": ""view"", ""type"": ""function"" }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + } + ], + ""name"": ""removeFromBlackList"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, { ""inputs"": [], ""name"": ""renounceOwnership"", @@ -648,9 +693,9 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co { ""inputs"": [ { - ""internalType"": ""address"", + ""internalType"": ""string"", ""name"": """", - ""type"": ""address"" + ""type"": ""string"" } ], ""name"": ""withdrawalAddresses"", From 991cd53cb5464a0aa48ff5918cb4dcdfcc88fc01 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:34:41 +1100 Subject: [PATCH 22/58] Update bytecode --- .../ETHClient/WrappedToken.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index e18bfb8f50..c563293601 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -13,8 +13,8 @@ namespace Stratis.Bitcoin.Features.Interop.ETHClient2 { public class WrappedTokenDeployment : ContractDeploymentMessage { - public static string BYTECODE = // TODO - "0x60806040523480156200001157600080fd5b50604051620016ba380380620016ba833981810160405260208110156200003757600080fd5b5051604080518082018252600c81526b0aee4c2e0e0cac8a6e8e4c2f60a31b6020828101918252835180850190945260068452650aea6a8a482b60d31b9084015281519192916200008b91600391620002a0565b508051620000a1906004906020840190620002a0565b50506005805460ff19166012179055506000620000bd62000126565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506200011f33826200012a565b506200033c565b3390565b6001600160a01b03821662000186576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620001946000838362000239565b620001b0816002546200023e60201b62000ba61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001e391839062000ba66200023e821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000299576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002e357805160ff191683800117855562000313565b8280016001018555821562000313579182015b8281111562000313578251825591602001919060010190620002f6565b506200032192915062000325565b5090565b5b8082111562000321576000815560010162000326565b61136e806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637641e6f3116100a2578063979430d211610071578063979430d2146103cd578063a457c2d714610488578063a9059cbb146104b4578063dd62ed3e146104e0578063f2fde38b1461050e57610116565b80637641e6f3146102ce5780637e0518671461037b5780638da5cb5b146103a157806395d89b41146103c557610116565b8063313ce567116100e9578063313ce56714610228578063395093511461024657806340c10f191461027257806370a08231146102a0578063715018a6146102c657610116565b806306fdde031461011b578063095ea7b31461019857806318160ddd146101d857806323b872dd146101f2575b600080fd5b610123610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356105ca565b604080519115158252519081900360200190f35b6101e06105e7565b60408051918252519081900360200190f35b6101c46004803603606081101561020857600080fd5b506001600160a01b038135811691602081013590911690604001356105ed565b610230610674565b6040805160ff9092168252519081900360200190f35b6101c46004803603604081101561025c57600080fd5b506001600160a01b03813516906020013561067d565b61029e6004803603604081101561028857600080fd5b506001600160a01b0381351690602001356106cb565b005b6101e0600480360360208110156102b657600080fd5b50356001600160a01b0316610748565b61029e610763565b61029e600480360360408110156102e457600080fd5b8135919081019060408101602082013564010000000081111561030657600080fd5b82018360208201111561031857600080fd5b8035906020019184600183028401116401000000008311171561033a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610822945050505050565b6101236004803603602081101561039157600080fd5b50356001600160a01b0316610858565b6103a96108f3565b604080516001600160a01b039092168252519081900360200190f35b610123610907565b61029e600480360360608110156103e357600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561041357600080fd5b82018360208201111561042557600080fd5b8035906020019184600183028401116401000000008311171561044757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610968945050505050565b6101c46004803603604081101561049e57600080fd5b506001600160a01b0381351690602001356109e4565b6101c4600480360360408110156104ca57600080fd5b506001600160a01b038135169060200135610a4c565b6101e0600480360360408110156104f657600080fd5b506001600160a01b0381358116916020013516610a60565b61029e6004803603602081101561052457600080fd5b50356001600160a01b0316610a8b565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b820191906000526020600020905b8154815290600101906020018083116105a357829003601f168201915b5050505050905090565b60006105de6105d7610c07565b8484610c0b565b50600192915050565b60025490565b60006105fa848484610cf7565b61066a84610606610c07565b6106658560405180606001604052806028815260200161125e602891396001600160a01b038a16600090815260016020526040812090610644610c07565b6001600160a01b031681526020810191909152604001600020549190610e52565b610c0b565b5060019392505050565b60055460ff1690565b60006105de61068a610c07565b84610665856001600061069b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610ba6565b6106d3610c07565b60055461010090046001600160a01b0390811691161461073a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107448282610ee9565b5050565b6001600160a01b031660009081526020819052604090205490565b61076b610c07565b60055461010090046001600160a01b039081169116146107d2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b61083361082d610c07565b83610fd9565b336000908152600660209081526040909120825161085392840190611117565b505050565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156108eb5780601f106108c0576101008083540402835291602001916108eb565b820191906000526020600020905b8154815290600101906020018083116108ce57829003601f168201915b505050505081565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b600061099f836040518060600160405280602481526020016112866024913961099887610993610c07565b610a60565b9190610e52565b90506109b3846109ad610c07565b83610c0b565b6109bd8484610fd9565b33600090815260066020908152604090912083516109dd92850190611117565b5050505050565b60006105de6109f1610c07565b84610665856040518060600160405280602581526020016113146025913960016000610a1b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610e52565b60006105de610a59610c07565b8484610cf7565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a93610c07565b60055461010090046001600160a01b03908116911614610afa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610b3f5760405162461bcd60e51b81526004018080602001828103825260268152602001806111f06026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015610c00576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610c505760405162461bcd60e51b81526004018080602001828103825260248152602001806112f06024913960400191505060405180910390fd5b6001600160a01b038216610c955760405162461bcd60e51b81526004018080602001828103825260228152602001806112166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610d3c5760405162461bcd60e51b81526004018080602001828103825260258152602001806112cb6025913960400191505060405180910390fd5b6001600160a01b038216610d815760405162461bcd60e51b81526004018080602001828103825260238152602001806111ab6023913960400191505060405180910390fd5b610d8c838383610853565b610dc981604051806060016040528060268152602001611238602691396001600160a01b0386166000908152602081905260409020549190610e52565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610df89082610ba6565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610ee15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ea6578181015183820152602001610e8e565b50505050905090810190601f168015610ed35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610f44576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610f5060008383610853565b600254610f5d9082610ba6565b6002556001600160a01b038216600090815260208190526040902054610f839082610ba6565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661101e5760405162461bcd60e51b81526004018080602001828103825260218152602001806112aa6021913960400191505060405180910390fd5b61102a82600083610853565b611067816040518060600160405280602281526020016111ce602291396001600160a01b0385166000908152602081905260409020549190610e52565b6001600160a01b03831660009081526020819052604090205560025461108d90826110d5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610c0083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e52565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061115857805160ff1916838001178555611185565b82800160010185558215611185579182015b8281111561118557825182559160200191906001019061116a565b50611191929150611195565b5090565b5b80821115611191576000815560010161119656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cad3aac9a515bf8c31e395c1cb60e9ec8ba2edb3e0e92408c5f7db093befc84664736f6c634300060c0033"; + public static string BYTECODE = + "0x60806040523480156200001157600080fd5b506040516200302338038062003023833981810160405260608110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b506040526020018051906020019092919050505082828160039080519060200190620001dc92919062000689565b508060049080519060200190620001f592919062000689565b506012600560006101000a81548160ff021916908360ff1602179055505050600062000226620002e060201b60201c565b905080600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620002d73382620002e860201b60201c565b50505062000738565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156200038c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b620003a060008383620004c660201b60201c565b620003bc81600254620005fb60201b620020ea1790919060201c565b6002819055506200041a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054620005fb60201b620020ea1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b620004de8383836200068460201b6200266d1760201c565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015620005835750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b620005f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686973206164647265737320697320626c61636b6c6973746564000000000081525060200191505060405180910390fd5b505050565b6000808284019050838110156200067a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620006cc57805160ff1916838001178555620006fd565b82800160010185558215620006fd579182015b82811115620006fc578251825591602001919060010190620006df565b5b5090506200070c919062000710565b5090565b6200073591905b808211156200073157600081600090555060010162000717565b5090565b90565b6128db80620007486000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063715018a6116100b8578063ba211db01161007c578063ba211db01461063c578063bd65278714610798578063dd62ed3e14610914578063f2fde38b1461098c578063f306f6cb146109d0578063ff89757014610b0457610137565b8063715018a6146104995780638da5cb5b146104a357806395d89b41146104ed578063a457c2d714610570578063a9059cbb146105d657610137565b8063313ce567116100ff578063313ce56714610325578063395093511461034957806340c10f19146103af5780634a49ac4c146103fd57806370a082311461044157610137565b806306fdde031461013c578063095ea7b3146101bf57806318160ddd146102255780631cdd3be31461024357806323b872dd1461029f575b600080fd5b610144610b7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1f565b604051808215151515815260200191505060405180910390f35b61022d610c3d565b6040518082815260200191505060405180910390f35b6102856004803603602081101561025957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c47565b604051808215151515815260200191505060405180910390f35b61030b600480360360608110156102b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c67565b604051808215151515815260200191505060405180910390f35b61032d610d40565b604051808260ff1660ff16815260200191505060405180910390f35b6103956004803603604081101561035f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d57565b604051808215151515815260200191505060405180910390f35b6103fb600480360360408110156103c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0a565b005b61043f6004803603602081101561041357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ee2565b005b6104836004803603602081101561045757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611007565b6040518082815260200191505060405180910390f35b6104a161104f565b005b6104ab6111da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f5611204565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053557808201518184015260208101905061051a565b50505050905090810190601f1680156105625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105bc6004803603604081101561058657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112a6565b604051808215151515815260200191505060405180910390f35b610622600480360360408110156105ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611373565b604051808215151515815260200191505060405180910390f35b6107966004803603606081101561065257600080fd5b81019080803590602001909291908035906020019064010000000081111561067957600080fd5b82018360208201111561068b57600080fd5b803590602001918460018302840111640100000000831117156106ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561071057600080fd5b82018360208201111561072257600080fd5b8035906020019184600183028401116401000000008311171561074457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611391565b005b610912600480360360808110156107ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156107f557600080fd5b82018360208201111561080757600080fd5b8035906020019184600183028401116401000000008311171561082957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561088c57600080fd5b82018360208201111561089e57600080fd5b803590602001918460018302840111640100000000831117156108c057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506114f4565b005b6109766004803603604081101561092a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116a5565b6040518082815260200191505060405180910390f35b6109ce600480360360208110156109a257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172c565b005b610a89600480360360208110156109e657600080fd5b8101908080359060200190640100000000811115610a0357600080fd5b820183602082011115610a1557600080fd5b80359060200191846001830284011164010000000083111715610a3757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061193c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ac9578082015181840152602081019050610aae565b50505050905090810190601f168015610af65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610b7b60048036036020811015610b1a57600080fd5b8101908080359060200190640100000000811115610b3757600080fd5b820183602082011115610b4957600080fd5b80359060200191846020830284011164010000000083111715610b6b57600080fd5b9091929391929390505050611a02565b005b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c155780601f10610bea57610100808354040283529160200191610c15565b820191906000526020600020905b815481529060010190602001808311610bf857829003601f168201915b5050505050905090565b6000610c33610c2c611b6a565b8484611b72565b6001905092915050565b6000600254905090565b60076020528060005260406000206000915054906101000a900460ff1681565b6000610c74848484611d69565b610d3584610c80611b6a565b610d30856040518060600160405280602881526020016127cb60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ce6611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b611b72565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610e00610d64611b6a565b84610dfb8560016000610d75611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b611b72565b6001905092915050565b610e12611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610ede8282612172565b5050565b610eea611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611057611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611119576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129c5780601f106112715761010080835404028352916020019161129c565b820191906000526020600020905b81548152906001019060200180831161127f57829003601f168201915b5050505050905090565b60006113696112b3611b6a565b846113648560405180606001604052806025815260200161288160259139600160006112dd611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b611b72565b6001905092915050565b6000611387611380611b6a565b8484611d69565b6001905092915050565b6113a261139c611b6a565b84612339565b60603382604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f200000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b602083106114395780518252602082019150602081019050602083039250611416565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050826006826040518082805190602001908083835b602083106114a75780518252602082019150602081019050602083039250611484565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902090805190602001906114ed929190612672565b5050505050565b6000611533846040518060600160405280602481526020016127f3602491396115248861151f611b6a565b6116a5565b61202a9092919063ffffffff16565b905061154785611541611b6a565b83611b72565b6115518585612339565b60603383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f200000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b602083106115e857805182526020820191506020810190506020830392506115c5565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050836006826040518082805190602001908083835b602083106116565780518252602082019150602081019050602083039250611633565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020908051906020019061169c929190612672565b50505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611734611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561187c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061275d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6006818051602081018201805184825260208301602085012081835280955050505050506000915090508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081565b611a0a611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611acc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b82829050811015611b6557600160076000858585818110611aec57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550806001019050611acf565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bf8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061285d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806127836022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611def576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806128386025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806127186023913960400191505060405180910390fd5b611e808383836124fd565b611eeb816040518060600160405280602681526020016127a5602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906120d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561209c578082015181840152602081019050612081565b50505050905090810190601f1680156120c95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b612221600083836124fd565b612236816002546120ea90919063ffffffff16565b60028190555061228d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156123bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806128176021913960400191505060405180910390fd5b6123cb826000836124fd565b6124368160405180606001604052806022815260200161273b602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061248d8160025461262390919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b61250883838361266d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156125ac5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61261e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686973206164647265737320697320626c61636b6c6973746564000000000081525060200191505060405180910390fd5b505050565b600061266583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061202a565b905092915050565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106126b357805160ff19168380011785556126e1565b828001600101855582156126e1579182015b828111156126e05782518255916020019190600101906126c5565b5b5090506126ee91906126f2565b5090565b61271491905b808211156127105760008160009055506001016126f8565b5090565b9056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208257b60e1e63956e9d349bc7d44d3b3eef8885b643e61c16bf7453108c360e3264736f6c63430006000033"; public WrappedTokenDeployment() : base(BYTECODE) { From 19abd6cf58f54b89c31553e21ecdd341ecddacc3 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:38:18 +1100 Subject: [PATCH 23/58] Update WrappedTokenDeployment --- .../ETHClient/WrappedToken.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index c563293601..a6053c03cb 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -20,8 +20,14 @@ public WrappedTokenDeployment() : base(BYTECODE) { } - [Parameter("uint256", "totalSupply")] - public BigInteger TotalSupply { get; set; } + [Parameter("string", "tokenName")] + public string TokenName { get; set; } + + [Parameter("string", "tokenSymbol")] + public string TokenSymbol { get; set; } + + [Parameter("uint256", "initialSupply")] + public BigInteger InitialSupply { get; set; } } [Function("balanceOf", "uint256")] From 721fd348a1574acc5b85ee98411ab67cc0a239ad Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:39:45 +1100 Subject: [PATCH 24/58] Fix --- src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index a6053c03cb..ceb38e14dc 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -115,7 +115,7 @@ public static async Task DeployContractAsync(Web3 web3, BigInteger total { var deploymentMessage = new WrappedTokenDeployment() { - TotalSupply = totalSupply + InitialSupply = totalSupply }; IContractDeploymentTransactionHandler deploymentHandler = web3.Eth.GetContractDeploymentHandler(); From 344638fab1447412a1a71bc74f344c026975e611 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:46:14 +1100 Subject: [PATCH 25/58] Add helper classes --- .../ETHClient/WrappedToken.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index ceb38e14dc..f728f8f321 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -109,6 +109,20 @@ public class BurnFunction : FunctionMessage public string BurnId { get; set; } } + [Function("addToBlackList")] + public class AddToBlackListFunction : FunctionMessage + { + [Parameter("address[]", "addresses", 1)] + public string Addresses { get; set; } + } + + [Function("removeFromBlackList")] + public class RemoveFromBlackListFunction : FunctionMessage + { + [Parameter("address", "account", 1)] + public string Address { get; set; } + } + public class WrappedToken { public static async Task DeployContractAsync(Web3 web3, BigInteger totalSupply) From e7d3278835e94cbb41a1372d863cfc20ed427ad2 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Tue, 11 Oct 2022 09:58:16 +0100 Subject: [PATCH 26/58] Bump all versions to 1.3.4.0 --- .../ETHClient/WrappedToken.sol | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol new file mode 100644 index 0000000000..6554ce0011 --- /dev/null +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.0; + +// Importing dependencies +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/cryptography/ECDSA.sol"; + +contract WrappedToken is ERC20, Ownable { + mapping (string => string) public withdrawalAddresses; + mapping (address => bool) public isBlacklisted; + + // Constructor initializes the ERC20 token + constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { + _mint(msg.sender, initialSupply); + } + + // Allows only the owner to mint new tokens + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + // Allows users to burn tokens and specify a withdrawal address + function burn(uint256 amount, string memory tokenAddress, string memory burnId) public { + _burn(msg.sender, amount); + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; + } + + // Allows users to burn tokens from an approved address + function burnFrom(address account, uint256 amount, string memory tokenAddress, string memory burnId) public { + uint256 decreasedAllowance = allowance(account, msg.sender).sub(amount, "ERC20: burn amount exceeds allowance"); + _approve(account, msg.sender, decreasedAllowance); + _burn(account, amount); + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; + } + + // Allows the owner to add addresses to the blacklist + function addToBlackList(address[] calldata addresses) external onlyOwner { + for (uint256 i = 0; i < addresses.length; ++i) { + isBlacklisted[addresses[i]] = true; + } + } + + // Allows the owner to remove addresses from the blacklist + function removeFromBlackList(address account) external onlyOwner { + isBlacklisted[account] = false; + } + + // Checks if the address is blacklisted before any token transfer + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + } + + // Perform a cross-chain transfer using delegated transfer with metadata + function delegatedTransferForNetwork( + uint128 uniqueNumber, + string memory token, + address fromAddr, + address toAddr, + string memory targetNetwork, + string memory targetAddress, + string memory metadata, + bytes memory userSignature, + uint32 amount, + uint8 amountCents, + uint32 fee, + uint8 feeCents, + bytes memory signature + ) public { + bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); + bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); + bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); + address recoveredAddress = ECDSA.recover(eip712DataHash, signature); + require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); + // Convert amounts to satoshis. + uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; + uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; + _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); + _transfer(fromAddr, interflux, redemptionAmount + feeAmount); + emit CrossChainTransferLog(targetAddress, targetNetwork); + emit MetadataLog(metadata); + } + + // Event definitions + event CrossChainTransferLog(string account, string network); + event MetadataLog(string metadata); + + // Ethereum Interflux address variable + address public interflux; + + // Method to update the Ethereum Interflux address + function setInterflux(address newAddress) public onlyOwner { + interflux = newAddress; + } +} From 577aa63d1b38490c307de9fe3e8be65a335de944 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Fri, 21 Oct 2022 14:21:16 +0100 Subject: [PATCH 27/58] Bump all versions to 1.4.0.0 --- .../Stratis.Features.FederatedPeg.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj index 1a87992a65..ed01346e8b 100644 --- a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj +++ b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj @@ -12,7 +12,7 @@ Full ..\None.ruleset Stratis Group Ltd. - 4.0.11.0 + 4.0.10.0 From f9dfd51c0e7e81f855fb9e5a21bd429dc89452dc Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Wed, 9 Nov 2022 13:22:20 +0000 Subject: [PATCH 28/58] Set version to RC --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index bb3b89b91b..2fb90c6af2 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.7")] -[assembly: AssemblyFileVersion("1.4.0.7")] +[assembly: AssemblyVersion("1.4.0.0")] +[assembly: AssemblyFileVersion("1.4.0.0")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 4488a76c77..eb11ed8f38 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.7 + 1.4.0.0-rc False ..\Stratis.ruleset Stratis Group Ltd. From 84d7f4048f37cb36509bdef275be8a2a6ba0d59d Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 13:58:14 +0000 Subject: [PATCH 29/58] Bump build version to 1.4.0.1 --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index 2fb90c6af2..c7d8db21fb 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.4.0.1")] +[assembly: AssemblyFileVersion("1.4.0.1")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index eb11ed8f38..5512b8ed54 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.0-rc + 1.4.0.1-rc False ..\Stratis.ruleset Stratis Group Ltd. From 149a154155ecedab6bb56d1ab25c4475174f0d73 Mon Sep 17 00:00:00 2001 From: Francois de la Rouviere Date: Mon, 14 Nov 2022 15:06:33 +0000 Subject: [PATCH 30/58] Bump build revision to 1.4.0.2 --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index c7d8db21fb..40e160b72e 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.1")] -[assembly: AssemblyFileVersion("1.4.0.1")] +[assembly: AssemblyVersion("1.4.0.2")] +[assembly: AssemblyFileVersion("1.4.0.2")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 5512b8ed54..253a695684 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.1-rc + 1.4.0.2-rc False ..\Stratis.ruleset Stratis Group Ltd. From 309aed9dc7e8701c6e307f5f05215aee351ac3c1 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 17 Nov 2022 18:35:23 +1100 Subject: [PATCH 31/58] Add WrappedToken.sol --- .../ETHClient/ContractSource/WrappedToken.sol | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol new file mode 100644 index 0000000000..711deee871 --- /dev/null +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -0,0 +1,60 @@ +// contracts/WrappedToken.sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.0; + +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; + +contract WrappedToken is ERC20, Ownable { + mapping (address => string) public withdrawalAddresses; + + constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { + _mint(msg.sender, initialSupply); + } + + /** + * @dev Creates `amount` new tokens and assigns them to `account`. + * + * See {ERC20-_mint}. + */ + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount, string memory address) public { + _burn(_msgSender(), amount); + + // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. + // Currently it is only possible to assign a single address here, so if multiple recipients are required + // the burner will have to wait until each burn is processed before proceeding with the next. + withdrawalAddresses[msg.sender] = address; + } + + /** + * @dev Destroys `amount` tokens from `account`, deducting from the caller's + * allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `amount`. + */ + function burnFrom(address account, uint256 amount, string memory address) public { + uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); + + _approve(account, _msgSender(), decreasedAllowance); + _burn(account, amount); + + // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. + // Currently it is only possible to assign a single address here, so if multiple recipients are required + // the burner will have to wait until each burn is processed before proceeding with the next. + withdrawalAddresses[msg.sender] = address; + } +} From efb0ebb52b87e50e3477681962ac5fcac166a4fa Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 17 Nov 2022 20:04:55 +1100 Subject: [PATCH 32/58] Add WrappedToken.cs --- .../ETHClient/WrappedToken.cs | 656 ++++++++++++++++++ 1 file changed, 656 insertions(+) create mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs new file mode 100644 index 0000000000..9438dc6ade --- /dev/null +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -0,0 +1,656 @@ +using System.Numerics; +using System.Threading.Tasks; +using Nethereum.ABI.FunctionEncoding.Attributes; +using Nethereum.Contracts; +using Nethereum.Contracts.ContractHandlers; +using Nethereum.Contracts.CQS; +using Nethereum.Hex.HexTypes; +using Nethereum.RPC.Eth.DTOs; +using Nethereum.Util; +using Nethereum.Web3; + +namespace Stratis.Bitcoin.Features.Interop.ETHClient2 +{ + public class WrappedTokenDeployment : ContractDeploymentMessage + { + public static string BYTECODE = // TODO + "0x60806040523480156200001157600080fd5b50604051620016ba380380620016ba833981810160405260208110156200003757600080fd5b5051604080518082018252600c81526b0aee4c2e0e0cac8a6e8e4c2f60a31b6020828101918252835180850190945260068452650aea6a8a482b60d31b9084015281519192916200008b91600391620002a0565b508051620000a1906004906020840190620002a0565b50506005805460ff19166012179055506000620000bd62000126565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506200011f33826200012a565b506200033c565b3390565b6001600160a01b03821662000186576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620001946000838362000239565b620001b0816002546200023e60201b62000ba61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001e391839062000ba66200023e821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000299576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002e357805160ff191683800117855562000313565b8280016001018555821562000313579182015b8281111562000313578251825591602001919060010190620002f6565b506200032192915062000325565b5090565b5b8082111562000321576000815560010162000326565b61136e806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637641e6f3116100a2578063979430d211610071578063979430d2146103cd578063a457c2d714610488578063a9059cbb146104b4578063dd62ed3e146104e0578063f2fde38b1461050e57610116565b80637641e6f3146102ce5780637e0518671461037b5780638da5cb5b146103a157806395d89b41146103c557610116565b8063313ce567116100e9578063313ce56714610228578063395093511461024657806340c10f191461027257806370a08231146102a0578063715018a6146102c657610116565b806306fdde031461011b578063095ea7b31461019857806318160ddd146101d857806323b872dd146101f2575b600080fd5b610123610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356105ca565b604080519115158252519081900360200190f35b6101e06105e7565b60408051918252519081900360200190f35b6101c46004803603606081101561020857600080fd5b506001600160a01b038135811691602081013590911690604001356105ed565b610230610674565b6040805160ff9092168252519081900360200190f35b6101c46004803603604081101561025c57600080fd5b506001600160a01b03813516906020013561067d565b61029e6004803603604081101561028857600080fd5b506001600160a01b0381351690602001356106cb565b005b6101e0600480360360208110156102b657600080fd5b50356001600160a01b0316610748565b61029e610763565b61029e600480360360408110156102e457600080fd5b8135919081019060408101602082013564010000000081111561030657600080fd5b82018360208201111561031857600080fd5b8035906020019184600183028401116401000000008311171561033a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610822945050505050565b6101236004803603602081101561039157600080fd5b50356001600160a01b0316610858565b6103a96108f3565b604080516001600160a01b039092168252519081900360200190f35b610123610907565b61029e600480360360608110156103e357600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561041357600080fd5b82018360208201111561042557600080fd5b8035906020019184600183028401116401000000008311171561044757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610968945050505050565b6101c46004803603604081101561049e57600080fd5b506001600160a01b0381351690602001356109e4565b6101c4600480360360408110156104ca57600080fd5b506001600160a01b038135169060200135610a4c565b6101e0600480360360408110156104f657600080fd5b506001600160a01b0381358116916020013516610a60565b61029e6004803603602081101561052457600080fd5b50356001600160a01b0316610a8b565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b820191906000526020600020905b8154815290600101906020018083116105a357829003601f168201915b5050505050905090565b60006105de6105d7610c07565b8484610c0b565b50600192915050565b60025490565b60006105fa848484610cf7565b61066a84610606610c07565b6106658560405180606001604052806028815260200161125e602891396001600160a01b038a16600090815260016020526040812090610644610c07565b6001600160a01b031681526020810191909152604001600020549190610e52565b610c0b565b5060019392505050565b60055460ff1690565b60006105de61068a610c07565b84610665856001600061069b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610ba6565b6106d3610c07565b60055461010090046001600160a01b0390811691161461073a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107448282610ee9565b5050565b6001600160a01b031660009081526020819052604090205490565b61076b610c07565b60055461010090046001600160a01b039081169116146107d2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b61083361082d610c07565b83610fd9565b336000908152600660209081526040909120825161085392840190611117565b505050565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156108eb5780601f106108c0576101008083540402835291602001916108eb565b820191906000526020600020905b8154815290600101906020018083116108ce57829003601f168201915b505050505081565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b600061099f836040518060600160405280602481526020016112866024913961099887610993610c07565b610a60565b9190610e52565b90506109b3846109ad610c07565b83610c0b565b6109bd8484610fd9565b33600090815260066020908152604090912083516109dd92850190611117565b5050505050565b60006105de6109f1610c07565b84610665856040518060600160405280602581526020016113146025913960016000610a1b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610e52565b60006105de610a59610c07565b8484610cf7565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a93610c07565b60055461010090046001600160a01b03908116911614610afa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610b3f5760405162461bcd60e51b81526004018080602001828103825260268152602001806111f06026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015610c00576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610c505760405162461bcd60e51b81526004018080602001828103825260248152602001806112f06024913960400191505060405180910390fd5b6001600160a01b038216610c955760405162461bcd60e51b81526004018080602001828103825260228152602001806112166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610d3c5760405162461bcd60e51b81526004018080602001828103825260258152602001806112cb6025913960400191505060405180910390fd5b6001600160a01b038216610d815760405162461bcd60e51b81526004018080602001828103825260238152602001806111ab6023913960400191505060405180910390fd5b610d8c838383610853565b610dc981604051806060016040528060268152602001611238602691396001600160a01b0386166000908152602081905260409020549190610e52565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610df89082610ba6565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610ee15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ea6578181015183820152602001610e8e565b50505050905090810190601f168015610ed35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610f44576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610f5060008383610853565b600254610f5d9082610ba6565b6002556001600160a01b038216600090815260208190526040902054610f839082610ba6565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661101e5760405162461bcd60e51b81526004018080602001828103825260218152602001806112aa6021913960400191505060405180910390fd5b61102a82600083610853565b611067816040518060600160405280602281526020016111ce602291396001600160a01b0385166000908152602081905260409020549190610e52565b6001600160a01b03831660009081526020819052604090205560025461108d90826110d5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610c0083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e52565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061115857805160ff1916838001178555611185565b82800160010185558215611185579182015b8281111561118557825182559160200191906001019061116a565b50611191929150611195565b5090565b5b80821115611191576000815560010161119656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cad3aac9a515bf8c31e395c1cb60e9ec8ba2edb3e0e92408c5f7db093befc84664736f6c634300060c0033"; + + public WrappedTokenDeployment() : base(BYTECODE) + { + } + + [Parameter("uint256", "totalSupply")] + public BigInteger TotalSupply { get; set; } + } + + [Function("balanceOf", "uint256")] + public class BalanceOfFunction : FunctionMessage + { + [Parameter("address", "_owner", 1)] + public string Owner { get; set; } + } + + [FunctionOutput] + public class BalanceOfOutputDTO : IFunctionOutputDTO + { + [Parameter("uint256", "balance", 1)] + public BigInteger Balance { get; set; } + } + + [Function("transfer", "bool")] + public class TransferFunction : FunctionMessage + { + [Parameter("address", "_to", 1)] + public string To { get; set; } + + [Parameter("uint256", "_value", 2)] + public BigInteger TokenAmount { get; set; } + } + + [Event("Transfer")] + public class TransferEventDTO : IEventDTO + { + [Parameter("address", "_from", 1, true)] + public string From { get; set; } + + [Parameter("address", "_to", 2, true)] + public string To { get; set; } + + [Parameter("uint256", "_value", 3, false)] + public BigInteger Value { get; set; } + } + + [Function("owner", "address")] + public class OwnerFunction : FunctionMessage + { + } + + [Function("transferOwnership")] + public class TransferOwnershipFunction : FunctionMessage + { + [Parameter("address", "newOwner", 1)] + public string NewOwner { get; set; } + } + + [Function("withdrawalAddresses", "string")] + public class WithdrawalAddressesFunction : FunctionMessage + { + [Parameter("address", "", 1)] + public string Address { get; set; } + } + + [Function("mint")] + public class MintFunction : FunctionMessage + { + [Parameter("address", "account", 1)] + public string Account { get; set; } + + [Parameter("uint256", "amount", 2)] + public BigInteger Amount { get; set; } + } + + [Function("burn")] + public class BurnFunction : FunctionMessage + { + [Parameter("uint256", "amount", 1)] + public BigInteger Amount { get; set; } + + [Parameter("string", "tokenAddress", 2)] + public string TokenAddress { get; set; } + } + + public class WrappedToken + { + public static async Task DeployContractAsync(Web3 web3, BigInteger totalSupply) + { + var deploymentMessage = new WrappedTokenDeployment() + { + TotalSupply = totalSupply + }; + + IContractDeploymentTransactionHandler deploymentHandler = web3.Eth.GetContractDeploymentHandler(); + TransactionReceipt transactionReceiptDeployment = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage).ConfigureAwait(false); + string contractAddress = transactionReceiptDeployment.ContractAddress; + + return contractAddress; + } + + public static async Task GetErc20BalanceAsync(Web3 web3, string contractAddress, string addressToQuery) + { + var balanceOfFunctionMessage = new BalanceOfFunction() + { + Owner = addressToQuery + }; + + IContractQueryHandler balanceHandler = web3.Eth.GetContractQueryHandler(); + BigInteger balance = await balanceHandler.QueryAsync(contractAddress, balanceOfFunctionMessage).ConfigureAwait(false); + + return balance; + } + + public static async Task TransferAsync(Web3 web3, string contractAddress, string recipient, BigInteger amount, BigInteger gas, BigInteger gasPrice) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferFunction() + { + To = recipient, + TokenAmount = amount, + Gas = gas, + GasPrice = Web3.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Gwei) + }; + + TransactionReceipt transactionTransferReceipt = await transferHandler.SendRequestAndWaitForReceiptAsync(contractAddress, transfer).ConfigureAwait(false); + + return transactionTransferReceipt.TransactionHash; + } + + public static async Task TransferOfflineAsync(Web3 web3, string contractAddress, string recipient, BigInteger amount, HexBigInteger nonce, BigInteger gas, BigInteger gasPrice, string fromAddress = null) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferFunction + { + To = recipient, + TokenAmount = amount, + // Nethereum internally calls its Ethereum client by default to set the GasPrice, Nonce and estimate the Gas, + // so if we want to sign the transaction for the contract completely offline we will need to set those values ourselves. + Nonce = nonce.Value, + Gas = gas, + GasPrice = Web3.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Gwei) + }; + + if (fromAddress != null) + transfer.FromAddress = fromAddress; + + string result = await transferHandler.SignTransactionAsync(contractAddress, transfer).ConfigureAwait(false); + + return result; + } + + public static async Task TransferOwnershipAsync(Web3 web3, string contractAddress, string newOwner) + { + IContractTransactionHandler transferHandler = web3.Eth.GetContractTransactionHandler(); + + var transfer = new TransferOwnershipFunction() + { + NewOwner = newOwner + }; + + TransactionReceipt transactionTransferReceipt = await transferHandler.SendRequestAndWaitForReceiptAsync(contractAddress, transfer).ConfigureAwait(false); + + return transactionTransferReceipt.TransactionHash; + } + + public static async Task GetOwnerAsync(Web3 web3, string contractAddress) + { + var ownerFunctionMessage = new OwnerFunction() + { + }; + + IContractQueryHandler ownerHandler = web3.Eth.GetContractQueryHandler(); + string owner = await ownerHandler.QueryAsync(contractAddress, ownerFunctionMessage).ConfigureAwait(false); + + return owner; + } + + public static async Task GetDestinationAddressAsync(Web3 web3, string contractAddress, string addressToQuery) + { + var withdrawalAddressesFunctionMessage = new WithdrawalAddressesFunction() + { + Address = addressToQuery + }; + + IContractQueryHandler queryHandler = web3.Eth.GetContractQueryHandler(); + string destinationAddress = await queryHandler.QueryAsync(contractAddress, withdrawalAddressesFunctionMessage).ConfigureAwait(false); + + return destinationAddress; + } + + /* + "39509351": "increaseAllowance(address,uint256)", + "dd62ed3e": "allowance(address,address)", + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "7641e6f3": "burn(uint256,string)", + "979430d2": "burnFrom(address,uint256,string)", + "313ce567": "decimals()", + "a457c2d7": "decreaseAllowance(address,uint256)", + "40c10f19": "mint(address,uint256)", + "06fdde03": "name()", + "8da5cb5b": "owner()", + "715018a6": "renounceOwnership()", + "95d89b41": "symbol()", + "18160ddd": "totalSupply()", + "a9059cbb": "transfer(address,uint256)", + "23b872dd": "transferFrom(address,address,uint256)", + "f2fde38b": "transferOwnership(address)", + "7e051867": "withdrawalAddresses(address)" + */ + + public static string ABI = @"[ + { + ""inputs"": [ + { + ""internalType"": ""string"", + ""name"": ""tokenName"", + ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenSymbol"", + ""type"": ""string"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""initialSupply"", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""constructor"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""owner"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""indexed"": false, + ""internalType"": ""uint256"", + ""name"": ""value"", + ""type"": ""uint256"" + } + ], + ""name"": ""Approval"", + ""type"": ""event"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""previousOwner"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""newOwner"", + ""type"": ""address"" + } + ], + ""name"": ""OwnershipTransferred"", + ""type"": ""event"" + }, + { + ""anonymous"": false, + ""inputs"": [ + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""from"", + ""type"": ""address"" + }, + { + ""indexed"": true, + ""internalType"": ""address"", + ""name"": ""to"", + ""type"": ""address"" + }, + { + ""indexed"": false, + ""internalType"": ""uint256"", + ""name"": ""value"", + ""type"": ""uint256"" + } + ], + ""name"": ""Transfer"", + ""type"": ""event"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""owner"", + ""type"": ""address"" + }, + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + } + ], + ""name"": ""allowance"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""approve"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + } + ], + ""name"": ""balanceOf"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenAddress"", + ""type"": ""string"" + } + ], + ""name"": ""burn"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + }, + { + ""internalType"": ""string"", + ""name"": ""tokenAddress"", + ""type"": ""string"" + } + ], + ""name"": ""burnFrom"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""decimals"", + ""outputs"": [ + { + ""internalType"": ""uint8"", + ""name"": """", + ""type"": ""uint8"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""subtractedValue"", + ""type"": ""uint256"" + } + ], + ""name"": ""decreaseAllowance"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""spender"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""addedValue"", + ""type"": ""uint256"" + } + ], + ""name"": ""increaseAllowance"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""mint"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""name"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""owner"", + ""outputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""renounceOwnership"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""symbol"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [], + ""name"": ""totalSupply"", + ""outputs"": [ + { + ""internalType"": ""uint256"", + ""name"": """", + ""type"": ""uint256"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""recipient"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""transfer"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""sender"", + ""type"": ""address"" + }, + { + ""internalType"": ""address"", + ""name"": ""recipient"", + ""type"": ""address"" + }, + { + ""internalType"": ""uint256"", + ""name"": ""amount"", + ""type"": ""uint256"" + } + ], + ""name"": ""transferFrom"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""newOwner"", + ""type"": ""address"" + } + ], + ""name"": ""transferOwnership"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""name"": ""withdrawalAddresses"", + ""outputs"": [ + { + ""internalType"": ""string"", + ""name"": """", + ""type"": ""string"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + } + ]"; + } +} From fb747f50d73bbdfb05e1994428c26bd5e69f3690 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 17:51:46 +1100 Subject: [PATCH 33/58] Changes based on feedback --- .../ETHClient/ContractSource/WrappedToken.sol | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 711deee871..1a689f0c3d 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -26,13 +26,14 @@ contract WrappedToken is ERC20, Ownable { * * See {ERC20-_burn}. */ - function burn(uint256 amount, string memory address) public { + function burn(uint256 amount, string memory address, string memory id) public { _burn(_msgSender(), amount); // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - withdrawalAddresses[msg.sender] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", id)); + withdrawalAddresses[key] = address; } /** @@ -46,7 +47,7 @@ contract WrappedToken is ERC20, Ownable { * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ - function burnFrom(address account, uint256 amount, string memory address) public { + function burnFrom(address account, uint256 amount, string memory address, string memory id) public { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); @@ -55,6 +56,7 @@ contract WrappedToken is ERC20, Ownable { // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - withdrawalAddresses[msg.sender] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", id)); + withdrawalAddresses[key] = address; } } From b2f731bff6b3b4d5d377a57a10ddba968044d515 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 18:00:51 +1100 Subject: [PATCH 34/58] Rename --- .../ETHClient/ContractSource/WrappedToken.sol | 12 ++++++------ .../ETHClient/WrappedToken.cs | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 1a689f0c3d..7c4f068327 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -26,14 +26,14 @@ contract WrappedToken is ERC20, Ownable { * * See {ERC20-_burn}. */ - function burn(uint256 amount, string memory address, string memory id) public { + function burn(uint256 amount, string memory tokenAddress, string memory burnId) public { _burn(_msgSender(), amount); // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - string memory key = string(abi.encodePacked(msg.sender, " ", id)); - withdrawalAddresses[key] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; } /** @@ -47,7 +47,7 @@ contract WrappedToken is ERC20, Ownable { * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ - function burnFrom(address account, uint256 amount, string memory address, string memory id) public { + function burnFrom(address account, uint256 amount, string memory tokenAddress, string memory burnId) public { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); @@ -56,7 +56,7 @@ contract WrappedToken is ERC20, Ownable { // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. // Currently it is only possible to assign a single address here, so if multiple recipients are required // the burner will have to wait until each burn is processed before proceeding with the next. - string memory key = string(abi.encodePacked(msg.sender, " ", id)); - withdrawalAddresses[key] = address; + string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); + withdrawalAddresses[key] = tokenAddress; } } diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index 9438dc6ade..b79011e108 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -398,6 +398,11 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""internalType"": ""string"", ""name"": ""tokenAddress"", ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""burnId"", + ""type"": ""string"" } ], ""name"": ""burn"", @@ -421,6 +426,11 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""internalType"": ""string"", ""name"": ""tokenAddress"", ""type"": ""string"" + }, + { + ""internalType"": ""string"", + ""name"": ""burnId"", + ""type"": ""string"" } ], ""name"": ""burnFrom"", From 485edaad2a9df53fe7e357a3b96ba777ac5d8f21 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 18 Nov 2022 18:35:37 +1100 Subject: [PATCH 35/58] Add burnId --- src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index b79011e108..d463bd9ca9 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -98,6 +98,9 @@ public class BurnFunction : FunctionMessage [Parameter("string", "tokenAddress", 2)] public string TokenAddress { get; set; } + + [Parameter("string", "burnId", 3)] + public string BurnId { get; set; } } public class WrappedToken From c7c42325c62391107e093945847447540798a642 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 16:31:59 +1100 Subject: [PATCH 36/58] Add blacklisting --- .../ETHClient/ContractSource/WrappedToken.sol | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 7c4f068327..02b254932a 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -7,6 +7,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr contract WrappedToken is ERC20, Ownable { mapping (address => string) public withdrawalAddresses; + mapping (address => bool) public _isBlacklisted; constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { _mint(msg.sender, initialSupply); @@ -59,4 +60,27 @@ contract WrappedToken is ERC20, Ownable { string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); withdrawalAddresses[key] = tokenAddress; } + + function addToBlackList(address[] calldata addresses) public onlyOwner { + for (uint256 i; i < addresses.length; ++i) { + _isBlacklisted[addresses[i]] = true; + } + } + + function removeFromBlackList(address account) public onlyOwner { + isBlacklisted[account] = false; + } + + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + } } From 68872464cbd22b5074ac326964162b105405f62c Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 18:52:59 +1100 Subject: [PATCH 37/58] Fix names --- .../ETHClient/ContractSource/WrappedToken.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 02b254932a..46db74685e 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -68,7 +68,7 @@ contract WrappedToken is ERC20, Ownable { } function removeFromBlackList(address account) public onlyOwner { - isBlacklisted[account] = false; + _isBlacklisted[account] = false; } /** @@ -76,11 +76,11 @@ contract WrappedToken is ERC20, Ownable { * * Requirements: * - * - the contract must not be paused. + * - the addresses must not be blacklisted. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); - require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted"); } } From 9ee754cfdaddf84be472082c70a0bf4699c1d4e1 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 18:57:28 +1100 Subject: [PATCH 38/58] Use external --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 46db74685e..a2a8157107 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -61,13 +61,13 @@ contract WrappedToken is ERC20, Ownable { withdrawalAddresses[key] = tokenAddress; } - function addToBlackList(address[] calldata addresses) public onlyOwner { + function addToBlackList(address[] calldata addresses) external onlyOwner { for (uint256 i; i < addresses.length; ++i) { _isBlacklisted[addresses[i]] = true; } } - function removeFromBlackList(address account) public onlyOwner { + function removeFromBlackList(address account) external onlyOwner { _isBlacklisted[account] = false; } From 9c8529e917bb7ea2d4b9fd6c26c3bb2efdf9d215 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:22:34 +1100 Subject: [PATCH 39/58] Fix compilation issues --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index a2a8157107..8227ef5531 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -6,10 +6,10 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; contract WrappedToken is ERC20, Ownable { - mapping (address => string) public withdrawalAddresses; + mapping (string => string) public withdrawalAddresses; mapping (address => bool) public _isBlacklisted; - constructor(string tokenName, string tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { + constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { _mint(msg.sender, initialSupply); } From 61fe51685bf73fa15a558f5a92f458b9f781dbc6 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:31:13 +1100 Subject: [PATCH 40/58] Update ABI --- .../ETHClient/WrappedToken.cs | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index d463bd9ca9..e18bfb8f50 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -232,7 +232,7 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co "7e051867": "withdrawalAddresses(address)" */ - public static string ABI = @"[ + public static string ABI = @"[ { ""inputs"": [ { @@ -323,6 +323,38 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""name"": ""Transfer"", ""type"": ""event"" }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": """", + ""type"": ""address"" + } + ], + ""name"": ""_isBlacklisted"", + ""outputs"": [ + { + ""internalType"": ""bool"", + ""name"": """", + ""type"": ""bool"" + } + ], + ""stateMutability"": ""view"", + ""type"": ""function"" + }, + { + ""inputs"": [ + { + ""internalType"": ""address[]"", + ""name"": ""addresses"", + ""type"": ""address[]"" + } + ], + ""name"": ""addToBlackList"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, { ""inputs"": [ { @@ -546,6 +578,19 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co ""stateMutability"": ""view"", ""type"": ""function"" }, + { + ""inputs"": [ + { + ""internalType"": ""address"", + ""name"": ""account"", + ""type"": ""address"" + } + ], + ""name"": ""removeFromBlackList"", + ""outputs"": [], + ""stateMutability"": ""nonpayable"", + ""type"": ""function"" + }, { ""inputs"": [], ""name"": ""renounceOwnership"", @@ -648,9 +693,9 @@ public static async Task GetDestinationAddressAsync(Web3 web3, string co { ""inputs"": [ { - ""internalType"": ""address"", + ""internalType"": ""string"", ""name"": """", - ""type"": ""address"" + ""type"": ""string"" } ], ""name"": ""withdrawalAddresses"", From 407bed3cb59e9869f6abbdfec7931f5c326e05d2 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:34:41 +1100 Subject: [PATCH 41/58] Update bytecode --- .../ETHClient/WrappedToken.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index e18bfb8f50..c563293601 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -13,8 +13,8 @@ namespace Stratis.Bitcoin.Features.Interop.ETHClient2 { public class WrappedTokenDeployment : ContractDeploymentMessage { - public static string BYTECODE = // TODO - "0x60806040523480156200001157600080fd5b50604051620016ba380380620016ba833981810160405260208110156200003757600080fd5b5051604080518082018252600c81526b0aee4c2e0e0cac8a6e8e4c2f60a31b6020828101918252835180850190945260068452650aea6a8a482b60d31b9084015281519192916200008b91600391620002a0565b508051620000a1906004906020840190620002a0565b50506005805460ff19166012179055506000620000bd62000126565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506200011f33826200012a565b506200033c565b3390565b6001600160a01b03821662000186576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620001946000838362000239565b620001b0816002546200023e60201b62000ba61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001e391839062000ba66200023e821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000299576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002e357805160ff191683800117855562000313565b8280016001018555821562000313579182015b8281111562000313578251825591602001919060010190620002f6565b506200032192915062000325565b5090565b5b8082111562000321576000815560010162000326565b61136e806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637641e6f3116100a2578063979430d211610071578063979430d2146103cd578063a457c2d714610488578063a9059cbb146104b4578063dd62ed3e146104e0578063f2fde38b1461050e57610116565b80637641e6f3146102ce5780637e0518671461037b5780638da5cb5b146103a157806395d89b41146103c557610116565b8063313ce567116100e9578063313ce56714610228578063395093511461024657806340c10f191461027257806370a08231146102a0578063715018a6146102c657610116565b806306fdde031461011b578063095ea7b31461019857806318160ddd146101d857806323b872dd146101f2575b600080fd5b610123610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356105ca565b604080519115158252519081900360200190f35b6101e06105e7565b60408051918252519081900360200190f35b6101c46004803603606081101561020857600080fd5b506001600160a01b038135811691602081013590911690604001356105ed565b610230610674565b6040805160ff9092168252519081900360200190f35b6101c46004803603604081101561025c57600080fd5b506001600160a01b03813516906020013561067d565b61029e6004803603604081101561028857600080fd5b506001600160a01b0381351690602001356106cb565b005b6101e0600480360360208110156102b657600080fd5b50356001600160a01b0316610748565b61029e610763565b61029e600480360360408110156102e457600080fd5b8135919081019060408101602082013564010000000081111561030657600080fd5b82018360208201111561031857600080fd5b8035906020019184600183028401116401000000008311171561033a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610822945050505050565b6101236004803603602081101561039157600080fd5b50356001600160a01b0316610858565b6103a96108f3565b604080516001600160a01b039092168252519081900360200190f35b610123610907565b61029e600480360360608110156103e357600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561041357600080fd5b82018360208201111561042557600080fd5b8035906020019184600183028401116401000000008311171561044757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610968945050505050565b6101c46004803603604081101561049e57600080fd5b506001600160a01b0381351690602001356109e4565b6101c4600480360360408110156104ca57600080fd5b506001600160a01b038135169060200135610a4c565b6101e0600480360360408110156104f657600080fd5b506001600160a01b0381358116916020013516610a60565b61029e6004803603602081101561052457600080fd5b50356001600160a01b0316610a8b565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b820191906000526020600020905b8154815290600101906020018083116105a357829003601f168201915b5050505050905090565b60006105de6105d7610c07565b8484610c0b565b50600192915050565b60025490565b60006105fa848484610cf7565b61066a84610606610c07565b6106658560405180606001604052806028815260200161125e602891396001600160a01b038a16600090815260016020526040812090610644610c07565b6001600160a01b031681526020810191909152604001600020549190610e52565b610c0b565b5060019392505050565b60055460ff1690565b60006105de61068a610c07565b84610665856001600061069b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610ba6565b6106d3610c07565b60055461010090046001600160a01b0390811691161461073a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107448282610ee9565b5050565b6001600160a01b031660009081526020819052604090205490565b61076b610c07565b60055461010090046001600160a01b039081169116146107d2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b61083361082d610c07565b83610fd9565b336000908152600660209081526040909120825161085392840190611117565b505050565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156108eb5780601f106108c0576101008083540402835291602001916108eb565b820191906000526020600020905b8154815290600101906020018083116108ce57829003601f168201915b505050505081565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c05780601f10610595576101008083540402835291602001916105c0565b600061099f836040518060600160405280602481526020016112866024913961099887610993610c07565b610a60565b9190610e52565b90506109b3846109ad610c07565b83610c0b565b6109bd8484610fd9565b33600090815260066020908152604090912083516109dd92850190611117565b5050505050565b60006105de6109f1610c07565b84610665856040518060600160405280602581526020016113146025913960016000610a1b610c07565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610e52565b60006105de610a59610c07565b8484610cf7565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a93610c07565b60055461010090046001600160a01b03908116911614610afa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610b3f5760405162461bcd60e51b81526004018080602001828103825260268152602001806111f06026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015610c00576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610c505760405162461bcd60e51b81526004018080602001828103825260248152602001806112f06024913960400191505060405180910390fd5b6001600160a01b038216610c955760405162461bcd60e51b81526004018080602001828103825260228152602001806112166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610d3c5760405162461bcd60e51b81526004018080602001828103825260258152602001806112cb6025913960400191505060405180910390fd5b6001600160a01b038216610d815760405162461bcd60e51b81526004018080602001828103825260238152602001806111ab6023913960400191505060405180910390fd5b610d8c838383610853565b610dc981604051806060016040528060268152602001611238602691396001600160a01b0386166000908152602081905260409020549190610e52565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610df89082610ba6565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610ee15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ea6578181015183820152602001610e8e565b50505050905090810190601f168015610ed35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610f44576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610f5060008383610853565b600254610f5d9082610ba6565b6002556001600160a01b038216600090815260208190526040902054610f839082610ba6565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661101e5760405162461bcd60e51b81526004018080602001828103825260218152602001806112aa6021913960400191505060405180910390fd5b61102a82600083610853565b611067816040518060600160405280602281526020016111ce602291396001600160a01b0385166000908152602081905260409020549190610e52565b6001600160a01b03831660009081526020819052604090205560025461108d90826110d5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610c0083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e52565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061115857805160ff1916838001178555611185565b82800160010185558215611185579182015b8281111561118557825182559160200191906001019061116a565b50611191929150611195565b5090565b5b80821115611191576000815560010161119656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cad3aac9a515bf8c31e395c1cb60e9ec8ba2edb3e0e92408c5f7db093befc84664736f6c634300060c0033"; + public static string BYTECODE = + "0x60806040523480156200001157600080fd5b506040516200302338038062003023833981810160405260608110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b506040526020018051906020019092919050505082828160039080519060200190620001dc92919062000689565b508060049080519060200190620001f592919062000689565b506012600560006101000a81548160ff021916908360ff1602179055505050600062000226620002e060201b60201c565b905080600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620002d73382620002e860201b60201c565b50505062000738565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156200038c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b620003a060008383620004c660201b60201c565b620003bc81600254620005fb60201b620020ea1790919060201c565b6002819055506200041a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054620005fb60201b620020ea1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b620004de8383836200068460201b6200266d1760201c565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015620005835750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b620005f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686973206164647265737320697320626c61636b6c6973746564000000000081525060200191505060405180910390fd5b505050565b6000808284019050838110156200067a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620006cc57805160ff1916838001178555620006fd565b82800160010185558215620006fd579182015b82811115620006fc578251825591602001919060010190620006df565b5b5090506200070c919062000710565b5090565b6200073591905b808211156200073157600081600090555060010162000717565b5090565b90565b6128db80620007486000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063715018a6116100b8578063ba211db01161007c578063ba211db01461063c578063bd65278714610798578063dd62ed3e14610914578063f2fde38b1461098c578063f306f6cb146109d0578063ff89757014610b0457610137565b8063715018a6146104995780638da5cb5b146104a357806395d89b41146104ed578063a457c2d714610570578063a9059cbb146105d657610137565b8063313ce567116100ff578063313ce56714610325578063395093511461034957806340c10f19146103af5780634a49ac4c146103fd57806370a082311461044157610137565b806306fdde031461013c578063095ea7b3146101bf57806318160ddd146102255780631cdd3be31461024357806323b872dd1461029f575b600080fd5b610144610b7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1f565b604051808215151515815260200191505060405180910390f35b61022d610c3d565b6040518082815260200191505060405180910390f35b6102856004803603602081101561025957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c47565b604051808215151515815260200191505060405180910390f35b61030b600480360360608110156102b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c67565b604051808215151515815260200191505060405180910390f35b61032d610d40565b604051808260ff1660ff16815260200191505060405180910390f35b6103956004803603604081101561035f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d57565b604051808215151515815260200191505060405180910390f35b6103fb600480360360408110156103c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0a565b005b61043f6004803603602081101561041357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ee2565b005b6104836004803603602081101561045757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611007565b6040518082815260200191505060405180910390f35b6104a161104f565b005b6104ab6111da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f5611204565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053557808201518184015260208101905061051a565b50505050905090810190601f1680156105625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105bc6004803603604081101561058657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112a6565b604051808215151515815260200191505060405180910390f35b610622600480360360408110156105ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611373565b604051808215151515815260200191505060405180910390f35b6107966004803603606081101561065257600080fd5b81019080803590602001909291908035906020019064010000000081111561067957600080fd5b82018360208201111561068b57600080fd5b803590602001918460018302840111640100000000831117156106ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561071057600080fd5b82018360208201111561072257600080fd5b8035906020019184600183028401116401000000008311171561074457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611391565b005b610912600480360360808110156107ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156107f557600080fd5b82018360208201111561080757600080fd5b8035906020019184600183028401116401000000008311171561082957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561088c57600080fd5b82018360208201111561089e57600080fd5b803590602001918460018302840111640100000000831117156108c057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506114f4565b005b6109766004803603604081101561092a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116a5565b6040518082815260200191505060405180910390f35b6109ce600480360360208110156109a257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172c565b005b610a89600480360360208110156109e657600080fd5b8101908080359060200190640100000000811115610a0357600080fd5b820183602082011115610a1557600080fd5b80359060200191846001830284011164010000000083111715610a3757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061193c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ac9578082015181840152602081019050610aae565b50505050905090810190601f168015610af65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610b7b60048036036020811015610b1a57600080fd5b8101908080359060200190640100000000811115610b3757600080fd5b820183602082011115610b4957600080fd5b80359060200191846020830284011164010000000083111715610b6b57600080fd5b9091929391929390505050611a02565b005b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c155780601f10610bea57610100808354040283529160200191610c15565b820191906000526020600020905b815481529060010190602001808311610bf857829003601f168201915b5050505050905090565b6000610c33610c2c611b6a565b8484611b72565b6001905092915050565b6000600254905090565b60076020528060005260406000206000915054906101000a900460ff1681565b6000610c74848484611d69565b610d3584610c80611b6a565b610d30856040518060600160405280602881526020016127cb60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ce6611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b611b72565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610e00610d64611b6a565b84610dfb8560016000610d75611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b611b72565b6001905092915050565b610e12611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610ede8282612172565b5050565b610eea611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611057611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611119576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129c5780601f106112715761010080835404028352916020019161129c565b820191906000526020600020905b81548152906001019060200180831161127f57829003601f168201915b5050505050905090565b60006113696112b3611b6a565b846113648560405180606001604052806025815260200161288160259139600160006112dd611b6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b611b72565b6001905092915050565b6000611387611380611b6a565b8484611d69565b6001905092915050565b6113a261139c611b6a565b84612339565b60603382604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f200000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b602083106114395780518252602082019150602081019050602083039250611416565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050826006826040518082805190602001908083835b602083106114a75780518252602082019150602081019050602083039250611484565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902090805190602001906114ed929190612672565b5050505050565b6000611533846040518060600160405280602481526020016127f3602491396115248861151f611b6a565b6116a5565b61202a9092919063ffffffff16565b905061154785611541611b6a565b83611b72565b6115518585612339565b60603383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f200000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b602083106115e857805182526020820191506020810190506020830392506115c5565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050836006826040518082805190602001908083835b602083106116565780518252602082019150602081019050602083039250611633565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020908051906020019061169c929190612672565b50505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611734611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561187c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061275d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6006818051602081018201805184825260208301602085012081835280955050505050506000915090508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081565b611a0a611b6a565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611acc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b82829050811015611b6557600160076000858585818110611aec57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550806001019050611acf565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bf8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061285d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806127836022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611def576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806128386025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806127186023913960400191505060405180910390fd5b611e808383836124fd565b611eeb816040518060600160405280602681526020016127a5602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906120d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561209c578082015181840152602081019050612081565b50505050905090810190601f1680156120c95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b612221600083836124fd565b612236816002546120ea90919063ffffffff16565b60028190555061228d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ea90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156123bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806128176021913960400191505060405180910390fd5b6123cb826000836124fd565b6124368160405180606001604052806022815260200161273b602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061248d8160025461262390919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b61250883838361266d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156125ac5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61261e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686973206164647265737320697320626c61636b6c6973746564000000000081525060200191505060405180910390fd5b505050565b600061266583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061202a565b905092915050565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106126b357805160ff19168380011785556126e1565b828001600101855582156126e1579182015b828111156126e05782518255916020019190600101906126c5565b5b5090506126ee91906126f2565b5090565b61271491905b808211156127105760008160009055506001016126f8565b5090565b9056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208257b60e1e63956e9d349bc7d44d3b3eef8885b643e61c16bf7453108c360e3264736f6c63430006000033"; public WrappedTokenDeployment() : base(BYTECODE) { From 320e1c87cb1df708d9b35b0bed1925bc743cbff4 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:38:18 +1100 Subject: [PATCH 42/58] Update WrappedTokenDeployment --- .../ETHClient/WrappedToken.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index c563293601..a6053c03cb 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -20,8 +20,14 @@ public WrappedTokenDeployment() : base(BYTECODE) { } - [Parameter("uint256", "totalSupply")] - public BigInteger TotalSupply { get; set; } + [Parameter("string", "tokenName")] + public string TokenName { get; set; } + + [Parameter("string", "tokenSymbol")] + public string TokenSymbol { get; set; } + + [Parameter("uint256", "initialSupply")] + public BigInteger InitialSupply { get; set; } } [Function("balanceOf", "uint256")] From 1c39f6f9336a3d7f80ae1212f84c117e87cf4118 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:39:45 +1100 Subject: [PATCH 43/58] Fix --- src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index a6053c03cb..ceb38e14dc 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -115,7 +115,7 @@ public static async Task DeployContractAsync(Web3 web3, BigInteger total { var deploymentMessage = new WrappedTokenDeployment() { - TotalSupply = totalSupply + InitialSupply = totalSupply }; IContractDeploymentTransactionHandler deploymentHandler = web3.Eth.GetContractDeploymentHandler(); From 938cdb05480bf8e482927baae13c5b345e336623 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Fri, 20 Jan 2023 19:46:14 +1100 Subject: [PATCH 44/58] Add helper classes --- .../ETHClient/WrappedToken.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs index ceb38e14dc..f728f8f321 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.cs @@ -109,6 +109,20 @@ public class BurnFunction : FunctionMessage public string BurnId { get; set; } } + [Function("addToBlackList")] + public class AddToBlackListFunction : FunctionMessage + { + [Parameter("address[]", "addresses", 1)] + public string Addresses { get; set; } + } + + [Function("removeFromBlackList")] + public class RemoveFromBlackListFunction : FunctionMessage + { + [Parameter("address", "account", 1)] + public string Address { get; set; } + } + public class WrappedToken { public static async Task DeployContractAsync(Web3 web3, BigInteger totalSupply) From 2a69ad04f1fd05b2c3534accd6251d55d6c2dcf3 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Mon, 4 Sep 2023 16:15:35 +1000 Subject: [PATCH 45/58] Move contract to correct folder --- .../ETHClient/ContractSource/WrappedToken.sol | 104 ++++++++++-------- .../ETHClient/WrappedToken.sol | 98 ----------------- 2 files changed, 58 insertions(+), 144 deletions(-) delete mode 100644 src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 8227ef5531..6554ce0011 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -1,86 +1,98 @@ -// contracts/WrappedToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; +// Importing dependencies import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/cryptography/ECDSA.sol"; contract WrappedToken is ERC20, Ownable { mapping (string => string) public withdrawalAddresses; - mapping (address => bool) public _isBlacklisted; + mapping (address => bool) public isBlacklisted; + // Constructor initializes the ERC20 token constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { _mint(msg.sender, initialSupply); } - /** - * @dev Creates `amount` new tokens and assigns them to `account`. - * - * See {ERC20-_mint}. - */ + // Allows only the owner to mint new tokens function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } - /** - * @dev Destroys `amount` tokens from the caller. - * - * See {ERC20-_burn}. - */ + // Allows users to burn tokens and specify a withdrawal address function burn(uint256 amount, string memory tokenAddress, string memory burnId) public { - _burn(_msgSender(), amount); - - // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. - // Currently it is only possible to assign a single address here, so if multiple recipients are required - // the burner will have to wait until each burn is processed before proceeding with the next. + _burn(msg.sender, amount); string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); withdrawalAddresses[key] = tokenAddress; } - /** - * @dev Destroys `amount` tokens from `account`, deducting from the caller's - * allowance. - * - * See {ERC20-_burn} and {ERC20-allowance}. - * - * Requirements: - * - * - the caller must have allowance for ``accounts``'s tokens of at least - * `amount`. - */ + // Allows users to burn tokens from an approved address function burnFrom(address account, uint256 amount, string memory tokenAddress, string memory burnId) public { - uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); - - _approve(account, _msgSender(), decreasedAllowance); + uint256 decreasedAllowance = allowance(account, msg.sender).sub(amount, "ERC20: burn amount exceeds allowance"); + _approve(account, msg.sender, decreasedAllowance); _burn(account, amount); - - // When the tokens are burnt we need to know where to credit the equivalent value on the Stratis chain. - // Currently it is only possible to assign a single address here, so if multiple recipients are required - // the burner will have to wait until each burn is processed before proceeding with the next. string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); withdrawalAddresses[key] = tokenAddress; } + // Allows the owner to add addresses to the blacklist function addToBlackList(address[] calldata addresses) external onlyOwner { - for (uint256 i; i < addresses.length; ++i) { - _isBlacklisted[addresses[i]] = true; + for (uint256 i = 0; i < addresses.length; ++i) { + isBlacklisted[addresses[i]] = true; } } + // Allows the owner to remove addresses from the blacklist function removeFromBlackList(address account) external onlyOwner { - _isBlacklisted[account] = false; + isBlacklisted[account] = false; } - /** - * @dev See {ERC20-_beforeTokenTransfer}. - * - * Requirements: - * - * - the addresses must not be blacklisted. - */ + // Checks if the address is blacklisted before any token transfer function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); + require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); + } + + // Perform a cross-chain transfer using delegated transfer with metadata + function delegatedTransferForNetwork( + uint128 uniqueNumber, + string memory token, + address fromAddr, + address toAddr, + string memory targetNetwork, + string memory targetAddress, + string memory metadata, + bytes memory userSignature, + uint32 amount, + uint8 amountCents, + uint32 fee, + uint8 feeCents, + bytes memory signature + ) public { + bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); + bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); + bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); + address recoveredAddress = ECDSA.recover(eip712DataHash, signature); + require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); + // Convert amounts to satoshis. + uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; + uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; + _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); + _transfer(fromAddr, interflux, redemptionAmount + feeAmount); + emit CrossChainTransferLog(targetAddress, targetNetwork); + emit MetadataLog(metadata); + } + + // Event definitions + event CrossChainTransferLog(string account, string network); + event MetadataLog(string metadata); + + // Ethereum Interflux address variable + address public interflux; - require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted"); + // Method to update the Ethereum Interflux address + function setInterflux(address newAddress) public onlyOwner { + interflux = newAddress; } } diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol deleted file mode 100644 index 6554ce0011..0000000000 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/WrappedToken.sol +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; - -// Importing dependencies -import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; -import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; -import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/cryptography/ECDSA.sol"; - -contract WrappedToken is ERC20, Ownable { - mapping (string => string) public withdrawalAddresses; - mapping (address => bool) public isBlacklisted; - - // Constructor initializes the ERC20 token - constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply) public ERC20(tokenName, tokenSymbol) { - _mint(msg.sender, initialSupply); - } - - // Allows only the owner to mint new tokens - function mint(address account, uint256 amount) public onlyOwner { - _mint(account, amount); - } - - // Allows users to burn tokens and specify a withdrawal address - function burn(uint256 amount, string memory tokenAddress, string memory burnId) public { - _burn(msg.sender, amount); - string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); - withdrawalAddresses[key] = tokenAddress; - } - - // Allows users to burn tokens from an approved address - function burnFrom(address account, uint256 amount, string memory tokenAddress, string memory burnId) public { - uint256 decreasedAllowance = allowance(account, msg.sender).sub(amount, "ERC20: burn amount exceeds allowance"); - _approve(account, msg.sender, decreasedAllowance); - _burn(account, amount); - string memory key = string(abi.encodePacked(msg.sender, " ", burnId)); - withdrawalAddresses[key] = tokenAddress; - } - - // Allows the owner to add addresses to the blacklist - function addToBlackList(address[] calldata addresses) external onlyOwner { - for (uint256 i = 0; i < addresses.length; ++i) { - isBlacklisted[addresses[i]] = true; - } - } - - // Allows the owner to remove addresses from the blacklist - function removeFromBlackList(address account) external onlyOwner { - isBlacklisted[account] = false; - } - - // Checks if the address is blacklisted before any token transfer - function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { - super._beforeTokenTransfer(from, to, amount); - require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); - } - - // Perform a cross-chain transfer using delegated transfer with metadata - function delegatedTransferForNetwork( - uint128 uniqueNumber, - string memory token, - address fromAddr, - address toAddr, - string memory targetNetwork, - string memory targetAddress, - string memory metadata, - bytes memory userSignature, - uint32 amount, - uint8 amountCents, - uint32 fee, - uint8 feeCents, - bytes memory signature - ) public { - bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); - bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); - bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); - address recoveredAddress = ECDSA.recover(eip712DataHash, signature); - require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); - // Convert amounts to satoshis. - uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; - uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; - _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); - _transfer(fromAddr, interflux, redemptionAmount + feeAmount); - emit CrossChainTransferLog(targetAddress, targetNetwork); - emit MetadataLog(metadata); - } - - // Event definitions - event CrossChainTransferLog(string account, string network); - event MetadataLog(string metadata); - - // Ethereum Interflux address variable - address public interflux; - - // Method to update the Ethereum Interflux address - function setInterflux(address newAddress) public onlyOwner { - interflux = newAddress; - } -} From cff1217806534a092719e3f932fc04321e77ae7d Mon Sep 17 00:00:00 2001 From: quantumagi Date: Mon, 4 Sep 2023 16:18:31 +1000 Subject: [PATCH 46/58] Fix rebase --- src/Stratis.Bitcoin/Properties/AssemblyInfo.cs | 4 ++-- src/Stratis.Bitcoin/Stratis.Bitcoin.csproj | 2 +- .../Stratis.Features.FederatedPeg.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index 40e160b72e..bb3b89b91b 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.2")] -[assembly: AssemblyFileVersion("1.4.0.2")] +[assembly: AssemblyVersion("1.4.0.7")] +[assembly: AssemblyFileVersion("1.4.0.7")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index 253a695684..4488a76c77 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.4.0.2-rc + 1.4.0.7 False ..\Stratis.ruleset Stratis Group Ltd. diff --git a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj index ed01346e8b..1a87992a65 100644 --- a/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj +++ b/src/Stratis.Features.FederatedPeg/Stratis.Features.FederatedPeg.csproj @@ -12,7 +12,7 @@ Full ..\None.ruleset Stratis Group Ltd. - 4.0.10.0 + 4.0.11.0 From 2521d06998df2d6e215856dd96df19b9f77cc6ff Mon Sep 17 00:00:00 2001 From: quantumagi Date: Mon, 4 Sep 2023 16:37:47 +1000 Subject: [PATCH 47/58] Add require and comments --- .../ETHClient/ContractSource/WrappedToken.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 6554ce0011..450b87aa1b 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -70,11 +70,14 @@ contract WrappedToken is ERC20, Ownable { uint8 feeCents, bytes memory signature ) public { + require(toAddr == interflux, "Must be a transfer to interflux"); bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); + // The userSignature is not evaluated here. + // It will be used to determine the Cirrus identity later in the process. // Convert amounts to satoshis. uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; From 6314e73631ee142b32362da43b4161588cf53267 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Mon, 4 Sep 2023 17:17:38 +1000 Subject: [PATCH 48/58] Add TODO --- .../ETHClient/ContractSource/WrappedToken.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 450b87aa1b..f67998da7f 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -71,6 +71,7 @@ contract WrappedToken is ERC20, Ownable { bytes memory signature ) public { require(toAddr == interflux, "Must be a transfer to interflux"); + // TODO: Prevent this method from being called with the same "uniqueNumber" twice. bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); From b86f39d5ab7bfd8d749c0698b24a6c72bb113e91 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Mon, 4 Sep 2023 17:32:35 +1000 Subject: [PATCH 49/58] The user signature is not required in the contract --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index f67998da7f..a892592887 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -63,7 +63,6 @@ contract WrappedToken is ERC20, Ownable { string memory targetNetwork, string memory targetAddress, string memory metadata, - bytes memory userSignature, uint32 amount, uint8 amountCents, uint32 fee, @@ -77,9 +76,6 @@ contract WrappedToken is ERC20, Ownable { bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); - // The userSignature is not evaluated here. - // It will be used to determine the Cirrus identity later in the process. - // Convert amounts to satoshis. uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); From 0f6355a31557fba5fac69bc6f42270600490f8f1 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Tue, 5 Sep 2023 16:58:20 +1000 Subject: [PATCH 50/58] Implement replay check --- .../ETHClient/ContractSource/WrappedToken.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index a892592887..2bfdbad177 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -8,6 +8,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr contract WrappedToken is ERC20, Ownable { mapping (string => string) public withdrawalAddresses; + mapping (uint128 => bool) public uniqueNumberUsed; mapping (address => bool) public isBlacklisted; // Constructor initializes the ERC20 token @@ -69,13 +70,14 @@ contract WrappedToken is ERC20, Ownable { uint8 feeCents, bytes memory signature ) public { + require(!uniqueNumberUsed[uniqueNumber], "Unique number already used"); + uniqueNumberUsed[uniqueNumber] = true; require(toAddr == interflux, "Must be a transfer to interflux"); - // TODO: Prevent this method from being called with the same "uniqueNumber" twice. bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); - require(fromAddr == recoveredAddress, "The 'from' address is not the signer"); + require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); From c649116d182faebfdb296b9a01f8b5ac0eb1eb0d Mon Sep 17 00:00:00 2001 From: quantumagi Date: Wed, 6 Sep 2023 17:14:22 +1000 Subject: [PATCH 51/58] Add fee log --- .../ETHClient/ContractSource/WrappedToken.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 2bfdbad177..f2ce546232 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -78,17 +78,19 @@ contract WrappedToken is ERC20, Ownable { bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); - uint256 redemptionAmount = (uint256(amount) * 100 + amountCents) * 1000000; + uint256 baseAmount = (uint256(amount) * 100 + amountCents) * 1000000; uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; - _beforeTokenTransfer(fromAddr, interflux, redemptionAmount + feeAmount); - _transfer(fromAddr, interflux, redemptionAmount + feeAmount); + _beforeTokenTransfer(fromAddr, interflux, baseAmount + feeAmount); + _transfer(fromAddr, interflux, baseAmount + feeAmount); emit CrossChainTransferLog(targetAddress, targetNetwork); emit MetadataLog(metadata); + emit FeeLog(feeAmount); } // Event definitions event CrossChainTransferLog(string account, string network); event MetadataLog(string metadata); + event FeeLog(uint256 feeAmount); // Ethereum Interflux address variable address public interflux; From 7032879d467e8ec90551ad91e009800fcc47c5c5 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Wed, 6 Sep 2023 17:22:48 +1000 Subject: [PATCH 52/58] Calculate decimalsFactor --- .../ETHClient/ContractSource/WrappedToken.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index f2ce546232..fae0cb0f98 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -78,8 +78,9 @@ contract WrappedToken is ERC20, Ownable { bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); - uint256 baseAmount = (uint256(amount) * 100 + amountCents) * 1000000; - uint256 feeAmount = (uint256(fee) * 100 + feeCents) * 1000000; + uint256 decimalsFactor = 10 ** uint256(decimals); + uint256 baseAmount = amount * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); + uint256 feeAmount = fee * decimalsFactor + uint256(feeCents) * (decimalsFactor / 100); _beforeTokenTransfer(fromAddr, interflux, baseAmount + feeAmount); _transfer(fromAddr, interflux, baseAmount + feeAmount); emit CrossChainTransferLog(targetAddress, targetNetwork); From 70dd28b6a4db8e0d1729325971ccac6998fd22e1 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Wed, 6 Sep 2023 17:34:27 +1000 Subject: [PATCH 53/58] Cast amounts --- .../ETHClient/ContractSource/WrappedToken.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index fae0cb0f98..8daf7eecc6 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -79,8 +79,8 @@ contract WrappedToken is ERC20, Ownable { address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); uint256 decimalsFactor = 10 ** uint256(decimals); - uint256 baseAmount = amount * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); - uint256 feeAmount = fee * decimalsFactor + uint256(feeCents) * (decimalsFactor / 100); + uint256 baseAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); + uint256 feeAmount = uint256(fee) * decimalsFactor + uint256(feeCents) * (decimalsFactor / 100); _beforeTokenTransfer(fromAddr, interflux, baseAmount + feeAmount); _transfer(fromAddr, interflux, baseAmount + feeAmount); emit CrossChainTransferLog(targetAddress, targetNetwork); From e58bb5e961a6ec784b2c59dd9b60cf64d59958fd Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 7 Sep 2023 18:32:33 +1000 Subject: [PATCH 54/58] Refactor decimalsFactor --- .../ETHClient/ContractSource/WrappedToken.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 8daf7eecc6..bb8885deee 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -78,7 +78,7 @@ contract WrappedToken is ERC20, Ownable { bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); - uint256 decimalsFactor = 10 ** uint256(decimals); + uint256 decimalsFactor = uint256(10) ** decimals; uint256 baseAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); uint256 feeAmount = uint256(fee) * decimalsFactor + uint256(feeCents) * (decimalsFactor / 100); _beforeTokenTransfer(fromAddr, interflux, baseAmount + feeAmount); From dcc237deb7d9e3e2b5264bd03aaa5ec4c822dc97 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Wed, 13 Sep 2023 16:35:48 +1000 Subject: [PATCH 55/58] Remove fee and toaddr --- .../ETHClient/ContractSource/WrappedToken.sol | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index bb8885deee..fa194f020d 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -60,38 +60,31 @@ contract WrappedToken is ERC20, Ownable { uint128 uniqueNumber, string memory token, address fromAddr, - address toAddr, string memory targetNetwork, string memory targetAddress, string memory metadata, uint32 amount, uint8 amountCents, - uint32 fee, - uint8 feeCents, bytes memory signature ) public { require(!uniqueNumberUsed[uniqueNumber], "Unique number already used"); uniqueNumberUsed[uniqueNumber] = true; - require(toAddr == interflux, "Must be a transfer to interflux"); bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); - bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, toAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents, fee, feeCents)); + bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents)); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); uint256 decimalsFactor = uint256(10) ** decimals; - uint256 baseAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); - uint256 feeAmount = uint256(fee) * decimalsFactor + uint256(feeCents) * (decimalsFactor / 100); - _beforeTokenTransfer(fromAddr, interflux, baseAmount + feeAmount); - _transfer(fromAddr, interflux, baseAmount + feeAmount); + uint256 transferAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); + _beforeTokenTransfer(fromAddr, interflux, transferAmount); + _transfer(fromAddr, interflux, transferAmount); emit CrossChainTransferLog(targetAddress, targetNetwork); emit MetadataLog(metadata); - emit FeeLog(feeAmount); } // Event definitions event CrossChainTransferLog(string account, string network); event MetadataLog(string metadata); - event FeeLog(uint256 feeAmount); // Ethereum Interflux address variable address public interflux; From f97e1aedcdd57dae9f1fc04ffb1a821024a40e95 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 14 Sep 2023 16:19:18 +1000 Subject: [PATCH 56/58] Add transferForNetwork method --- .../ETHClient/ContractSource/WrappedToken.sol | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index fa194f020d..09f0d8460c 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -54,11 +54,24 @@ contract WrappedToken is ERC20, Ownable { super._beforeTokenTransfer(from, to, amount); require(!isBlacklisted[from] && !isBlacklisted[to], "This address is blacklisted"); } + + // Perform a cross-chain transfer using delegated transfer with metadata + function transferForNetwork( + address fromAddr, + string memory targetNetwork, + string memory targetAddress, + string memory metadata, + uint256 transferAmount + ) public { + _beforeTokenTransfer(fromAddr, interflux, transferAmount); + _transfer(fromAddr, interflux, transferAmount); + emit CrossChainTransferLog(targetAddress, targetNetwork); + emit MetadataLog(metadata); + } // Perform a cross-chain transfer using delegated transfer with metadata function delegatedTransferForNetwork( uint128 uniqueNumber, - string memory token, address fromAddr, string memory targetNetwork, string memory targetAddress, @@ -69,17 +82,16 @@ contract WrappedToken is ERC20, Ownable { ) public { require(!uniqueNumberUsed[uniqueNumber], "Unique number already used"); uniqueNumberUsed[uniqueNumber] = true; + string token = symbol(); bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents)); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); - uint256 decimalsFactor = uint256(10) ** decimals; + uint256 decimalsFactor = uint256(10) ** decimals(); uint256 transferAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); - _beforeTokenTransfer(fromAddr, interflux, transferAmount); - _transfer(fromAddr, interflux, transferAmount); - emit CrossChainTransferLog(targetAddress, targetNetwork); - emit MetadataLog(metadata); + + transferForNetwork(fromAddr, targetNetwork, targetAddress, metadata, transferAmount); } // Event definitions From 49b02dce60c2d44414f4baf726a09bf2bfca98d4 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 14 Sep 2023 17:02:22 +1000 Subject: [PATCH 57/58] Fix compile errors and add constants and private methods --- .../ETHClient/ContractSource/WrappedToken.sol | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 09f0d8460c..5202139734 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -7,6 +7,9 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contr import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/cryptography/ECDSA.sol"; contract WrappedToken is ERC20, Ownable { + string public constant CONTRACT_NAME = "WrappedToken"; + string public constant CONTRACT_VERSION = "v1"; + mapping (string => string) public withdrawalAddresses; mapping (uint128 => bool) public uniqueNumberUsed; mapping (address => bool) public isBlacklisted; @@ -69,6 +72,15 @@ contract WrappedToken is ERC20, Ownable { emit MetadataLog(metadata); } + function _getDomainSeparator() internal view returns(bytes32 domainSeparator) { + uint chainId; + assembly { + chainId := chainid() + } + + return keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked(CONTRACT_NAME)), keccak256(abi.encodePacked(CONTRACT_VERSION)), chainId, address(this))); + } + // Perform a cross-chain transfer using delegated transfer with metadata function delegatedTransferForNetwork( uint128 uniqueNumber, @@ -79,12 +91,12 @@ contract WrappedToken is ERC20, Ownable { uint32 amount, uint8 amountCents, bytes memory signature - ) public { + ) public { require(!uniqueNumberUsed[uniqueNumber], "Unique number already used"); uniqueNumberUsed[uniqueNumber] = true; - string token = symbol(); - bytes32 domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked("WrappedToken")), keccak256(abi.encodePacked("v1")), block.chainid, address(this))); + string memory token = symbol(); bytes32 dataHash = keccak256(abi.encode(uniqueNumber, keccak256(bytes(token)), fromAddr, keccak256(bytes(targetNetwork)), keccak256(bytes(targetAddress)), keccak256(bytes(metadata)), amount, amountCents)); + bytes32 domainSeparator = _getDomainSeparator(); bytes32 eip712DataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, dataHash)); address recoveredAddress = ECDSA.recover(eip712DataHash, signature); require(fromAddr == recoveredAddress, "The 'fromAddr' is not the signer"); From feb98123548ca820a6d330cad4e30014dec6d1cf Mon Sep 17 00:00:00 2001 From: quantumagi Date: Thu, 14 Sep 2023 17:13:03 +1000 Subject: [PATCH 58/58] Refactor --- .../ETHClient/ContractSource/WrappedToken.sol | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol index 5202139734..bb0f32447c 100644 --- a/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol +++ b/src/Stratis.Bitcoin.Features.Interop/ETHClient/ContractSource/WrappedToken.sol @@ -59,26 +59,26 @@ contract WrappedToken is ERC20, Ownable { } // Perform a cross-chain transfer using delegated transfer with metadata - function transferForNetwork( + function _transferForNetwork( address fromAddr, string memory targetNetwork, string memory targetAddress, string memory metadata, uint256 transferAmount - ) public { + ) internal { _beforeTokenTransfer(fromAddr, interflux, transferAmount); _transfer(fromAddr, interflux, transferAmount); emit CrossChainTransferLog(targetAddress, targetNetwork); emit MetadataLog(metadata); } - function _getDomainSeparator() internal view returns(bytes32 domainSeparator) { - uint chainId; - assembly { - chainId := chainid() - } - - return keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked(CONTRACT_NAME)), keccak256(abi.encodePacked(CONTRACT_VERSION)), chainId, address(this))); + function transferForNetwork( + string memory targetNetwork, + string memory targetAddress, + string memory metadata, + uint256 transferAmount + ) public { + _transferForNetwork(msg.sender, targetNetwork, targetAddress, metadata, transferAmount); } // Perform a cross-chain transfer using delegated transfer with metadata @@ -103,7 +103,7 @@ contract WrappedToken is ERC20, Ownable { uint256 decimalsFactor = uint256(10) ** decimals(); uint256 transferAmount = uint256(amount) * decimalsFactor + uint256(amountCents) * (decimalsFactor / 100); - transferForNetwork(fromAddr, targetNetwork, targetAddress, metadata, transferAmount); + _transferForNetwork(fromAddr, targetNetwork, targetAddress, metadata, transferAmount); } // Event definitions @@ -117,4 +117,13 @@ contract WrappedToken is ERC20, Ownable { function setInterflux(address newAddress) public onlyOwner { interflux = newAddress; } + + function _getDomainSeparator() internal view returns(bytes32 domainSeparator) { + uint chainId; + assembly { + chainId := chainid() + } + + return keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(abi.encodePacked(CONTRACT_NAME)), keccak256(abi.encodePacked(CONTRACT_VERSION)), chainId, address(this))); + } }