Skip to content

Commit 987ddb9

Browse files
committed
Fixing naming convention
1 parent 7c6437a commit 987ddb9

49 files changed

Lines changed: 328 additions & 359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
.idea
44
Plugins/packed
55
.vs/
6+
*.DotSettings
7+
*.DotSettings.user

BTCPayServer.Plugins.USDt.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution
3737
README.md = README.md
3838
.github\workflows\publish.yml = .github\workflows\publish.yml
3939
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
40+
.gitignore = .gitignore
4041
EndProjectSection
4142
EndProject
4243
Global

BTCPayServer.Plugins.USDt/BTCPayServer.Plugins.USDt.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@
6262
</ItemGroup>
6363

6464

65-
<ItemGroup>
66-
<Folder Include="Views\Shared\"/>
67-
</ItemGroup>
68-
69-
7065
<ItemGroup>
7166
<AdditionalFiles Include="Views\Shared\TronUSDtLike\StoreNavTronUSDtExtension.cshtml" />
7267
<AdditionalFiles Include="Views\Shared\TronUSDtLike\StoreWalletsNavTronUSDtExtension.cshtml" />

BTCPayServer.Plugins.USDt/Configuration/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ public static class Constants
66
public const string EthereumChainName = "ETHEREUM";
77
public const string USDtCurrency = "USDt";
88
public const string USDtCurrencyDisplayName = "USD\u20ae";
9+
public static string SepoliaChainName = "SEPOLIA";
910
}

BTCPayServer.Plugins.USDt/Configuration/Ethereum/EthErc20LikeConfigurationItem.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

BTCPayServer.Plugins.USDt/Configuration/Ethereum/EthUSDtLikeConfigurationItem.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace BTCPayServer.Plugins.USDt.Configuration.Ethereum;
44

5-
public record EthUSDtLikeConfigurationItem : USDtPluginConfigurationItem
5+
public record EthUSDtLikeConfigurationItem(string Chain) : USDtPluginConfigurationItem
66
{
7-
public override string Chain => Constants.EthereumChainName;
8-
97
public required Uri JsonRpcUri { get; init; }
108
public required string SmartContractAddress { get; init; }
9+
public override string Chain { get; } = Chain;
1110
public override required string Currency { get; init; }
1211
public required string DisplayName { get; init; }
1312
public required int Divisibility { get; init; }

BTCPayServer.Plugins.USDt/Configuration/USDtPluginConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ namespace BTCPayServer.Plugins.USDt.Configuration;
88
public class USDtPluginConfiguration
99
{
1010
public Dictionary<PaymentMethodId, TronUSDtLikeConfigurationItem> TronUSDtLikeConfigurationItems { get; init; } = new();
11-
public Dictionary<PaymentMethodId, EthErc20LikeConfigurationItem> EthereumErc20LikeConfigurationItems { get; init; } = new();
11+
public Dictionary<PaymentMethodId, EthUSDtLikeConfigurationItem> EthereumUSDtLikeConfigurationItems { get; init; } = new();
1212
}

BTCPayServer.Plugins.USDt/Controllers/UIEthErc20LikeServerController.cs renamed to BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeServerController.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
namespace BTCPayServer.Plugins.USDt.Controllers;
1818

19-
[Route("server/ethErc20like")]
19+
[Route("server/EthUSDtlike")]
2020
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
2121
[Authorize(Policy = Policies.CanModifyServerSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
22-
public class UIEthErc20LikeServerController(
22+
public class UIEthUSDtLikeServerController(
2323
IConfiguration configuration,
2424
ISettingsRepository settingsRepository,
2525
NBXplorerNetworkProvider nbXplorerNetworkProvider,
@@ -29,15 +29,16 @@ public class UIEthErc20LikeServerController(
2929
[HttpGet]
3030
public async Task<IActionResult> GetServerConfig()
3131
{
32-
var ethConfiguration = usdtPluginConfiguration.EthereumErc20LikeConfigurationItems.SingleOrDefault().Value;
32+
var ethConfiguration = usdtPluginConfiguration.EthereumUSDtLikeConfigurationItems.SingleOrDefault().Value;
3333
if (ethConfiguration is null)
3434
throw new InvalidOperationException();
3535

3636
var defaultConfiguration = USDtPlugin.GetEthUSDtLikeDefaultConfigurationItem(nbXplorerNetworkProvider, configuration);
3737
var serverSettings = await settingsRepository.GetSettingAsync<EthUSDtLikeServerSettings>(USDtPlugin.ServerSettingsKey(ethConfiguration));
3838

39-
var viewModel = new EthErc20LikeServerConfigViewModel
39+
var viewModel = new EthUSDtLikeServerConfigViewModel
4040
{
41+
DisplayName = ethConfiguration.DisplayName,
4142
DefaultSmartContractAddress = defaultConfiguration.SmartContractAddress,
4243
DefaultJsonRpcUri = defaultConfiguration.JsonRpcUri,
4344

@@ -49,9 +50,9 @@ public async Task<IActionResult> GetServerConfig()
4950

5051
[HttpPost]
5152
[ValidateAntiForgeryToken]
52-
public async Task<IActionResult> GetServerConfig(EthErc20LikeServerConfigViewModel viewModel)
53+
public async Task<IActionResult> GetServerConfig(EthUSDtLikeServerConfigViewModel viewModel)
5354
{
54-
var currentConfiguration = usdtPluginConfiguration.EthereumErc20LikeConfigurationItems.SingleOrDefault().Value;
55+
var currentConfiguration = usdtPluginConfiguration.EthereumUSDtLikeConfigurationItems.SingleOrDefault().Value;
5556
if (currentConfiguration is null)
5657
throw new InvalidOperationException();
5758

@@ -71,10 +72,10 @@ public async Task<IActionResult> GetServerConfig(EthErc20LikeServerConfigViewMod
7172

7273
await settingsRepository.UpdateSetting(serverSettings, USDtPlugin.ServerSettingsKey(currentConfiguration));
7374

74-
usdtPluginConfiguration.EthereumErc20LikeConfigurationItems[currentConfiguration.GetPaymentMethodId()] =
75+
usdtPluginConfiguration.EthereumUSDtLikeConfigurationItems[currentConfiguration.GetPaymentMethodId()] =
7576
USDtPlugin.OverrideWithServerSettings(defaultConfiguration, settingsRepository);
7677

77-
eventAggregator.Publish(new EthErc20SettingsChanged());
78+
eventAggregator.Publish(new EthUSDtSettingsChanged());
7879

7980
return RedirectToAction("GetServerConfig");
8081
}

BTCPayServer.Plugins.USDt/Controllers/UIEthErc20LikeStoreController.cs renamed to BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeStoreController.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
namespace BTCPayServer.Plugins.USDt.Controllers;
2222

23-
[Route("stores/{storeId}/ethErc20like")]
23+
[Route("stores/{storeId}/EthUSDtlike")]
2424
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
2525
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
26-
public class UIEthErc20LikeStoreController(
26+
public class UIEthUSDtLikeStoreController(
2727
StoreRepository storeRepository,
28-
EthErc20RPCProvider ethErc20RpcProvider,
28+
EthUSDtRPCProvider EthUSDtRpcProvider,
2929
PaymentMethodHandlerDictionary handlers,
3030
InvoiceRepository invoiceRepository,
3131
DisplayFormatter displayFormatter,
@@ -34,23 +34,23 @@ public class UIEthErc20LikeStoreController(
3434
private StoreData StoreData => HttpContext.GetStoreData();
3535

3636
[HttpGet]
37-
public IActionResult GetStoreEthErc20LikePaymentMethods()
37+
public IActionResult GetStoreEthUSDtLikePaymentMethods()
3838
{
3939
var vm = GetVM(StoreData);
4040
return View(vm);
4141
}
4242

4343
[NonAction]
44-
public ViewEthErc20StoreOptionsViewModel GetVM(StoreData storeData)
44+
public ViewUSDtStoreOptionsViewModel GetVM(StoreData storeData)
4545
{
4646
var excludeFilters = storeData.GetStoreBlob().GetExcludedPaymentMethods();
4747

48-
var vm = new ViewEthErc20StoreOptionsViewModel();
49-
foreach (var item in pluginConfiguration.EthereumErc20LikeConfigurationItems.Values)
48+
var vm = new ViewUSDtStoreOptionsViewModel();
49+
foreach (var item in pluginConfiguration.EthereumUSDtLikeConfigurationItems.Values)
5050
{
5151
var pmi = item.GetPaymentMethodId();
52-
var matchedPaymentMethod = storeData.GetPaymentMethodConfig<EthErc20PaymentMethodConfig>(pmi, handlers);
53-
vm.Items.Add(new ViewEthErc20StoreOptionItemViewModel
52+
var matchedPaymentMethod = storeData.GetPaymentMethodConfig<EthUSDtPaymentMethodConfig>(pmi, handlers);
53+
vm.Items.Add(new ViewUSDtStoreOptionItemViewModel
5454
{
5555
PaymentMethodId = pmi,
5656
DisplayName = item.DisplayName,
@@ -63,31 +63,31 @@ public ViewEthErc20StoreOptionsViewModel GetVM(StoreData storeData)
6363
}
6464

6565
[HttpGet("{paymentMethodId}")]
66-
public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(PaymentMethodId paymentMethodId)
66+
public async Task<IActionResult> GetStoreEthUSDtLikePaymentMethod(PaymentMethodId paymentMethodId)
6767
{
68-
if (pluginConfiguration.EthereumErc20LikeConfigurationItems.ContainsKey(paymentMethodId) == false)
68+
if (pluginConfiguration.EthereumUSDtLikeConfigurationItems.ContainsKey(paymentMethodId) == false)
6969
return NotFound();
7070

7171
var excludeFilters = StoreData.GetStoreBlob().GetExcludedPaymentMethods();
72-
var matchedPaymentMethodConfig = StoreData.GetPaymentMethodConfig<EthErc20PaymentMethodConfig>(paymentMethodId, handlers);
72+
var matchedPaymentMethodConfig = StoreData.GetPaymentMethodConfig<EthUSDtPaymentMethodConfig>(paymentMethodId, handlers);
7373

7474
if (matchedPaymentMethodConfig == null)
75-
return View(new EditEthErc20PaymentMethodViewModel
75+
return View(new EditEthUSDtPaymentMethodViewModel
7676
{
7777
Enabled = false
7878
});
7979

8080
var balances =
81-
await ethErc20RpcProvider.GetBalances(paymentMethodId, [.. matchedPaymentMethodConfig.Addresses]);
81+
await EthUSDtRpcProvider.GetBalances(paymentMethodId, [.. matchedPaymentMethodConfig.Addresses]);
8282
var reservedAddresses =
83-
await EthErc20PaymentMethodConfig.GetReservedAddresses(paymentMethodId, invoiceRepository);
83+
await EthUSDtPaymentMethodConfig.GetReservedAddresses(paymentMethodId, invoiceRepository);
8484

85-
return View(new EditEthErc20PaymentMethodViewModel
85+
return View(new EditEthUSDtPaymentMethodViewModel
8686
{
8787
Enabled = !excludeFilters.Match(paymentMethodId),
8888
Address = "",
8989
Addresses = matchedPaymentMethodConfig.Addresses.Select(s =>
90-
new EditEthErc20PaymentMethodViewModel.EditEthErc20PaymentMethodAddressViewModel
90+
new EditEthUSDtPaymentMethodViewModel.EditEthUSDtPaymentMethodAddressViewModel
9191
{
9292
Available = reservedAddresses.Contains(s) == false,
9393
Balance = balances.Single(x => x.Item1 == s).Item2 == null
@@ -102,13 +102,13 @@ public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(PaymentMethod
102102
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
103103
public async Task<IActionResult> DeleteAddress(string storeId, PaymentMethodId paymentMethodId, string address)
104104
{
105-
if (pluginConfiguration.EthereumErc20LikeConfigurationItems.ContainsKey(paymentMethodId) == false)
105+
if (pluginConfiguration.EthereumUSDtLikeConfigurationItems.ContainsKey(paymentMethodId) == false)
106106
return NotFound();
107107

108108
var store = StoreData;
109109
var blob = StoreData.GetStoreBlob();
110110
var currentPaymentMethodConfig =
111-
StoreData.GetPaymentMethodConfig<EthErc20PaymentMethodConfig>(paymentMethodId, handlers);
111+
StoreData.GetPaymentMethodConfig<EthUSDtPaymentMethodConfig>(paymentMethodId, handlers);
112112
if (currentPaymentMethodConfig is null) return NotFound();
113113

114114
currentPaymentMethodConfig.Addresses = currentPaymentMethodConfig.Addresses.Except(new[] { address }).ToArray();
@@ -122,21 +122,21 @@ public async Task<IActionResult> DeleteAddress(string storeId, PaymentMethodId p
122122
Severity = StatusMessageModel.StatusSeverity.Success
123123
});
124124

125-
return RedirectToAction(nameof(GetStoreEthErc20LikePaymentMethod), new { storeId, paymentMethodId });
125+
return RedirectToAction(nameof(GetStoreEthUSDtLikePaymentMethod), new { storeId, paymentMethodId });
126126
}
127127

128128
[HttpPost("{paymentMethodId}")]
129129
[DisableRequestSizeLimit]
130-
public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(EditEthErc20PaymentMethodViewModel viewModel,
130+
public async Task<IActionResult> GetStoreEthUSDtLikePaymentMethod(EditEthUSDtPaymentMethodViewModel viewModel,
131131
PaymentMethodId paymentMethodId)
132132
{
133-
if (pluginConfiguration.EthereumErc20LikeConfigurationItems.ContainsKey(paymentMethodId) == false)
133+
if (pluginConfiguration.EthereumUSDtLikeConfigurationItems.ContainsKey(paymentMethodId) == false)
134134
return NotFound();
135135

136136
var store = StoreData;
137137
var blob = StoreData.GetStoreBlob();
138-
var currentPaymentMethodConfig = StoreData.GetPaymentMethodConfig<EthErc20PaymentMethodConfig>(paymentMethodId, handlers);
139-
currentPaymentMethodConfig ??= new EthErc20PaymentMethodConfig();
138+
var currentPaymentMethodConfig = StoreData.GetPaymentMethodConfig<EthUSDtPaymentMethodConfig>(paymentMethodId, handlers);
139+
currentPaymentMethodConfig ??= new EthUSDtPaymentMethodConfig();
140140

141141
if (string.IsNullOrEmpty(viewModel.Address) == false)
142142
{
@@ -153,7 +153,7 @@ public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(EditEthErc20P
153153
Severity = StatusMessageModel.StatusSeverity.Error
154154
});
155155

156-
return RedirectToAction("GetStoreEthErc20LikePaymentMethod", new { storeId = store.Id, paymentMethodId = paymentMethodId });
156+
return RedirectToAction("GetStoreEthUSDtLikePaymentMethod", new { storeId = store.Id, paymentMethodId = paymentMethodId });
157157
}
158158

159159
currentPaymentMethodConfig.Addresses =
@@ -194,6 +194,6 @@ .. addresses
194194
store.SetStoreBlob(blob);
195195
await storeRepository.UpdateStore(store);
196196

197-
return RedirectToAction("GetStoreEthErc20LikePaymentMethod", new { storeId = store.Id, paymentMethodId });
197+
return RedirectToAction("GetStoreEthUSDtLikePaymentMethod", new { storeId = store.Id, paymentMethodId });
198198
}
199199
}

BTCPayServer.Plugins.USDt/Controllers/UITronUSDtLikeStoreController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ public IActionResult GetStoreTronUSDtLikePaymentMethods()
4242
}
4343

4444
[NonAction]
45-
public ViewTronUSDtStoreOptionsViewModel GetVM(StoreData storeData)
45+
public ViewUSDtStoreOptionsViewModel GetVM(StoreData storeData)
4646
{
4747
var excludeFilters = storeData.GetStoreBlob().GetExcludedPaymentMethods();
4848

49-
var vm = new ViewTronUSDtStoreOptionsViewModel();
49+
var vm = new ViewUSDtStoreOptionsViewModel();
5050
foreach (var item in pluginConfiguration.TronUSDtLikeConfigurationItems.Values)
5151
{
5252
var pmi = item.GetPaymentMethodId();
5353
var matchedPaymentMethod = storeData.GetPaymentMethodConfig<TronUSDtPaymentMethodConfig>(pmi, handlers);
54-
vm.Items.Add(new ViewTronUSDtStoreOptionItemViewModel
54+
vm.Items.Add(new ViewUSDtStoreOptionItemViewModel
5555
{
5656
PaymentMethodId = pmi,
5757
DisplayName = item.DisplayName,

0 commit comments

Comments
 (0)