@@ -10,6 +10,9 @@ public class ERC20
10
10
{
11
11
public string chain ;
12
12
public string address ;
13
+ /// <summary>
14
+ /// Handle signature minting functionality
15
+ /// </summary>
13
16
public ERC20Signature signature ;
14
17
15
18
public ERC20 ( string chain , string address )
@@ -19,76 +22,115 @@ public ERC20(string chain, string address)
19
22
this . signature = new ERC20Signature ( chain , address ) ;
20
23
}
21
24
22
- /// READ FUNCTIONS
25
+ // READ FUNCTIONS
23
26
27
+ /// <summary>
28
+ /// Get the currency information
29
+ /// </summary>
24
30
public async Task < Currency > Get ( )
25
31
{
26
32
return await Bridge . InvokeRoute < Currency > ( getRoute ( "get" ) , new string [ ] { } ) ;
27
33
}
28
34
35
+ /// <summary>
36
+ /// Get the balance of the connected wallet
37
+ /// </summary>
29
38
public async Task < CurrencyValue > Balance ( )
30
39
{
31
40
return await Bridge . InvokeRoute < CurrencyValue > ( getRoute ( "balance" ) , new string [ ] { } ) ;
32
41
}
33
42
43
+ /// <summary>
44
+ /// Get the balance of the specified wallet
45
+ /// </summary>
34
46
public async Task < CurrencyValue > BalanceOf ( string address )
35
47
{
36
48
return await Bridge . InvokeRoute < CurrencyValue > ( getRoute ( "balanceOf" ) , Utils . ToJsonStringArray ( address ) ) ;
37
49
}
38
50
51
+ /// <summary>
52
+ /// Get how much allowance the given address is allowed to spend on behalf of the connected wallet
53
+ /// </summary>
39
54
public async Task < string > Allowance ( string spender )
40
55
{
41
56
return await Bridge . InvokeRoute < string > ( getRoute ( "allowance" ) , Utils . ToJsonStringArray ( spender ) ) ;
42
57
}
43
58
59
+ /// <summary>
60
+ /// Get how much allowance the given address is allowed to spend on behalf of the specified wallet
61
+ /// </summary>
44
62
public async Task < string > AllowanceOf ( string owner , string spender )
45
63
{
46
64
return await Bridge . InvokeRoute < string > ( getRoute ( "allowanceOf" ) , Utils . ToJsonStringArray ( owner , spender ) ) ;
47
65
}
48
66
67
+ /// <summary>
68
+ /// Get the total supply in circulation
69
+ /// </summary>
49
70
public async Task < CurrencyValue > TotalSupply ( )
50
71
{
51
72
return await Bridge . InvokeRoute < CurrencyValue > ( getRoute ( "totalSupply" ) , new string [ ] { } ) ;
52
73
}
53
74
54
- /// WRITE FUNCTIONS
75
+ // WRITE FUNCTIONS
55
76
77
+ /// <summary>
78
+ /// Set how much allowance the given address is allowed to spend on behalf of the connected wallet
79
+ /// </summary>
56
80
public async Task < TransactionResult > SetAllowance ( string spender , bool amount )
57
81
{
58
82
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "setAllowance" ) , Utils . ToJsonStringArray ( spender , amount ) ) ;
59
83
}
60
84
85
+ /// <summary>
86
+ /// Transfer a given amount of currency to another wallet
87
+ /// </summary>
61
88
public async Task < TransactionResult > Transfer ( string to , string amount )
62
89
{
63
90
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "transfer" ) , Utils . ToJsonStringArray ( to , amount ) ) ;
64
91
}
65
92
93
+ /// <summary>
94
+ /// Burn a given amount of currency
95
+ /// </summary>
66
96
public async Task < TransactionResult > Burn ( string amount )
67
97
{
68
98
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "burn" ) , Utils . ToJsonStringArray ( amount ) ) ;
69
99
}
70
100
101
+ /// <summary>
102
+ /// Claim a given amount of currency for compatible drop contracts
103
+ /// </summary>
71
104
public async Task < TransactionResult [ ] > Claim ( string amount )
72
105
{
73
106
return await Bridge . InvokeRoute < TransactionResult [ ] > ( getRoute ( "claim" ) , Utils . ToJsonStringArray ( amount ) ) ;
74
107
}
75
108
109
+ /// <summary>
110
+ /// Claim a given amount of currency to a given destination wallet for compatible drop contracts
111
+ /// </summary>
76
112
public async Task < TransactionResult [ ] > ClaimTo ( string address , int amount )
77
113
{
78
114
return await Bridge . InvokeRoute < TransactionResult [ ] > ( getRoute ( "claimTo" ) , Utils . ToJsonStringArray ( address , amount ) ) ;
79
115
}
80
116
117
+ /// <summary>
118
+ /// Mint a given amount of currency
119
+ /// </summary>
81
120
public async Task < TransactionResult > Mint ( string amount )
82
121
{
83
122
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "mint" ) , Utils . ToJsonStringArray ( amount ) ) ;
84
123
}
85
124
125
+ /// <summary>
126
+ /// Mint a given amount of currency to a given destination wallet
127
+ /// </summary>
86
128
public async Task < TransactionResult > MintTo ( string address , string amount )
87
129
{
88
130
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "mintTo" ) , Utils . ToJsonStringArray ( address , amount ) ) ;
89
131
}
90
132
91
- /// PRIVATE
133
+ // PRIVATE
92
134
93
135
private string getRoute ( string functionPath ) {
94
136
return this . address + ".erc20." + functionPath ;
@@ -153,16 +195,25 @@ public ERC20Signature(string chain, string address)
153
195
this . address = address ;
154
196
}
155
197
198
+ /// <summary>
199
+ /// Generate a signed mintable payload. Requires minting permission.
200
+ /// </summary>
156
201
public async Task < ERC20SignedPayload > Generate ( ERC20MintPayload payloadToSign )
157
202
{
158
203
return await Bridge . InvokeRoute < ERC20SignedPayload > ( getRoute ( "generate" ) , Utils . ToJsonStringArray ( payloadToSign ) ) ;
159
204
}
160
205
206
+ /// <summary>
207
+ /// Verify that a signed mintable payload is valid
208
+ /// </summary>
161
209
public async Task < bool > Verify ( ERC20SignedPayload signedPayload )
162
210
{
163
211
return await Bridge . InvokeRoute < bool > ( getRoute ( "verify" ) , Utils . ToJsonStringArray ( signedPayload ) ) ;
164
212
}
165
213
214
+ /// <summary>
215
+ /// Mint a signed mintable payload
216
+ /// </summary>
166
217
public async Task < TransactionResult > Mint ( ERC20SignedPayload signedPayload )
167
218
{
168
219
return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "mint" ) , Utils . ToJsonStringArray ( signedPayload ) ) ;
0 commit comments