Skip to content

Commit

Permalink
test: Bump pay txn amount up to cover the MBR of the app account
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Dec 17, 2024
1 parent 92cdfe0 commit ee0f892
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/approvals/assert-match.algo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertMatch, Contract, Global, Txn } from '@algorandfoundation/algorand
export class AssertMatchContract extends Contract {
public testPay(pay: gtxn.PaymentTxn): boolean {
assertMatch(pay, {
amount: { between: [0, 50000] },
amount: { between: [100_000, 105_000] },
sender: Txn.sender,
receiver: Global.currentApplicationAddress,
closeRemainderTo: Global.zeroAddress,
Expand Down
26 changes: 13 additions & 13 deletions tests/approvals/out/assert-match/AssertMatchContract.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ testPay:
proto 1 1
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -105,11 +105,11 @@ testPay:
frame_dig -1
gtxns Amount
// tests/approvals/assert-match.algo.ts:7
// amount: { between: [0, 50000] },
pushint 50000 // 50000
// amount: { between: [100_000, 105_000] },
pushint 105000 // 105000
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -121,11 +121,11 @@ testPay:
frame_dig -1
gtxns Amount
// tests/approvals/assert-match.algo.ts:7
// amount: { between: [0, 50000] },
intc_0 // 0
// amount: { between: [100_000, 105_000] },
pushint 100000 // 100000
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -141,7 +141,7 @@ testPay:
txn Sender
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -157,7 +157,7 @@ testPay:
global CurrentApplicationAddress
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -173,7 +173,7 @@ testPay:
global ZeroAddress
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -189,7 +189,7 @@ testPay:
intc_1 // 1
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -205,7 +205,7 @@ testPay:
pushint 1099511627776 // 1099511627776
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand All @@ -223,7 +223,7 @@ testPay_bool_false@8:
testPay_bool_merge@9:
// tests/approvals/assert-match.algo.ts:6-13
// assertMatch(pay, {
// amount: { between: [0, 50000] },
// amount: { between: [100_000, 105_000] },
// sender: Txn.sender,
// receiver: Global.currentApplicationAddress,
// closeRemainderTo: Global.zeroAddress,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/approvals/out/assert-match/AssertMatchContract.ssa.ir
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ contract tests/approvals/assert-match.algo.ts::AssertMatchContract:
subroutine tests/approvals/assert-match.algo.ts::AssertMatchContract.testPay(pay: uint64) -> bool:
block@0: // L5
let tmp%0#0: uint64 = ((gtxns Amount) pay#0)
let tmp%1#0: bool = (<= tmp%0#0 50000u)
let tmp%1#0: bool = (<= tmp%0#0 105000u)
goto tmp%1#0 ? block@1 : block@8
block@1: // and_contd_L6
let tmp%2#0: uint64 = ((gtxns Amount) pay#0)
let tmp%3#0: bool = (>= tmp%2#0 0u)
let tmp%3#0: bool = (>= tmp%2#0 100000u)
goto tmp%3#0 ? block@2 : block@8
block@2: // and_contd_L6
let tmp%4#0: bytes = ((gtxns Sender) pay#0)
Expand Down
2 changes: 1 addition & 1 deletion tests/approvals/out/assert-match/assert-match.awst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract AssertMatchContract

testPay(): bool
{
assert(gtxns<Amount>(pay) <= 50000 and gtxns<Amount>(pay) >= 0 and gtxns<Sender>(pay) == txn<Sender>() and gtxns<Receiver>(pay) == global<CurrentApplicationAddress>() and gtxns<CloseRemainderTo>(pay) == global<ZeroAddress>() and gtxns<FirstValid>(pay) > 1 and gtxns<LastValid>(pay) < 1099511627776, comment=assert target is match for conditions)
assert(gtxns<Amount>(pay) <= 105000 and gtxns<Amount>(pay) >= 100000 and gtxns<Sender>(pay) == txn<Sender>() and gtxns<Receiver>(pay) == global<CurrentApplicationAddress>() and gtxns<CloseRemainderTo>(pay) == global<ZeroAddress>() and gtxns<FirstValid>(pay) > 1 and gtxns<LastValid>(pay) < 1099511627776, comment=assert target is match for conditions)
return True
}

Expand Down
10 changes: 5 additions & 5 deletions tests/approvals/out/assert-match/assert-match.awst.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@
"file": "tests/approvals/assert-match.algo.ts",
"line": 7,
"end_line": 7,
"column": 29,
"end_column": 34
"column": 35,
"end_column": 42
},
"wtype": {
"_type": "WType",
Expand All @@ -404,7 +404,7 @@
"ephemeral": false,
"scalar_type": 2
},
"value": "50000",
"value": "105000",
"teal_alias": null
}
},
Expand Down Expand Up @@ -475,7 +475,7 @@
"line": 7,
"end_line": 7,
"column": 26,
"end_column": 27
"end_column": 33
},
"wtype": {
"_type": "WType",
Expand All @@ -484,7 +484,7 @@
"ephemeral": false,
"scalar_type": 2
},
"value": "0",
"value": "100000",
"teal_alias": null
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/onchain/assert-match.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('assert match', () => {
const payment = algorand.createTransaction.payment({
receiver: appClientAssertMatchContract.appAddress,
sender: testAccount.addr,
amount: microAlgos(5000),
amount: microAlgos(105000),
})
await appClientAssertMatchContract.send.call({ method: 'testPay', args: [payment] })
})
Expand Down

0 comments on commit ee0f892

Please sign in to comment.