@@ -111,7 +111,7 @@ export default class DigitalMarketplace extends arc4.Contract {
111
111
assert ( xfer . assetReceiver === Global . currentApplicationAddress )
112
112
assert ( xfer . assetAmount > 0 )
113
113
114
- const existing = this . listings ( key ) . value
114
+ const existing = this . listings ( key ) . value . copy ( )
115
115
this . listings ( key ) . value = new ListingValue ( {
116
116
bid : existing . bid ,
117
117
bidUnitaryPrice : existing . bidUnitaryPrice ,
@@ -129,7 +129,7 @@ export default class DigitalMarketplace extends arc4.Contract {
129
129
nonce : nonce ,
130
130
} )
131
131
132
- const existing = this . listings ( key ) . value
132
+ const existing = this . listings ( key ) . value . copy ( )
133
133
this . listings ( key ) . value = new ListingValue ( {
134
134
bid : existing . bid ,
135
135
bidUnitaryPrice : existing . bidUnitaryPrice ,
@@ -147,7 +147,7 @@ export default class DigitalMarketplace extends arc4.Contract {
147
147
nonce : nonce ,
148
148
} )
149
149
150
- const listing = this . listings ( key ) . value
150
+ const listing = this . listings ( key ) . value . copy ( )
151
151
152
152
const amountToBePaid = this . quantityPrice ( quantity , listing . unitaryPrice . native , asset . decimals )
153
153
@@ -180,7 +180,7 @@ export default class DigitalMarketplace extends arc4.Contract {
180
180
nonce : nonce ,
181
181
} )
182
182
183
- const listing = this . listings ( key ) . value
183
+ const listing = this . listings ( key ) . value . copy ( )
184
184
if ( listing . bidder !== new arc4 . Address ( ) ) {
185
185
const currentBidDeposit = this . quantityPrice ( listing . bid . native , listing . bidUnitaryPrice . native , asset . decimals )
186
186
itxn . payment ( { receiver : listing . bidder . native , amount : currentBidDeposit } ) . submit ( )
@@ -203,7 +203,7 @@ export default class DigitalMarketplace extends arc4.Contract {
203
203
bid ( owner : arc4 . Address , asset : Asset , nonce : arc4 . UintN64 , bidPay : gtxn . PaymentTxn , quantity : arc4 . UintN64 , unitaryPrice : arc4 . UintN64 ) {
204
204
const key = new ListingKey ( { owner, asset : new arc4 . UintN64 ( asset . id ) , nonce } )
205
205
206
- const listing = this . listings ( key ) . value
206
+ const listing = this . listings ( key ) . value . copy ( )
207
207
if ( listing . bidder !== new arc4 . Address ( ) ) {
208
208
assert ( unitaryPrice . native > listing . bidUnitaryPrice . native )
209
209
@@ -231,7 +231,7 @@ export default class DigitalMarketplace extends arc4.Contract {
231
231
acceptBid ( asset : Asset , nonce : arc4 . UintN64 ) {
232
232
const key = new ListingKey ( { owner : new arc4 . Address ( Txn . sender ) , asset : new arc4 . UintN64 ( asset . id ) , nonce } )
233
233
234
- const listing = this . listings ( key ) . value
234
+ const listing = this . listings ( key ) . value . copy ( )
235
235
assert ( listing . bidder !== new arc4 . Address ( ) )
236
236
237
237
const minQuantity = listing . deposited . native < listing . bid . native ? listing . deposited . native : listing . bid . native
0 commit comments