-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlimit-order.teal
66 lines (56 loc) · 1.18 KB
/
limit-order.teal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// This example is provided for informational purposes only and has not been audited for security.
#pragma version 3
// 确定当前交易(即从合约中提取代币的交易)是该交易组里的第一笔
txn GroupIndex
int 0
==
// 确定该交易的类型是 ALGO 的 Payment 交易
txn TypeEnum
int 1
==
&&
// 确定交易手续费小于等于 0.02 ALGO
txn Fee
int 20000
<=
&&
// 确定当前交易的数额是 10
txn Amount
int 10
==
&&
// 确定当前交易不是关闭帐户用的交易
txn CloseRemainderTo
global ZeroAddress
==
&&
// 确定该交易组中有且仅有两笔交易
global GroupSize
int 2
==
&&
// 确定交易组中的第二笔交易是一个 ASA 的转账交易
gtxn 1 TypeEnum
int 4
==
&&
// 确定该交易使用的 ASA 的 ID
gtxn 1 XferAsset
int 15977673
==
&&
// 确定该交易的接受者是 Alice 的地址
gtxn 1 AssetReceiver
addr 2YI264DKCDYQX5XMVFAQYXBV3PRJATRBNUN2UKPYJGK6KWNRF6XYUVPHQA
==
&&
// 确定该交易不是一个 ASA 的召回交易; 参考:https://developer.algorand.org/docs/reference/transactions/#asset-transfer-transaction
gtxn 1 AssetSender
global ZeroAddress
==
&&
// 确定该交易时转账 10 个 ASA
gtxn 1 AssetAmount
int 10
==
&&