-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f94d9f4
commit c6670f7
Showing
8 changed files
with
1,379 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { uint64 } from '@algorandfoundation/algorand-typescript' | ||
import { BaseContract } from '@algorandfoundation/algorand-typescript' | ||
|
||
export class CastingAlgo extends BaseContract { | ||
approvalProgram(): boolean { | ||
const x = 123 as uint64 | ||
|
||
const y = [1, 2, 3] as [uint64, uint64, uint64] | ||
|
||
const z = [1 as uint64, 2 as uint64, 3 as uint64] as const | ||
|
||
return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma version 10 | ||
|
||
tests/approvals/casting.algo.ts::CastingAlgo.approvalProgram: | ||
intcblock 1 2 3 | ||
txn ApplicationID | ||
bnz main_after_if_else@2 | ||
callsub constructor | ||
|
||
main_after_if_else@2: | ||
// tests/approvals/casting.algo.ts:8 | ||
// const y = [1, 2, 3] as [uint64, uint64, uint64] | ||
intc_0 // 1 | ||
intc_1 // 2 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
* | ||
// tests/approvals/casting.algo.ts:8 | ||
// const y = [1, 2, 3] as [uint64, uint64, uint64] | ||
intc_2 // 3 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
* | ||
// tests/approvals/casting.algo.ts:10 | ||
// const z = [1 as uint64, 2 as uint64, 3 as uint64] as const | ||
intc_0 // 1 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
* | ||
// tests/approvals/casting.algo.ts:10 | ||
// const z = [1 as uint64, 2 as uint64, 3 as uint64] as const | ||
intc_1 // 2 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
* | ||
// tests/approvals/casting.algo.ts:10 | ||
// const z = [1 as uint64, 2 as uint64, 3 as uint64] as const | ||
intc_2 // 3 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
* | ||
// tests/approvals/casting.algo.ts:6 | ||
// const x = 123 as uint64 | ||
pushint 123 // 123 | ||
// tests/approvals/casting.algo.ts:12 | ||
// return x > y[0] * y[1] * y[2] * z[0] * z[1] * z[2] | ||
< | ||
return | ||
|
||
|
||
// tests/approvals/casting.algo.ts::CastingAlgo.constructor() -> void: | ||
constructor: | ||
// tests/approvals/casting.algo.ts:4 | ||
// export class CastingAlgo extends BaseContract { | ||
proto 0 0 | ||
retsub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma version 10 | ||
|
||
tests/approvals/casting.algo.ts::CastingAlgo.clearStateProgram: | ||
pushint 1 // 1 | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
contract tests/approvals/casting.algo.ts::CastingAlgo: | ||
program approval: | ||
subroutine tests/approvals/casting.algo.ts::CastingAlgo.approvalProgram() -> bool: | ||
block@0: // L5 | ||
let reinterpret_bool%0#0: bool = (txn ApplicationID) | ||
goto reinterpret_bool%0#0 ? block@2 : block@1 | ||
block@1: // if_body_L1 | ||
tests/approvals/casting.algo.ts::CastingAlgo.constructor() | ||
goto block@2 | ||
block@2: // after_if_else_L1 | ||
let x#0: uint64 = 123u | ||
let (y.0#0: uint64, y.1#0: uint64, y.2#0: uint64) = (1u, 2u, 3u) | ||
let (z.0#0: uint64, z.1#0: uint64, z.2#0: uint64) = (1u, 2u, 3u) | ||
let tmp%0#0: uint64 = (* y.0#0 y.1#0) | ||
let tmp%1#0: uint64 = (* tmp%0#0 y.2#0) | ||
let tmp%2#0: uint64 = (* tmp%1#0 z.0#0) | ||
let tmp%3#0: uint64 = (* tmp%2#0 z.1#0) | ||
let tmp%4#0: uint64 = (* tmp%3#0 z.2#0) | ||
let tmp%5#0: bool = (> x#0 tmp%4#0) | ||
return tmp%5#0 | ||
|
||
subroutine tests/approvals/casting.algo.ts::CastingAlgo.constructor() -> void: | ||
block@0: // L4 | ||
return | ||
|
||
program clear-state: | ||
subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: | ||
block@0: // L1 | ||
return 1u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
contract CastingAlgo | ||
{ | ||
approvalProgram(): bool | ||
{ | ||
if (!Boolean(txn<ApplicationID>())) { | ||
this.constructor() | ||
} | ||
x: uint64 = 123 | ||
y: readonlytuple[uint64, uint64, uint64] = <tuple>[1, 2, 3] | ||
z: readonlytuple[uint64, uint64, uint64] = <tuple>[1, 2, 3] | ||
return x > y.0 * y.1 * y.2 * z.0 * z.1 * z.2 | ||
} | ||
|
||
clearProgram(): bool | ||
{ | ||
return True | ||
} | ||
|
||
constructor(): void | ||
{ | ||
void | ||
} | ||
|
||
BaseContract::constructor(): void | ||
{ | ||
} | ||
|
||
} |
Oops, something went wrong.