Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d5ef1dc
Initial commit for bridge oracle client.
eanzhao Aug 11, 2022
712a869
feat: add config
Aug 17, 2022
4433c8a
feat: add bridge contract service
Aug 17, 2022
67a760a
refactor: Update .proto file
ssun0121 Aug 17, 2022
0a978e6
feat: add bridge service
Aug 17, 2022
edef79f
feat: store signatures in Redis
Aug 18, 2022
8bb7710
feat: add transmit queue
Aug 18, 2022
9868f07
feat: update processor.
ssun0121 Aug 19, 2022
e7165ba
feat: add event context
Aug 19, 2022
825138a
feat: add client alias for contract service
Aug 19, 2022
8e051e1
feat: add chainId for queue
Aug 19, 2022
72c4d83
feat: add target chain id for birdge contract
Aug 19, 2022
4a21110
feat: add chain id for provider
Aug 19, 2022
9cb8d65
feat: update processor.
ssun0121 Aug 19, 2022
8c87c70
feat: update bridge proto file.
ssun0121 Aug 19, 2022
072c2b1
feat: add price sync worker
Aug 22, 2022
87fe4db
feat: add multi chain contract address
Aug 23, 2022
a074691
feat: update others to AElf processors.
ssun0121 Aug 23, 2022
63bf6cf
feat: send transmit by lib
Aug 23, 2022
da54f1e
Merge branch 'feature/bridge' of github.com:PortAllProject/port-all-c…
Aug 23, 2022
c8731b6
fix: fix parameter
Aug 23, 2022
9f19391
feat: improve config
Aug 24, 2022
b4c99e7
fix: fix price sync
Aug 24, 2022
244db55
fix: fix bridge in and out
Aug 24, 2022
10bb07c
feat: chain id mapping
Aug 25, 2022
4695001
fix: chain id mapping
Aug 25, 2022
1928172
feat: improve chain id
Aug 25, 2022
09a2963
feat: add swap hash id for bridge contract
Aug 25, 2022
917f8c5
feat: add processors.
ssun0121 Aug 25, 2022
9b224e9
Merge remote-tracking branch 'origin/feature/bridge' into feature/bridge
ssun0121 Aug 25, 2022
7bf1076
feat: add ethereum swapHashId
ssun0121 Aug 25, 2022
c97d95f
fix: fix chain id
Aug 25, 2022
e0f3c4c
feat: add log
Aug 25, 2022
290bfde
fix: fix bridge contract dto
Aug 25, 2022
fd32ee3
fix: fix config name
Aug 26, 2022
f42a6dc
fix: fix deadlock
Aug 26, 2022
f9cf0d1
fix: fix options
Aug 29, 2022
60fd0d9
feat: update processor.
ssun0121 Aug 29, 2022
619801c
fix: remove some useless info.
ssun0121 Aug 30, 2022
c46f696
fix: fix get receiptInfo amount .
ssun0121 Aug 30, 2022
45777d2
feat: update abi
Aug 30, 2022
bcd2f31
feat: update abi
Aug 30, 2022
30c1c4b
fix: improve gas fee
Sep 1, 2022
6c62863
fix: get token index out of range.
ssun0121 Sep 2, 2022
2d1cdcb
fix: add log info.
ssun0121 Sep 5, 2022
5f709a2
fix: merkle tree last leaf index.
ssun0121 Sep 5, 2022
e830b51
appsettings.json
ssun0121 Sep 5, 2022
62afc93
fix: space is null - last leaf index = -1
ssun0121 Sep 5, 2022
3c76f88
fix: add from chainId when getting ethereum swapId.
ssun0121 Sep 5, 2022
329714c
fix: add transmit log.
ssun0121 Sep 5, 2022
db17a7f
feat: add resend api
Sep 5, 2022
a8a3483
Merge branch 'feature/bridge' of github.com:PortAllProject/port-all-c…
Sep 5, 2022
e26a912
fix: fix query receipt index.
ssun0121 Sep 13, 2022
948d863
fix: check transmit transaction
Sep 15, 2022
2b75124
feat: add log
Sep 16, 2022
7adf104
feat: improve config
Sep 19, 2022
474ce33
feat: adjust timer
Sep 19, 2022
e120449
fix: test gas fee
Sep 20, 2022
5a322b9
fix: change gas fee
Sep 21, 2022
08e0ac5
feat: improve send transmit
Sep 21, 2022
d68b38e
fix: fix request times
Sep 23, 2022
e8bfc0c
fix: add logs and fault handling
Sep 27, 2022
748a5b4
fix: test invalid sender
Sep 27, 2022
691fce4
fix: remove account cache
Sep 29, 2022
23ae5e9
fix: test getSendReceiptInfos input.
ssun0121 Oct 11, 2022
6256514
fix: add log about token index.
ssun0121 Oct 11, 2022
46a687d
fix: add log.
ssun0121 Oct 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,6 @@ aelf.js
Contracts.manifest

# Contract patcher dlls
chain/scripts/patcher/*
scripts/patcher/*
src/AElf.Boilerplate.Launcher/contracts/*
test/patched/*
115 changes: 95 additions & 20 deletions AElf.Contracts.PortAll.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Boilerplate.TestBase",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Oracle", "contract\AElf.Contracts.Oracle\AElf.Contracts.Oracle.csproj", "{AC06E580-EFC8-4D3F-BA4A-B2D2D1F65B9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AElf.Contracts.Oracle.Tests", "test\AElf.Contracts.Oracle.Tests\AElf.Contracts.Oracle.Tests.csproj", "{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Boilerplate.ContractPatcher", "src\AElf.Boilerplate.ContractPatcher\AElf.Boilerplate.ContractPatcher.csproj", "{DCC207EA-842A-4B54-858B-295CAA8947D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.OracleUser", "contract\AElf.Contracts.OracleUser\AElf.Contracts.OracleUser.csproj", "{1A8F790C-4172-426C-83E3-2B49589782AB}"
Expand Down Expand Up @@ -46,22 +44,45 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.TokenLockRec
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Lottery", "contract\AElf.Contracts.Lottery\AElf.Contracts.Lottery.csproj", "{BDB841AC-3230-4EBF-A735-EEF30CDE20ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Lottery.Tests", "test\AElf.Contracts.Lottery.Tests\AElf.Contracts.Lottery.Tests.csproj", "{073D711D-9F38-472D-ACE2-9830A222768C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenSwap", "src\AElf.TokenSwap\AElf.TokenSwap.csproj", "{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Bridge.Tests", "test\AElf.Contracts.Bridge.Tests\AElf.Contracts.Bridge.Tests.csproj", "{463F5276-2D88-4A66-AA45-688F1920E1D7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}"
ProjectSection(SolutionItems) = preProject
modules\AElf.Nethereum.Core\obj\Debug\net6.0\.NETCoreApp,Version = v6.0.AssemblyAttributes.cs = modules\AElf.Nethereum.Core\obj\Debug\net6.0\.NETCoreApp,Version=v6.0.AssemblyAttributes.cs
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client", "modules\AElf.Client\AElf.Client.csproj", "{45B743E6-3B58-4AFA-9782-EA67015C9CD3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Core", "modules\AElf.Client.Core\AElf.Client.Core.csproj", "{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Oracle", "modules\AElf.Client.Oracle\AElf.Client.Oracle.csproj", "{EA90104B-835D-4700-B0CD-93045173C033}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Protobuf", "modules\AElf.Client.Protobuf\AElf.Client.Protobuf.csproj", "{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Report", "modules\AElf.Client.Report\AElf.Client.Report.csproj", "{E4400680-1754-48A9-BEE9-8A6BC79302C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.MerkleTree", "modules\AElf.Client.MerkleTree\AElf.Client.MerkleTree.csproj", "{538194EF-9329-4C90-8BD9-0E6EFDFEF691}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Core", "modules\AElf.Nethereum.Core\AElf.Nethereum.Core.csproj", "{4175F31E-5ED6-4B67-973C-51B0C44BE74B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Bridge", "modules\AElf.Client.Bridge\AElf.Client.Bridge.csproj", "{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Bridge", "modules\AElf.Nethereum.Bridge\AElf.Nethereum.Bridge.csproj", "{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.BlockchainTransactionFee", "modules\AElf.BlockchainTransactionFee\AElf.BlockchainTransactionFee.csproj", "{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenPrice.Abstractions", "modules\AElf.TokenPrice.Abstractions\AElf.TokenPrice.Abstractions.csproj", "{F51259FD-7510-4166-8E96-C0C13DFA811F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenPrice.CoinGecko", "modules\AElf.TokenPrice.CoinGecko\AElf.TokenPrice.CoinGecko.csproj", "{94EB8357-3CE0-4750-A167-8BCF7740BFB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.PriceWorker", "src\AElf.PriceWorker\AElf.PriceWorker.csproj", "{63E22799-0213-42B3-A751-1592349180B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Release|Any CPU.Build.0 = Release|Any CPU
{9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -126,24 +147,67 @@ Global
{BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Release|Any CPU.Build.0 = Release|Any CPU
{073D711D-9F38-472D-ACE2-9830A222768C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{073D711D-9F38-472D-ACE2-9830A222768C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{073D711D-9F38-472D-ACE2-9830A222768C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{073D711D-9F38-472D-ACE2-9830A222768C}.Release|Any CPU.Build.0 = Release|Any CPU
{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Release|Any CPU.Build.0 = Release|Any CPU
{463F5276-2D88-4A66-AA45-688F1920E1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{463F5276-2D88-4A66-AA45-688F1920E1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{463F5276-2D88-4A66-AA45-688F1920E1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{463F5276-2D88-4A66-AA45-688F1920E1D7}.Release|Any CPU.Build.0 = Release|Any CPU
{45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Release|Any CPU.Build.0 = Release|Any CPU
{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Release|Any CPU.Build.0 = Release|Any CPU
{EA90104B-835D-4700-B0CD-93045173C033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA90104B-835D-4700-B0CD-93045173C033}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA90104B-835D-4700-B0CD-93045173C033}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA90104B-835D-4700-B0CD-93045173C033}.Release|Any CPU.Build.0 = Release|Any CPU
{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Release|Any CPU.Build.0 = Release|Any CPU
{E4400680-1754-48A9-BEE9-8A6BC79302C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4400680-1754-48A9-BEE9-8A6BC79302C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4400680-1754-48A9-BEE9-8A6BC79302C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4400680-1754-48A9-BEE9-8A6BC79302C2}.Release|Any CPU.Build.0 = Release|Any CPU
{538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Debug|Any CPU.Build.0 = Debug|Any CPU
{538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Release|Any CPU.ActiveCfg = Release|Any CPU
{538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Release|Any CPU.Build.0 = Release|Any CPU
{4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Release|Any CPU.Build.0 = Release|Any CPU
{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.Build.0 = Release|Any CPU
{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.Build.0 = Release|Any CPU
{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Release|Any CPU.Build.0 = Release|Any CPU
{F51259FD-7510-4166-8E96-C0C13DFA811F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F51259FD-7510-4166-8E96-C0C13DFA811F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F51259FD-7510-4166-8E96-C0C13DFA811F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F51259FD-7510-4166-8E96-C0C13DFA811F}.Release|Any CPU.Build.0 = Release|Any CPU
{94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Release|Any CPU.Build.0 = Release|Any CPU
{63E22799-0213-42B3-A751-1592349180B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63E22799-0213-42B3-A751-1592349180B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63E22799-0213-42B3-A751-1592349180B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63E22799-0213-42B3-A751-1592349180B9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3631B538-C617-4FCE-9C9B-1D1B5F290A7F} = {DBC47323-E6A2-42A2-A624-CE2EE6139567}
{AC06E580-EFC8-4D3F-BA4A-B2D2D1F65B9F} = {5C980166-C987-470D-AEE0-3858A170A903}
{F72731A8-5803-4362-834F-0C066E64D4CD} = {21D85A91-5BB8-4912-8107-49435A461AAC}
{DCC207EA-842A-4B54-858B-295CAA8947D5} = {21D85A91-5BB8-4912-8107-49435A461AAC}
Expand All @@ -160,9 +224,20 @@ Global
{4F30B2D8-432C-4686-81B5-9ADFE905B2B9} = {5C980166-C987-470D-AEE0-3858A170A903}
{B0145883-39B3-440E-9BA1-D80F13701E5C} = {5C980166-C987-470D-AEE0-3858A170A903}
{BDB841AC-3230-4EBF-A735-EEF30CDE20ED} = {5C980166-C987-470D-AEE0-3858A170A903}
{073D711D-9F38-472D-ACE2-9830A222768C} = {DBC47323-E6A2-42A2-A624-CE2EE6139567}
{AFFFAFFC-992F-4A88-95A8-C395D04B36D3} = {21D85A91-5BB8-4912-8107-49435A461AAC}
{463F5276-2D88-4A66-AA45-688F1920E1D7} = {DBC47323-E6A2-42A2-A624-CE2EE6139567}
{45B743E6-3B58-4AFA-9782-EA67015C9CD3} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{8E6296BA-D3A6-4C23-837C-8A40A6BE3822} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{EA90104B-835D-4700-B0CD-93045173C033} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{E4400680-1754-48A9-BEE9-8A6BC79302C2} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{538194EF-9329-4C90-8BD9-0E6EFDFEF691} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{4175F31E-5ED6-4B67-973C-51B0C44BE74B} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{1AC48421-CF85-44B9-B79A-6D41F8C09FF8} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{0D9CCDEA-1E0B-4428-8DA7-F040CD971816} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{F51259FD-7510-4166-8E96-C0C13DFA811F} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{94EB8357-3CE0-4750-A167-8BCF7740BFB2} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}
{63E22799-0213-42B3-A751-1592349180B9} = {21D85A91-5BB8-4912-8107-49435A461AAC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D7426B41-E959-40E4-9ED8-ED8D9C50F133}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.Caching" Version="5.2.2" />
<PackageReference Include="Volo.Abp.Core" Version="5.2.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Caching;
using Volo.Abp.Modularity;

namespace AElf.BlockchainTransactionFee
{
[DependsOn(typeof(AbpCachingModule))]
public class AElfBlockchainTransactionFeeModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<ChainExplorerApiOptions>(configuration.GetSection("ChainExplorerApi"));
context.Services.AddTransient<ApiClient>();
context.Services.AddTransient<IBlockchainTransactionFeeProvider, EthereumTransactionFeeProvider>();
context.Services.AddTransient<IBlockchainTransactionFeeProvider, BSCTransactionFeeProvider>();
}
}
}
32 changes: 32 additions & 0 deletions modules/AElf.BlockchainTransactionFee/ApiClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Net;
using System.Text.Json;
using Newtonsoft.Json;

namespace AElf.BlockchainTransactionFee;

public class ApiClient
{
private readonly HttpClient _httpClient;

public ApiClient()
{
_httpClient = new HttpClient();
}

public async Task<T> GetAsync<T>(string uri)
{
var response = await _httpClient.GetAsync(uri)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

var responseContent = await response.Content.ReadAsStringAsync();
try
{
return JsonConvert.DeserializeObject<T>(responseContent);
}
catch (Exception e)
{
throw new HttpRequestException(e.Message);
}
}
}
52 changes: 52 additions & 0 deletions modules/AElf.BlockchainTransactionFee/BSCTransactionFeeProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;

namespace AElf.BlockchainTransactionFee;

public class BSCTransactionFeeProvider : IBlockchainTransactionFeeProvider
{
public string BlockChain { get; } = "BSC";

private readonly ApiClient _apiClient;

private readonly ChainExplorerApiOptions _chainExplorerApiOptions;

public BSCTransactionFeeProvider(ApiClient apiClient,
IOptionsSnapshot<ChainExplorerApiOptions> blockchainExplorerApiOptions)
{
_apiClient = apiClient;
_chainExplorerApiOptions = blockchainExplorerApiOptions.Value;
}

public async Task<TransactionFeeDto> GetTransactionFee()
{
var result = await _apiClient.GetAsync<BSCApiResult<BSCGasTracker>>(
$"https://api.bscscan.com/api?module=gastracker&action=gasoracle&apikey={_chainExplorerApiOptions.ApiKeys[BlockChain]}");
if (result.Message != "OK")
{
throw new HttpRequestException($"BSC api failed: {result.Message}");
}

return new TransactionFeeDto
{
Symbol = "BNB",
Fee = decimal.Parse(result.Result.SafeGasPrice)
};
}
}

public class BSCApiResult<T>
{
public string Message { get; set; }

public T Result { get; set; }
}

public class BSCGasTracker
{
public string FastGasPrice { get; set; }
public string LastBlock { get; set; }
public string ProposeGasPrice { get; set; }
public string SafeGasPrice { get; set; }
public string UsdPrice { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace AElf.BlockchainTransactionFee;

public class ChainExplorerApiOptions
{
public Dictionary<string, string> ApiKeys { get; set; } = new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;

namespace AElf.BlockchainTransactionFee;

public class EthereumTransactionFeeProvider : IBlockchainTransactionFeeProvider
{
public string BlockChain { get; } = "Ethereum";

private readonly ApiClient _apiClient;

private readonly ChainExplorerApiOptions _chainExplorerApiOptions;

public EthereumTransactionFeeProvider(ApiClient apiClient,
IOptionsSnapshot<ChainExplorerApiOptions> blockchainExplorerApiOptions)
{
_apiClient = apiClient;
_chainExplorerApiOptions = blockchainExplorerApiOptions.Value;
}

public async Task<TransactionFeeDto> GetTransactionFee()
{
var result = await _apiClient.GetAsync<EthereumApiResult<EthereumGasTracker>>(
$"https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey={_chainExplorerApiOptions.ApiKeys[BlockChain]}");
if (result.Message != "OK")
{
throw new HttpRequestException($"Ethereum api failed: {result.Message}");
}

return new TransactionFeeDto
{
Symbol = "ETH",
Fee = decimal.Parse(result.Result.SafeGasPrice)
};
}
}

public class EthereumApiResult<T>
{
public string Message { get; set; }

public T Result { get; set; }
}

public class EthereumGasTracker
{
public string FastGasPrice { get; set; }
public string LastBlock { get; set; }
public string ProposeGasPrice { get; set; }
public string SafeGasPrice { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace AElf.BlockchainTransactionFee;

public interface IBlockchainTransactionFeeProvider
{
string BlockChain { get; }
Task<TransactionFeeDto> GetTransactionFee();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.Extensions.Caching.Distributed;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;

namespace AElf.BlockchainTransactionFee;

public interface IBlockchainTransactionFeeService
{
Task<TransactionFeeDto> GetTransactionFeeAsync(string chainName);
}

public class BlockchainTransactionFeeService : IBlockchainTransactionFeeService, ITransientDependency
{
private readonly IEnumerable<IBlockchainTransactionFeeProvider> _blockchainTransactionFeeProviders;

public BlockchainTransactionFeeService(
IEnumerable<IBlockchainTransactionFeeProvider> blockchainTransactionFeeProviders)
{
_blockchainTransactionFeeProviders = blockchainTransactionFeeProviders;
}

public async Task<TransactionFeeDto> GetTransactionFeeAsync(string chainName)
{
var provider = _blockchainTransactionFeeProviders.First(o => o.BlockChain == chainName);
var fee = await provider.GetTransactionFee();
return fee;
}
}


Loading