@@ -40,7 +40,7 @@ describe('DigitalMarketplace', () => {
40
40
nonce : testNonce ,
41
41
} )
42
42
const listingValue = interpretAsArc4 < ListingValue > ( Bytes ( ctx . ledger . getBox ( contract , Bytes ( 'listings' ) . concat ( listingKey . bytes ) ) ) )
43
- expect ( listingValue . deposited . native ) . toEqual ( 10 )
43
+ expect ( listingValue . deposited . asUint64 ( ) ) . toEqual ( 10 )
44
44
} )
45
45
46
46
test ( 'deposit' , ( ) => {
@@ -101,7 +101,7 @@ describe('DigitalMarketplace', () => {
101
101
102
102
// Assert
103
103
const updatedListing = interpretAsArc4 < ListingValue > ( Bytes ( ctx . ledger . getBox ( contract , Bytes ( 'listings' ) . concat ( listingKey . bytes ) ) ) )
104
- expect ( updatedListing . unitaryPrice . native ) . toEqual ( testUnitaryPrice . native )
104
+ expect ( updatedListing . unitaryPrice . asUint64 ( ) ) . toEqual ( testUnitaryPrice . asUint64 ( ) )
105
105
} )
106
106
107
107
test ( 'buy' , ( ) => {
@@ -130,14 +130,14 @@ describe('DigitalMarketplace', () => {
130
130
testNonce ,
131
131
ctx . any . txn . payment ( {
132
132
receiver : ctx . defaultSender ,
133
- amount : contract . quantityPrice ( testBuyQuantity . native , testUnitaryPrice . native , testAsset . decimals ) ,
133
+ amount : contract . quantityPrice ( testBuyQuantity . asUint64 ( ) , testUnitaryPrice . asUint64 ( ) , testAsset . decimals ) ,
134
134
} ) ,
135
- testBuyQuantity . native ,
135
+ testBuyQuantity . asUint64 ( ) ,
136
136
)
137
137
138
138
// Assert
139
139
const updatedListing = interpretAsArc4 < ListingValue > ( Bytes ( ctx . ledger . getBox ( contract , Bytes ( 'listings' ) . concat ( listingKey . bytes ) ) ) )
140
- expect ( updatedListing . deposited . native ) . toEqual ( initialDeposit . native - testBuyQuantity . native )
140
+ expect ( updatedListing . deposited . asUint64 ( ) ) . toEqual ( initialDeposit . asUint64 ( ) - testBuyQuantity . asUint64 ( ) )
141
141
expect ( ctx . txn . lastGroup . getItxnGroup ( 0 ) . getAssetTransferInnerTxn ( 0 ) . assetReceiver ) . toEqual ( ctx . defaultSender )
142
142
} )
143
143
@@ -176,7 +176,7 @@ describe('DigitalMarketplace', () => {
176
176
const assetTransferTxn = ctx . txn . lastGroup . getItxnGroup ( 1 ) . getAssetTransferInnerTxn ( 0 )
177
177
expect ( assetTransferTxn . xferAsset ) . toEqual ( testAsset )
178
178
expect ( assetTransferTxn . assetReceiver ) . toEqual ( testOwner . native )
179
- expect ( assetTransferTxn . assetAmount ) . toEqual ( initialDeposit . native )
179
+ expect ( assetTransferTxn . assetAmount ) . toEqual ( initialDeposit . asUint64 ( ) )
180
180
} )
181
181
182
182
test ( 'bid' , ( ) => {
@@ -200,9 +200,9 @@ describe('DigitalMarketplace', () => {
200
200
} )
201
201
202
202
const bidder = ctx . any . account ( )
203
- const bidQuantity = ctx . any . arc4 . uint64 ( 0 , BigInt ( initialDeposit . native ) )
204
- const bidPrice = ctx . any . arc4 . uint64 ( initialPrice . native + 1 , 10000000n )
205
- const bidAmount = contract . quantityPrice ( bidQuantity . native , bidPrice . native , testAsset . decimals )
203
+ const bidQuantity = ctx . any . arc4 . uint64 ( 0 , BigInt ( initialDeposit . asUint64 ( ) ) )
204
+ const bidPrice = ctx . any . arc4 . uint64 ( initialPrice . asUint64 ( ) + 1 , 10000000n )
205
+ const bidAmount = contract . quantityPrice ( bidQuantity . asUint64 ( ) , bidPrice . asUint64 ( ) , testAsset . decimals )
206
206
207
207
// Act
208
208
ctx . txn . createScope ( [ ctx . any . txn . applicationCall ( { appId : app , sender : bidder } ) ] ) . execute ( ( ) => {
@@ -223,8 +223,8 @@ describe('DigitalMarketplace', () => {
223
223
// Assert
224
224
const updatedListing = contract . listings ( listingKey ) . value
225
225
expect ( updatedListing . bidder . native ) . toEqual ( bidder )
226
- expect ( updatedListing . bid . native ) . toEqual ( bidQuantity . native )
227
- expect ( updatedListing . bidUnitaryPrice . native ) . toEqual ( bidPrice . native )
226
+ expect ( updatedListing . bid . asUint64 ( ) ) . toEqual ( bidQuantity . asUint64 ( ) )
227
+ expect ( updatedListing . bidUnitaryPrice . asUint64 ( ) ) . toEqual ( bidPrice . asUint64 ( ) )
228
228
} )
229
229
230
230
test ( 'acceptBid' , ( ) => {
@@ -234,7 +234,7 @@ describe('DigitalMarketplace', () => {
234
234
// Arrange
235
235
const owner = ctx . defaultSender
236
236
const initialDeposit = ctx . any . arc4 . uint64 ( 1 , 10000000n )
237
- const bidQuantity = ctx . any . arc4 . uint64 ( 0 , BigInt ( initialDeposit . native ) )
237
+ const bidQuantity = ctx . any . arc4 . uint64 ( 0 , BigInt ( initialDeposit . asUint64 ( ) ) )
238
238
const bidPrice = ctx . any . arc4 . uint64 ( 0 , 10000000n )
239
239
const bidder = ctx . any . account ( )
240
240
@@ -251,15 +251,15 @@ describe('DigitalMarketplace', () => {
251
251
bidUnitaryPrice : bidPrice ,
252
252
} )
253
253
254
- const minQuantity = initialDeposit . native < bidQuantity . native ? initialDeposit . native : bidQuantity . native
255
- const expectedPayment = contract . quantityPrice ( minQuantity , bidPrice . native , testAsset . decimals )
254
+ const minQuantity = initialDeposit . asUint64 ( ) < bidQuantity . asUint64 ( ) ? initialDeposit . asUint64 ( ) : bidQuantity . asUint64 ( )
255
+ const expectedPayment = contract . quantityPrice ( minQuantity , bidPrice . asUint64 ( ) , testAsset . decimals )
256
256
257
257
// Act
258
258
contract . acceptBid ( testAsset , testNonce )
259
259
260
260
// Assert
261
261
const updatedListing = contract . listings ( listingKey ) . value
262
- expect ( updatedListing . deposited . native ) . toEqual ( initialDeposit . native - minQuantity )
262
+ expect ( updatedListing . deposited . asUint64 ( ) ) . toEqual ( initialDeposit . asUint64 ( ) - minQuantity )
263
263
264
264
expect ( ctx . txn . lastGroup . itxnGroups . length ) . toEqual ( 2 )
265
265
0 commit comments