@@ -43,13 +43,17 @@ describe('XCAmple:burnFrom:accessControl', function () {
43
43
44
44
it ( 'should NOT be callable by other user' , async function ( ) {
45
45
await expect (
46
- xcAmple . connect ( otherUser ) . burnFrom ( otherUser . getAddress ( ) , unitTokenAmount ) ,
46
+ xcAmple
47
+ . connect ( otherUser )
48
+ . burnFrom ( otherUser . getAddress ( ) , unitTokenAmount ) ,
47
49
) . to . be . reverted ;
48
50
} ) ;
49
51
50
52
it ( 'should be callable by spender' , async function ( ) {
51
53
await expect (
52
- xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , unitTokenAmount ) ,
54
+ xcAmple
55
+ . connect ( deployer )
56
+ . burnFrom ( otherUser . getAddress ( ) , unitTokenAmount ) ,
53
57
) . not . to . be . reverted ;
54
58
} ) ;
55
59
} ) ;
@@ -60,9 +64,7 @@ describe('XCAmple:burnFrom', () => {
60
64
describe ( 'when burn address is zero address' , ( ) => {
61
65
it ( 'should revert' , async function ( ) {
62
66
await expect (
63
- xcAmple
64
- . connect ( deployer )
65
- . burnFrom ( ethers . constants . AddressZero , 0 ) ,
67
+ xcAmple . connect ( deployer ) . burnFrom ( ethers . constants . AddressZero , 0 ) ,
66
68
) . to . be . reverted ;
67
69
} ) ;
68
70
} ) ;
@@ -72,7 +74,9 @@ describe('XCAmple:burnFrom', () => {
72
74
const mintAmt = toUFrgDenomination ( '1000000' ) ;
73
75
await xcAmple . connect ( deployer ) . mint ( otherUser . getAddress ( ) , mintAmt ) ;
74
76
const burnAmt = ( await xcAmple . balanceOf ( otherUser . getAddress ( ) ) ) . add ( 1 ) ;
75
- await xcAmple . connect ( otherUser ) . approve ( await deployer . getAddress ( ) , burnAmt ) ;
77
+ await xcAmple
78
+ . connect ( otherUser )
79
+ . approve ( await deployer . getAddress ( ) , burnAmt ) ;
76
80
77
81
await expect (
78
82
xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , burnAmt ) ,
@@ -84,7 +88,9 @@ describe('XCAmple:burnFrom', () => {
84
88
it ( 'should revert' , async function ( ) {
85
89
const mintAmt = toUFrgDenomination ( '1000000' ) ;
86
90
await xcAmple . connect ( deployer ) . mint ( otherUser . getAddress ( ) , mintAmt ) ;
87
- await xcAmple . connect ( otherUser ) . approve ( await deployer . getAddress ( ) , mintAmt . sub ( 1 ) ) ;
91
+ await xcAmple
92
+ . connect ( otherUser )
93
+ . approve ( await deployer . getAddress ( ) , mintAmt . sub ( 1 ) ) ;
88
94
await expect (
89
95
xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , mintAmt ) ,
90
96
) . to . be . reverted ;
@@ -98,7 +104,7 @@ describe('XCAmple:burnFrom', () => {
98
104
beforeEach ( async function ( ) {
99
105
await xcAmple . connect ( deployer ) . mint ( deployer . getAddress ( ) , amt2 ) ;
100
106
await xcAmple . connect ( deployer ) . mint ( otherUser . getAddress ( ) , amt1 ) ;
101
- await xcAmple . connect ( otherUser ) . approve ( deployer . getAddress ( ) , amt1 )
107
+ await xcAmple . connect ( otherUser ) . approve ( deployer . getAddress ( ) , amt1 ) ;
102
108
} ) ;
103
109
it ( 'should burn tokens from wallet' , async function ( ) {
104
110
await xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , amt1 ) ;
@@ -115,12 +121,19 @@ describe('XCAmple:burnFrom', () => {
115
121
expect ( await xcAmple . totalSupply ( ) ) . to . eq ( amt2 ) ;
116
122
} ) ;
117
123
it ( 'should reduce the approved amount' , async function ( ) {
118
- const allowanceBefore = await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ;
124
+ const allowanceBefore = await xcAmple . allowance (
125
+ otherUser . getAddress ( ) ,
126
+ deployer . getAddress ( ) ,
127
+ ) ;
119
128
await xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , amt1 ) ;
120
- expect ( await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ) . to . eq ( allowanceBefore - amt1 ) ;
129
+ expect (
130
+ await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ,
131
+ ) . to . eq ( allowanceBefore - amt1 ) ;
121
132
} ) ;
122
133
it ( 'should log Transfer to zero address' , async function ( ) {
123
- await expect ( xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , amt1 ) )
134
+ await expect (
135
+ xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , amt1 ) ,
136
+ )
124
137
. to . emit ( xcAmple , 'Transfer' )
125
138
. withArgs (
126
139
await otherUser . getAddress ( ) ,
@@ -151,9 +164,14 @@ describe('XCAmple:burnFrom', () => {
151
164
expect ( await xcAmple . totalSupply ( ) ) . to . eq ( remainingBal ) ;
152
165
} ) ;
153
166
it ( 'should reduce the approved amount' , async function ( ) {
154
- const allowanceBefore = await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ;
167
+ const allowanceBefore = await xcAmple . allowance (
168
+ otherUser . getAddress ( ) ,
169
+ deployer . getAddress ( ) ,
170
+ ) ;
155
171
await xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , burnAmt ) ;
156
- expect ( await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ) . to . eq ( allowanceBefore - burnAmt ) ;
172
+ expect (
173
+ await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ,
174
+ ) . to . eq ( allowanceBefore - burnAmt ) ;
157
175
} ) ;
158
176
it ( 'should log Transfer to zero address' , async function ( ) {
159
177
await expect (
@@ -175,7 +193,9 @@ describe('XCAmple:burnFrom', () => {
175
193
beforeEach ( async function ( ) {
176
194
await xcAmple . rebase ( 1 , MAX_SUPPLY ) ;
177
195
await xcAmple . connect ( deployer ) . mint ( otherUser . getAddress ( ) , MAX_SUPPLY ) ;
178
- await xcAmple . connect ( otherUser ) . approve ( deployer . getAddress ( ) , MAX_SUPPLY ) ;
196
+ await xcAmple
197
+ . connect ( otherUser )
198
+ . approve ( deployer . getAddress ( ) , MAX_SUPPLY ) ;
179
199
} ) ;
180
200
181
201
it ( 'should burn tokens from wallet' , async function ( ) {
@@ -190,9 +210,14 @@ describe('XCAmple:burnFrom', () => {
190
210
expect ( await xcAmple . totalSupply ( ) ) . to . eq ( remainingBal ) ;
191
211
} ) ;
192
212
it ( 'should reduce the approved amount' , async function ( ) {
193
- const allowanceBefore = await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ;
213
+ const allowanceBefore = await xcAmple . allowance (
214
+ otherUser . getAddress ( ) ,
215
+ deployer . getAddress ( ) ,
216
+ ) ;
194
217
await xcAmple . connect ( deployer ) . burnFrom ( otherUser . getAddress ( ) , burnAmt ) ;
195
- expect ( await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ) . to . eq ( allowanceBefore . sub ( burnAmt ) ) ;
218
+ expect (
219
+ await xcAmple . allowance ( otherUser . getAddress ( ) , deployer . getAddress ( ) ) ,
220
+ ) . to . eq ( allowanceBefore . sub ( burnAmt ) ) ;
196
221
} ) ;
197
222
it ( 'should log Transfer to zero address' , async function ( ) {
198
223
await expect (
0 commit comments