Skip to content

Commit

Permalink
send additionalReceiverFunds to inbox after MBR payment
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Nov 1, 2024
1 parent 4891b97 commit 671a7ed
Show file tree
Hide file tree
Showing 9 changed files with 515 additions and 515 deletions.
14 changes: 7 additions & 7 deletions assets/arc-0059/contracts/arc59.algo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ export class ARC59 extends Contract {
const inboxExisted = this.inboxes(receiver).exists;
const inbox = this.arc59_getOrCreateInbox(receiver);

if (additionalReceiverFunds !== 0) {
sendPayment({
receiver: inbox,
amount: additionalReceiverFunds,
});
}

if (!inbox.isOptedInToAsset(axfer.xferAsset)) {
let inboxMbrDelta = globals.assetOptInMinBalance;
if (!inboxExisted) inboxMbrDelta += globals.minBalance;
Expand Down Expand Up @@ -231,6 +224,13 @@ export class ARC59 extends Contract {
xferAsset: axfer.xferAsset,
});

if (additionalReceiverFunds !== 0) {
sendPayment({
receiver: inbox,
amount: additionalReceiverFunds,
});
}

return inbox;
}

Expand Down
126 changes: 63 additions & 63 deletions assets/arc-0059/contracts/artifacts/ARC59.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -836,42 +836,6 @@ arc59_sendAsset:

// *if11_condition
// contracts/arc59.algo.ts:199
// additionalReceiverFunds !== 0
frame_dig -3 // additionalReceiverFunds: uint64
int 0
!=
bz *if11_end

// *if11_consequent
// contracts/arc59.algo.ts:200
// sendPayment({
// receiver: inbox,
// amount: additionalReceiverFunds,
// })
itxn_begin
int pay
itxn_field TypeEnum

// contracts/arc59.algo.ts:201
// receiver: inbox
frame_dig 1 // inbox: address
itxn_field Receiver

// contracts/arc59.algo.ts:202
// amount: additionalReceiverFunds
frame_dig -3 // additionalReceiverFunds: uint64
itxn_field Amount

// Fee field not set, defaulting to 0
int 0
itxn_field Fee

// Submit inner transaction
itxn_submit

*if11_end:
// *if12_condition
// contracts/arc59.algo.ts:206
// !inbox.isOptedInToAsset(axfer.xferAsset)
frame_dig 1 // inbox: address
frame_dig -1 // axfer: AssetTransferTxn
Expand All @@ -880,32 +844,32 @@ arc59_sendAsset:
swap
pop
!
bz *if12_end
bz *if11_end

// *if12_consequent
// contracts/arc59.algo.ts:207
// *if11_consequent
// contracts/arc59.algo.ts:200
// inboxMbrDelta = globals.assetOptInMinBalance
global AssetOptInMinBalance
frame_bury 2 // inboxMbrDelta: uint64

// *if13_condition
// contracts/arc59.algo.ts:208
// *if12_condition
// contracts/arc59.algo.ts:201
// !inboxExisted
frame_dig 0 // inboxExisted: bool
!
bz *if13_end
bz *if12_end

// *if13_consequent
// contracts/arc59.algo.ts:208
// *if12_consequent
// contracts/arc59.algo.ts:201
// inboxMbrDelta += globals.minBalance
frame_dig 2 // inboxMbrDelta: uint64
global MinBalance
+
frame_bury 2 // inboxMbrDelta: uint64

*if13_end:
// *if14_condition
// contracts/arc59.algo.ts:211
*if12_end:
// *if13_condition
// contracts/arc59.algo.ts:204
// inbox.balance < inbox.minBalance + inboxMbrDelta
frame_dig 1 // inbox: address
acct_params_get AcctBalance
Expand All @@ -916,10 +880,10 @@ arc59_sendAsset:
frame_dig 2 // inboxMbrDelta: uint64
+
<
bz *if14_end
bz *if13_end

// *if14_consequent
// contracts/arc59.algo.ts:212
// *if13_consequent
// contracts/arc59.algo.ts:205
// sendPayment({
// receiver: inbox,
// amount: inboxMbrDelta,
Expand All @@ -928,12 +892,12 @@ arc59_sendAsset:
int pay
itxn_field TypeEnum

// contracts/arc59.algo.ts:213
// contracts/arc59.algo.ts:206
// receiver: inbox
frame_dig 1 // inbox: address
itxn_field Receiver

// contracts/arc59.algo.ts:214
// contracts/arc59.algo.ts:207
// amount: inboxMbrDelta
frame_dig 2 // inboxMbrDelta: uint64
itxn_field Amount
Expand All @@ -945,8 +909,8 @@ arc59_sendAsset:
// Submit inner transaction
itxn_submit

*if14_end:
// contracts/arc59.algo.ts:219
*if13_end:
// contracts/arc59.algo.ts:212
// sendAssetTransfer({
// sender: inbox,
// assetReceiver: inbox,
Expand All @@ -957,22 +921,22 @@ arc59_sendAsset:
int axfer
itxn_field TypeEnum

// contracts/arc59.algo.ts:220
// contracts/arc59.algo.ts:213
// sender: inbox
frame_dig 1 // inbox: address
itxn_field Sender

// contracts/arc59.algo.ts:221
// contracts/arc59.algo.ts:214
// assetReceiver: inbox
frame_dig 1 // inbox: address
itxn_field AssetReceiver

// contracts/arc59.algo.ts:222
// contracts/arc59.algo.ts:215
// assetAmount: 0
int 0
itxn_field AssetAmount

// contracts/arc59.algo.ts:223
// contracts/arc59.algo.ts:216
// xferAsset: axfer.xferAsset
frame_dig -1 // axfer: AssetTransferTxn
gtxns XferAsset
Expand All @@ -985,8 +949,8 @@ arc59_sendAsset:
// Submit inner transaction
itxn_submit

*if12_end:
// contracts/arc59.algo.ts:228
*if11_end:
// contracts/arc59.algo.ts:221
// sendAssetTransfer({
// assetReceiver: inbox,
// assetAmount: axfer.assetAmount,
Expand All @@ -996,18 +960,18 @@ arc59_sendAsset:
int axfer
itxn_field TypeEnum

// contracts/arc59.algo.ts:229
// contracts/arc59.algo.ts:222
// assetReceiver: inbox
frame_dig 1 // inbox: address
itxn_field AssetReceiver

// contracts/arc59.algo.ts:230
// contracts/arc59.algo.ts:223
// assetAmount: axfer.assetAmount
frame_dig -1 // axfer: AssetTransferTxn
gtxns AssetAmount
itxn_field AssetAmount

// contracts/arc59.algo.ts:231
// contracts/arc59.algo.ts:224
// xferAsset: axfer.xferAsset
frame_dig -1 // axfer: AssetTransferTxn
gtxns XferAsset
Expand All @@ -1020,6 +984,42 @@ arc59_sendAsset:
// Submit inner transaction
itxn_submit

// *if14_condition
// contracts/arc59.algo.ts:227
// additionalReceiverFunds !== 0
frame_dig -3 // additionalReceiverFunds: uint64
int 0
!=
bz *if14_end

// *if14_consequent
// contracts/arc59.algo.ts:228
// sendPayment({
// receiver: inbox,
// amount: additionalReceiverFunds,
// })
itxn_begin
int pay
itxn_field TypeEnum

// contracts/arc59.algo.ts:229
// receiver: inbox
frame_dig 1 // inbox: address
itxn_field Receiver

// contracts/arc59.algo.ts:230
// amount: additionalReceiverFunds
frame_dig -3 // additionalReceiverFunds: uint64
itxn_field Amount

// Fee field not set, defaulting to 0
int 0
itxn_field Fee

// Submit inner transaction
itxn_submit

*if14_end:
// contracts/arc59.algo.ts:234
// return inbox;
frame_dig 1 // inbox: address
Expand Down
2 changes: 1 addition & 1 deletion assets/arc-0059/contracts/artifacts/ARC59.arc32.json

Large diffs are not rendered by default.

Loading

0 comments on commit 671a7ed

Please sign in to comment.