Skip to content

Commit

Permalink
fix: when accessing a member of self, use the source location of th…
Browse files Browse the repository at this point in the history
…e access
  • Loading branch information
achidlow committed Sep 13, 2024
1 parent cb07dcb commit 2f827ab
Show file tree
Hide file tree
Showing 109 changed files with 494 additions and 4,027 deletions.
68 changes: 34 additions & 34 deletions examples/amm/out/ConstantProductAMM.approval.mir

Large diffs are not rendered by default.

174 changes: 3 additions & 171 deletions examples/amm/out/ConstantProductAMM.approval.teal

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/amm/out/ConstantProductAMM.arc32.json

Large diffs are not rendered by default.

174 changes: 3 additions & 171 deletions examples/amm/out_unoptimized/ConstantProductAMM.approval.teal

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions examples/auction/out/Auction.approval.mir

Large diffs are not rendered by default.

82 changes: 4 additions & 78 deletions examples/auction/out/Auction.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,15 @@ opt_into_asset:
// # Verify a ASA hasn't already been opted into
// assert self.asa.id == 0, "ASA already opted in"
int 0
// auction/contract.py:21
// self.asa = Asset()
byte "asa"
// auction/contract.py:29-30
// # Verify a ASA hasn't already been opted into
// assert self.asa.id == 0, "ASA already opted in"
app_global_get_ex
assert // check self.asa exists
!
assert // ASA already opted in
// auction/contract.py:21
// self.asa = Asset()
byte "asa"
// auction/contract.py:31-32
// # Save ASA ID in global state
// self.asa = asset
byte "asa"
frame_dig -1
app_global_put
// auction/contract.py:34-38
Expand Down Expand Up @@ -245,12 +238,7 @@ start_auction:
// # Ensure the auction hasn't already been started
// assert self.auction_end == 0, "auction already started"
int 0
// auction/contract.py:18
// self.auction_end = UInt64(0)
byte "auction_end"
// auction/contract.py:49-50
// # Ensure the auction hasn't already been started
// assert self.auction_end == 0, "auction already started"
app_global_get_ex
assert // check self.auction_end exists
!
Expand All @@ -272,31 +260,20 @@ start_auction:
// self.asa_amount = axfer.asset_amount
frame_dig -1
gtxns AssetAmount
// auction/contract.py:20
// self.asa_amount = UInt64(0)
byte "asa_amount"
// auction/contract.py:57-58
// # Set global state
// self.asa_amount = axfer.asset_amount
swap
app_global_put
// auction/contract.py:59
// self.auction_end = Global.latest_timestamp + length
global LatestTimestamp
frame_dig -2
+
// auction/contract.py:18
// self.auction_end = UInt64(0)
byte "auction_end"
// auction/contract.py:59
// self.auction_end = Global.latest_timestamp + length
swap
app_global_put
// auction/contract.py:19
// self.previous_bid = UInt64(0)
byte "previous_bid"
// auction/contract.py:60
// self.previous_bid = starting_price
byte "previous_bid"
frame_dig -3
app_global_put
retsub
Expand All @@ -313,12 +290,7 @@ bid:
// assert Global.latest_timestamp < self.auction_end, "auction has ended"
global LatestTimestamp
int 0
// auction/contract.py:18
// self.auction_end = UInt64(0)
byte "auction_end"
// auction/contract.py:68-69
// # Ensure auction hasn't ended
// assert Global.latest_timestamp < self.auction_end, "auction has ended"
app_global_get_ex
assert // check self.auction_end exists
<
Expand All @@ -337,41 +309,28 @@ bid:
frame_dig -1
gtxns Amount
int 0
// auction/contract.py:19
// self.previous_bid = UInt64(0)
byte "previous_bid"
// auction/contract.py:73
// assert pay.amount > self.previous_bid, "Bid must be higher than previous bid"
app_global_get_ex
assert // check self.previous_bid exists
dig 1
<
assert // Bid must be higher than previous bid
// auction/contract.py:19
// self.previous_bid = UInt64(0)
byte "previous_bid"
// auction/contract.py:75-76
// # set global state
// self.previous_bid = pay.amount
byte "previous_bid"
dig 1
app_global_put
// auction/contract.py:22
// self.previous_bidder = Account()
byte "previous_bidder"
// auction/contract.py:77
// self.previous_bidder = pay.sender
byte "previous_bidder"
uncover 2
app_global_put
// auction/contract.py:79-80
// # Update claimable amount
// self.claimable_amount[Txn.sender] = pay.amount
txn Sender
// auction/contract.py:23
// self.claimable_amount = LocalState(UInt64, key="claim", description="The claimable amount")
byte "claim"
// auction/contract.py:79-80
// # Update claimable amount
// self.claimable_amount[Txn.sender] = pay.amount
uncover 2
app_local_put
retsub
Expand All @@ -387,11 +346,7 @@ claim_bids:
// amount = original_amount = self.claimable_amount[Txn.sender]
txn Sender
int 0
// auction/contract.py:23
// self.claimable_amount = LocalState(UInt64, key="claim", description="The claimable amount")
byte "claim"
// auction/contract.py:84
// amount = original_amount = self.claimable_amount[Txn.sender]
app_local_get_ex
swap
dup
Expand All @@ -402,24 +357,15 @@ claim_bids:
// if Txn.sender == self.previous_bidder:
txn Sender
int 0
// auction/contract.py:22
// self.previous_bidder = Account()
byte "previous_bidder"
// auction/contract.py:86-87
// # subtract previous bid if sender is previous bidder
// if Txn.sender == self.previous_bidder:
app_global_get_ex
assert // check self.previous_bidder exists
==
bz claim_bids_after_if_else@2
// auction/contract.py:88
// amount -= self.previous_bid
int 0
// auction/contract.py:19
// self.previous_bid = UInt64(0)
byte "previous_bid"
// auction/contract.py:88
// amount -= self.previous_bid
app_global_get_ex
assert // check self.previous_bid exists
frame_dig 0
Expand Down Expand Up @@ -459,11 +405,7 @@ claim_bids_after_if_else@2:
frame_dig 0
uncover 2
-
// auction/contract.py:23
// self.claimable_amount = LocalState(UInt64, key="claim", description="The claimable amount")
byte "claim"
// auction/contract.py:95
// self.claimable_amount[Txn.sender] = original_amount - amount
swap
app_local_put
retsub
Expand All @@ -479,11 +421,7 @@ claim_asset:
// assert Global.latest_timestamp > self.auction_end, "auction has not ended"
global LatestTimestamp
int 0
// auction/contract.py:18
// self.auction_end = UInt64(0)
byte "auction_end"
// auction/contract.py:99
// assert Global.latest_timestamp > self.auction_end, "auction has not ended"
app_global_get_ex
assert // check self.auction_end exists
>
Expand All @@ -500,31 +438,19 @@ claim_asset:
// auction/contract.py:103
// asset_close_to=self.previous_bidder,
int 0
// auction/contract.py:22
// self.previous_bidder = Account()
byte "previous_bidder"
// auction/contract.py:103
// asset_close_to=self.previous_bidder,
app_global_get_ex
assert // check self.previous_bidder exists
// auction/contract.py:104
// asset_receiver=self.previous_bidder,
int 0
// auction/contract.py:22
// self.previous_bidder = Account()
byte "previous_bidder"
// auction/contract.py:104
// asset_receiver=self.previous_bidder,
app_global_get_ex
assert // check self.previous_bidder exists
// auction/contract.py:105
// asset_amount=self.asa_amount,
int 0
// auction/contract.py:20
// self.asa_amount = UInt64(0)
byte "asa_amount"
// auction/contract.py:105
// asset_amount=self.asa_amount,
app_global_get_ex
assert // check self.asa_amount exists
itxn_field AssetAmount
Expand Down
2 changes: 1 addition & 1 deletion examples/auction/out/Auction.arc32.json

Large diffs are not rendered by default.

Loading

0 comments on commit 2f827ab

Please sign in to comment.