forked from Militereum/Militereum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.pas
724 lines (655 loc) · 21.3 KB
/
main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
unit main;
interface
uses
// Delphi
System.Classes,
System.Notification,
System.SysUtils,
// FireMonkey
FMX.Controls,
FMX.Controls.Presentation,
FMX.Edit,
FMX.Forms,
FMX.Layouts,
FMX.Menus,
FMX.Objects,
FMX.StdCtrls,
FMX.Types,
// Indy
IdContext,
// web3
web3,
// project
checks,
demo,
log,
server,
transaction;
type
TFrmMain = class(TForm)
btnDismiss: TButton;
NC: TNotificationCenter;
Grid: TGridPanelLayout;
btnEthereum: TSpeedButton;
btnHolesky: TSpeedButton;
btnPolygon: TSpeedButton;
btnArbitrum: TSpeedButton;
btnOptimism: TSpeedButton;
imgEthereum: TImage;
imgHolesky: TImage;
imgPolygon: TImage;
imgArbitrum: TImage;
imgOptimism: TImage;
edtCopy: TEdit;
btnCopy: TButton;
lblTitle: TLabel;
imgArbitrum1: TImage;
imgOptimism1: TImage;
imgPolygon1: TImage;
imgHolesky1: TImage;
imgEthereum1: TImage;
btnSettings: TSpeedButton;
pmSettings: TPopupMenu;
mnuAutoRun: TMenuItem;
imgSettings: TImage;
lblHelp: TLabel;
btnBase: TSpeedButton;
imgBase: TImage;
imgBase1: TImage;
btnSepolia: TSpeedButton;
imgSepolia: TImage;
imgSepolia1: TImage;
mnuShowTestNetworks: TMenuItem;
Header: TGridPanelLayout;
imgMilitereum: TImage;
lblWelcome: TLabel;
mnuDemo: TMenuItem;
mnuLimit: TMenuItem;
mnuApprove: TMenuItem;
mnuSanctioned: TMenuItem;
mnuUnverified: TMenuItem;
mnuPhisher: TMenuItem;
mnuSetApprovalForAll: TMenuItem;
mnuSpam: TMenuItem;
mnuHoneypot: TMenuItem;
mnuUnsupported: TMenuItem;
mnuNoDexPair: TMenuItem;
mnuFirsttime: TMenuItem;
mnuLowDexScore: TMenuItem;
mnuAirdrop: TMenuItem;
mnuCensorable: TMenuItem;
mnuPausable: TMenuItem;
mnuDormant: TMenuItem;
mnuUnlock: TMenuItem;
mnuDarkMode: TMenuItem;
mnuVault: TMenuItem;
procedure btnDismissClick(Sender: TObject);
procedure NCPermissionRequestResult(Sender: TObject; const aIsGranted: Boolean);
procedure btnNetworkClick(Sender: TObject);
procedure btnCopyClick(Sender: TObject);
procedure btnSettingsClick(Sender: TObject);
procedure mnuAutoRunClick(Sender: TObject);
procedure lblHelpClick(Sender: TObject);
procedure mnuShowTestNetworksClick(Sender: TObject);
procedure mnuDarkModeClick(Sender: TObject);
strict private
FCanNotify: Boolean;
FNotified : Boolean;
FFirstTime: Boolean;
FFrmLog: TFrmLog;
FServer: TEthereumRPCServer;
FAllowedTransactions: TStrings;
FBlockedTransactions: TStrings;
FShowTestNetworks: Boolean;
FApproved: TArray<TApproval>;
procedure Dismiss;
procedure Log(const err: IError); overload;
procedure Log(const line: TLine; const row: string); overload;
procedure Notify; overload;
function Notify(const body: string): Boolean; overload;
procedure ShowLogWindow;
procedure SetShowTestNetworks(Value: Boolean);
strict protected
procedure BeforeTransaction(const chain: TChain; const tx: ITransaction);
procedure AfterTransaction(const chain: TChain; const tx: ITransaction; const allowed: Boolean; const checked: TCustomChecks; const prompted: TPrompted);
procedure DoShow; override;
procedure DoRPC(const aContext: TIdContext; const aPayload: IPayload; const callback: TProc<Boolean>; const error: TProc<IError>);
procedure DoLog(const request, response: string; const success: Boolean);
function AllowedTransactions: TStrings;
function BlockedTransactions: TStrings;
function IsAllowedTransaction(const params: string): Boolean;
function IsBlockedTransaction(const params: string): Boolean;
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
function GetChain: PChain;
property ShowTestNetworks: Boolean read FShowTestNetworks write SetShowTestNetworks;
end;
var
FrmMain: TFrmMain = nil;
implementation
{$R *.fmx}
uses
// Delphi
System.Generics.Collections,
System.JSON,
System.Types,
System.UITypes,
// FireMonkey
FMX.Dialogs,
FMX.Platform,
// web3
web3.eth.simulate,
web3.eth.types,
web3.utils,
// project
common,
docker,
error,
revoke,
thread;
{ TFrmMain }
constructor TFrmMain.Create(aOwner: TComponent);
procedure terminate;
begin
{$WARN SYMBOL_DEPRECATED OFF}
MessageDlg('Cannot start HTTP server. The app will quit.', TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0);
{$WARN SYMBOL_DEPRECATED DEFAULT}
Application.Terminate;
end;
begin
inherited Create(aOwner);
FApproved := [];
FFirstTime := True;
FShowTestNetworks := True;
Self.Caption := (function: string
begin
Result := Self.Caption + ' ' + {$I Militereum.version};
if common.Demo then Result := Result + ' - Demo mode';
if common.Debug then Result := Result + ' - Debug mode';
if common.Simulate then Result := Result + ' - Simulate-only';
end)();
edtCopy.Visible := False;
btnCopy.Visible := False;
lblHelp.Visible := False;
mnuDarkMode.IsChecked := common.DarkModeEnabled;
const ports = server.ports(NUM_CHAINS);
if ports.isErr then
begin
terminate;
EXIT;
end;
const server = server.start(ports.Value);
if server.isErr then
begin
terminate;
EXIT;
end;
FServer := server.Value;
FServer.OnRPC := DoRPC;
FServer.OnLog := DoLog;
FCanNotify := NC.AuthorizationStatus = TAuthorizationStatus.Authorized;
if not FCanNotify then NC.RequestPermission;
end;
destructor TFrmMain.Destroy;
begin
if Assigned(FServer) then
try
if FServer.Active then
try
FServer.Active := False;
except end;
finally
FServer.Free;
end;
const id = docker.getContainerId(RPCh_CONTAINER_NAME);
if id <> '' then docker.stop(id);
if Assigned(FAllowedTransactions) then FAllowedTransactions.Free;
if Assigned(FBlockedTransactions) then FBlockedTransactions.Free;
inherited Destroy;
end;
function TFrmMain.AllowedTransactions: TStrings;
begin
if not Assigned(FAllowedTransactions) then FAllowedTransactions := TStringList.Create;
Result := FAllowedTransactions;
end;
function TFrmMain.BlockedTransactions: TStrings;
begin
if not Assigned(FBlockedTransactions) then FBlockedTransactions := TStringList.Create;
Result := FBlockedTransactions;
end;
function TFrmMain.IsAllowedTransaction(const params: string): Boolean;
begin
Result := Self.AllowedTransactions.IndexOf(params) > -1;
end;
function TFrmMain.IsBlockedTransaction(const params: string): Boolean;
begin
Result := Self.BlockedTransactions.IndexOf(params) > -1;
end;
procedure TFrmMain.lblHelpClick(Sender: TObject);
begin
common.Open('https://militereum.com/how-to-setup/');
end;
procedure TFrmMain.Notify;
begin
FNotified := Self.Notify('Securing your crypto wallet');
end;
function TFrmMain.Notify(const body: string): Boolean;
begin
Result := FCanNotify;
if Result then
thread.synchronize(procedure
begin
const N = NC.CreateNotification;
try
N.AlertBody := body;
NC.PresentNotification(N);
finally
N.Free;
end;
end);
end;
procedure TFrmMain.Dismiss;
begin
thread.synchronize(procedure
begin
if Self.Visible then
begin
Self.Hide;
Self.Notify;
end;
if not Self.FNotified then Self.Notify;
end);
end;
function TfrmMain.GetChain: PChain;
begin
if btnEthereum.IsPressed then
Result := @web3.Ethereum
else if btnHolesky.IsPressed then
Result := @web3.Holesky
else if btnSepolia.IsPressed then
Result := @web3.Sepolia
else if btnPolygon.IsPressed then
Result := @web3.Polygon
else if btnArbitrum.IsPressed then
Result := @web3.Arbitrum
else if btnOptimism.IsPressed then
Result := @web3.Optimism
else if btnBase.IsPressed then
Result := @web3.Base
else
Result := nil;
end;
procedure TFrmMain.ShowLogWindow;
begin
if not Assigned(FFrmLog) then FFrmLog := TFrmLog.Create(Application);
FFrmLog.Show;
end;
procedure TFrmMain.SetShowTestNetworks(Value: Boolean);
begin
if Value <> FShowTestNetworks then
begin
with Grid do if Value then ColumnCollection[1].Value := ColumnCollection[0].Value else ColumnCollection[1].Value := 0;
with Grid do if Value then ColumnCollection[2].Value := ColumnCollection[0].Value else ColumnCollection[2].Value := 0;
Self.ClientWidth := Round((function: Single
begin
Result := 2 * Grid.Position.X;
for var I := 0 to Pred(Grid.ColumnCollection.Count) do Result := Result + Grid.ColumnCollection[I].Value;
end)());
FShowTestNetworks := Value;
end;
end;
procedure TFrmMain.btnNetworkClick(Sender: TObject);
procedure updateImage(const button: TSpeedButton);
begin
for var I := 0 to Pred(button.ChildrenCount) do
begin
const child = button.Children[I];
if child is TImage then
TImage(child).Visible := (button.StaysPressed and (TImage(child).Tag = 1))
or ((TImage(child).Tag = 0) and not button.StaysPressed);
end;
end;
begin
for var I := 0 to Pred(Self.ComponentCount) do
if Self.Components[I] is TSpeedButton and (Self.Components[I] <> Sender) then
begin
const other = TSpeedButton(Self.Components[I]);
other.StaysPressed := False;
updateImage(other);
end;
TSpeedButton(Sender).StaysPressed := not TSpeedButton(Sender).StaysPressed;
updateImage(TSpeedButton(Sender));
lblHelp.Visible := False;
const chain = Self.GetChain;
edtCopy.Visible := Assigned(chain);
btnCopy.Text := 'Copy';
btnCopy.Visible := Assigned(chain);
btnDismiss.Visible := not Assigned(chain);
if Assigned(chain) then edtCopy.Text := FServer.URI(FServer.port(chain^).Value);
end;
procedure TFrmMain.DoShow;
begin
inherited DoShow;
if FFirstTime then
FFirstTime := False
else
EXIT;
if common.Debug then ShowLogWindow;
// update.latestRelease(procedure(tag: string)
// begin
// if common.ParseSemVer(tag) > common.ParseSemVer({$I Militereum.version}) then
// thread.synchronize(procedure
// begin
// update.show(tag);
// end);
// end);
// if docker.supported and not docker.installed then
// begin
// const frmDocker = TFrmDocker.Create(Application);
// try
// docker.callback := function: TFrmDocker begin Result := frmDocker; end;
// try
// frmDocker.ShowModal;
// finally
// docker.callback := nil;
// end;
// finally
// frmDocker.Free;
// end;
// end;
end;
procedure TFrmMain.NCPermissionRequestResult(Sender: TObject; const aIsGranted: Boolean);
begin
FCanNotify := aIsGranted;
end;
procedure TFrmMain.BeforeTransaction(const chain: TChain; const tx: transaction.ITransaction);
begin
common.beforeShowDialog;
Self.Notify('Checking your transaction');
end;
procedure TFrmMain.AfterTransaction(
const chain : TChain; // the network the user is transacting on
const tx : transaction.ITransaction; // the transaction that passed through Militereum
const allowed : Boolean; // True if the user allowed for the transaction, otherwise False
const checked : TCustomChecks; // reference to the checks that got performed on the transaction
const prompted: TPrompted); // the warnings the user got prompted with
begin
common.afterShowDialog;
if allowed then
begin
if TWarning.Approve in prompted then thread.lock(Self, procedure
begin
Self.FApproved := Self.FApproved + checked.Approved;
end);
// clean up after the approvals that aren't active anymore (eg. have been revoked)
thread.lock(Self, procedure(done: TCallback)
begin
var next: TProc<Integer>;
next := procedure(index: Integer)
begin
if index >= Length(Self.FApproved) then
done
else
// is this allowance active? (eg. has not been revoked yet)
Self.FApproved[index].Active(procedure(active: Boolean; err: IError)
begin
if active or Assigned(err) then
next(index + 1)
else try
Delete(Self.FApproved, index, 1);
finally
next(index);
end;
end);
end;
next(0);
end);
// auto-revoke: https://medium.com/@svanas/introducing-auto-revoke-dba9f3222414
tx.From.ifOk(procedure(from: TAddress)
begin
tx.ToIsEOA(chain, procedure(eoa: Boolean; err: IError)
begin
// did we transact with a smart contract? (not with an EOA)
if not eoa then
begin
// did we previously approve this smart contract?
const approved = thread.TLock.get<TArray<TApproval>>(Self, function: TArray<TApproval>
begin
Result := [];
for var approval in Self.FApproved do
if (approval.Chain = chain) and approval.Owner.SameAs(from) and approval.Spender.SameAs(tx.&To) then
Result := Result + [approval];
end);
if Length(approved) > 0 then
// is this allowance active? (eg. has not been revoked yet)
approved[0].Active(procedure(active: Boolean; err: IError)
begin
if Assigned(err) or not active then
{ nothing to do }
else begin
common.beforeShowDialog;
try
// prompt the user to revoke this spender/contract
thread.synchronize(procedure
begin
revoke.show(approved[0].Chain, approved[0].Token, approved[0].Spender, procedure(revoke: Boolean)
begin
if revoke then common.Open(System.SysUtils.Format('https://revoke.cash/address/%s?chainId=%d&spenderSearch=%s', [from.ToChecksum, chain.Id, approved[0].Spender.ToChecksum]));
end)
end)
finally
common.afterShowDialog;
end;
end;
end);
end;
end);
end);
end;
end;
procedure TFrmMain.DoRPC(const aContext: TIdContext; const aPayload: IPayload; const callback: TProc<Boolean>; const error: TProc<IError>);
type
TNext = reference to procedure(const steps: TSteps; const index: Integer; const prompted: TPrompted; const done: TDone);
begin
if not Assigned(aPayload) then
begin
callback(True);
EXIT;
end;
Self.Dismiss;
if (function: Boolean
begin
Result := docker.running;
// Result := docker.installed and docker.running or (function: Boolean
// begin
// Result := docker.start;
// if Result then
// repeat
// TThread.Sleep(100);
// until docker.running;
// end)();
end)()
and (docker.getContainerId(RPCh_CONTAINER_NAME) = '')
and docker.pull(RPCh_DOCKER_IMAGE)
and docker.run(RPCh_CONTAINER_NAME,
'--platform=linux/amd64 ' +
'-e FORCE_ZERO_HOP=true ' +
'-e CLIENT=' + {$I keys/hopr.api.key} + ' ' +
System.SysUtils.Format('-p %d:%d ', [RPCh_PORT_NUMBER, RPCh_PORT_NUMBER]) +
'--rm ' + RPCh_DOCKER_IMAGE) then
repeat
TThread.Sleep(100);
until docker.getContainerId(RPCh_CONTAINER_NAME) <> '';
if SameText(aPayload.Method, 'eth_sendRawTransaction') then
if (aPayload.Params.Count > 0) and (aPayload.Params[0] is TJsonString) then
begin
const params = TJsonString(aPayload.Params[0]).Value;
if IsAllowedTransaction(params) then
callback(True)
else if IsBlockedTransaction(params) then
callback(False)
else begin
decodeRawTransaction(web3.utils.fromHex(params))
.ifErr(procedure(err: IError) begin error(err) end)
.&else(procedure(tx: transaction.ITransaction)
begin
const chain = FServer.chain(aContext.Binding.Port);
if Assigned(chain) then
begin
Self.BeforeTransaction(chain^, tx);
var next: TNext;
next := procedure(const steps: TSteps; const index: Integer; const input: TPrompted; const done: TDone)
begin
if index >= Length(steps) then
done(input)
else
steps[index](input, procedure(const output: TPrompted; const err: IError)
begin
if Assigned(err) then
begin
var ME: IMilitereumError;
if Supports(err, IMilitereumError, ME) then ME.Comment
.ifErr(procedure(_: IError)
begin
Self.Log(TLine.Info, ME.FuncName)
end)
.&else(procedure(comment: string)
begin
Self.Log(TLine.Info, System.SysUtils.Format('%s - %s', [ME.FuncName, comment]))
end);
Self.Log(err);
end;
next(steps, index + 1, output, done);
end);
end;
var checks: TChecks := nil;
const done = procedure(const allow: Boolean; const prompted: TPrompted)
begin
if allow then Self.AllowedTransactions.Add(params) else Self.BlockedTransactions.Add(params);
try
callback(allow);
finally
Self.AfterTransaction(chain^, tx, allow, checks, prompted);
if Assigned(checks) then checks.Free;
end;
if (prompted <> []) and ((Self.AllowedTransactions.Count > 1) or (Self.BlockedTransactions.Count > 1)) then {show nag screen};
end;
checks := TChecks.Create(FServer, aContext.Binding.Port, chain^, tx,
procedure(const prompted: TPrompted) // block
begin
done(False, prompted);
end, Self.Log);
const steps = (function: TSteps
begin
Result := [checks.Step1, checks.Step2, checks.Step3, checks.Step4, checks.Step5, checks.Step6, checks.Step7, checks.Step8, checks.Step9, checks.Step10, checks.Step11, checks.Step12, checks.Step13, checks.Step14, checks.Step15, checks.Step16, checks.Step17, checks.Step18, checks.Step19];
if common.Simulate then
begin
Result := Result + [checks.Fail];
FServer.apiKey(aContext.Binding.Port).ifOk(procedure(apiKey: string)
begin
tx.Simulate(apiKey, chain^, procedure(changes: IAssetChanges; _: IError)
begin
if Assigned(changes) then
begin
var S: IFMXClipboardService;
if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, S) then
begin
S.SetClipboard(changes.ToString);
Self.Notify('Copied your simulated transaction to the clipboard');
end;
end;
end);
end)
end;
end)();
next(steps, 0, [],
procedure(const prompted: TPrompted) // allow
begin
Self.Notify(System.SysUtils.Format('Approved your transaction %s', [tx.Nonce.ToString]));
done(True, prompted);
end);
end;
end);
end;
EXIT;
end;
callback(True);
end;
procedure TFrmMain.DoLog(const request, response: string; const success: Boolean);
begin
if Assigned(FFrmLog) then
thread.synchronize(procedure
begin
FFrmLog.BeginUpdate;
try
FFrmLog.Add(TLine.Request, request);
if success then
FFrmLog.Add(TLine.Response, response)
else
FFrmLog.Add(TLine.Error, response);
finally
FFrmLog.EndUpdate;
end;
end);
end;
procedure TFrmMain.Log(const err: IError);
begin
Log(TLine.Error, err.Message);
end;
procedure TFrmMain.Log(const line: TLine; const row: string);
begin
if Assigned(FFrmLog) then
thread.synchronize(procedure
begin
FFrmLog.Add(line, row);
end);
end;
procedure TFrmMain.btnSettingsClick(Sender: TObject);
begin
mnuShowTestNetworks.IsChecked := Self.ShowTestNetworks;
mnuAutoRun.IsChecked := common.AutoRunEnabled;
mnuDemo.Visible := common.Demo;
const P = btnSettings.LocalToScreen(PointF(0, btnSettings.Height));
pmSettings.Popup(P.X, P.Y);
end;
procedure TFrmMain.mnuShowTestNetworksClick(Sender: TObject);
begin
mnuShowTestNetworks.IsChecked := not mnuShowTestNetworks.IsChecked;
Self.ShowTestNetworks := mnuShowTestNetworks.IsChecked;
end;
procedure TFrmMain.mnuAutoRunClick(Sender: TObject);
begin
mnuAutoRun.IsChecked := not mnuAutoRun.IsChecked;
if mnuAutoRun.IsChecked then
common.EnableAutoRun
else
common.DisableAutoRun;
end;
procedure TFrmMain.mnuDarkModeClick(Sender: TObject);
begin
mnuDarkMode.IsChecked := not mnuDarkMode.IsChecked;
if mnuDarkMode.IsChecked then
common.EnableDarkMode
else
common.DisableDarkMode;
end;
procedure TFrmMain.btnDismissClick(Sender: TObject);
begin
Self.Dismiss;
end;
procedure TFrmMain.btnCopyClick(Sender: TObject);
begin
var S: IFMXClipboardService;
if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, S) then
begin
const chain = Self.GetChain;
if Assigned(chain) then
begin
S.SetClipboard(FServer.URI(FServer.port(chain^).Value));
TButton(Sender).Text := 'Copied';
lblHelp.Visible := True;
end;
end;
end;
end.