-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDeployedContractAddressExtractor.cs
More file actions
36 lines (33 loc) · 1.07 KB
/
DeployedContractAddressExtractor.cs
File metadata and controls
36 lines (33 loc) · 1.07 KB
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
namespace Sequence
{
public static class ReceiptExtractor
{
public static string ExtractFirstContractAddressExceptOwn(TransactionReceipt receipt, string ownContractAddress)
{
ownContractAddress = ownContractAddress?.ToLower();
if (!string.IsNullOrEmpty(receipt.contractAddress))
{
var contractAddrLower = receipt.contractAddress.ToLower();
if (contractAddrLower != ownContractAddress)
{
return contractAddrLower;
}
}
if (receipt.logs != null)
{
foreach (var log in receipt.logs)
{
if (!string.IsNullOrEmpty(log.address))
{
var addrLower = log.address.ToLower();
if (addrLower != ownContractAddress)
{
return addrLower;
}
}
}
}
return null;
}
}
}