-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathERC20-TokenScript.xml
More file actions
175 lines (168 loc) · 7.37 KB
/
ERC20-TokenScript.xml
File metadata and controls
175 lines (168 loc) · 7.37 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE token [
<!ENTITY style SYSTEM "layouts/shared.css">
<!ENTITY item-view-sent.en SYSTEM "layouts/item-view-sent.en.js">
<!ENTITY item-view-received.en SYSTEM "layouts/item-view-sent.en.js">
<!ENTITY item-view-approvalObtained.en SYSTEM "layouts/item-view-approvalObtained.en.js">
<!ENTITY item-view-ownerApproved.en SYSTEM "layouts/item-view-ownerApproved.en.js">
<!ENTITY sent.en SYSTEM "layouts/sent.en.js">
<!ENTITY received.en SYSTEM "layouts/received.en.js">
<!ENTITY receivedApproval.en SYSTEM "layouts/receivedApproval.en.js">
<!ENTITY gaveApproval.en SYSTEM "layouts/gaveApproval.en.js">
]>
<ts:token xmlns:ts="http://tokenscript.org/2020/06/tokenscript"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:asnx="urn:ietf:params:xml:ns:asnx"
xmlns:ethereum="urn:ethereum:constantinople"
xsi:schemaLocation="http://tokenscript.org/2020/06/tokenscript http://tokenscript.org/2020/06/tokenscript.xsd"
custodian="false"
>
<asnx:module name="ERC20-Events">
<namedType name="Approval">
<type>
<sequence>
<element name="owner" ethereum:type="address" ethereum:indexed="true"/>
<element name="spender" ethereum:type="address" ethereum:indexed="true"/>
<element name="value" ethereum:type="uint256" ethereum:indexed="false"/>
</sequence>
</type>
</namedType>
<namedType name="Transfer">
<type>
<sequence>
<element name="from" ethereum:type="address" ethereum:indexed="true"/>
<element name="to" ethereum:type="address" ethereum:indexed="true"/>
<element name="value" ethereum:type="uint256" ethereum:indexed="false"/>
</sequence>
</type>
</namedType>
</asnx:module>
<ts:cards>
<ts:card type="activity" name="sent">
<ts:attribute name="amount">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:origins>
<ethereum:event type="Transfer" filter="${from}=${ownerAddress}" select="amount"/>
</ts:origins>
</ts:attribute>
<ts:item-view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&item-view-sent.en;</script>
</ts:item-view>
<ts:view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&sent.en;</script>
</ts:view>
</ts:card>
<ts:card type="activity" name="received">
<ts:attribute name="amount">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:origins>
<ethereum:event type="Transfer" filter="${to}=${ownerAddress}" select="amount"/>
</ts:origins>
</ts:attribute>
<ts:item-view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&item-view-received.en;</script>
</ts:item-view>
<ts:view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&received.en;</script>
</ts:view>
</ts:card>
<ts:card type="activity" name="ownerApproved">
<ts:attribute name="amount">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:origins>
<ethereum:event type="Approval" filter="${from}=${ownerAddress}" select="amount"/>
</ts:origins>
</ts:attribute>
<ts:attribute name="to">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:origins>
<ethereum:event type="Approval" filter="${to}=${ownerAddress}"/>
</ts:origins>
</ts:attribute>
<ts:item-view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&item-view-ownerApproved.en;</script>
</ts:item-view>
<ts:view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&gaveApproval.en;</script>
</ts:view>
</ts:card>
<ts:card type="activity" name="approvalObtained">
<!-- attributes like amount, from, to shouldn't need to be
defined here because they are implied -->
<ts:source>
<!-- contract="…" is missing, this might be a problem -->
<ethereum:event type="Approval" filter="${to}=${ownerAddress}" />
</ts:source>
<ts:item-view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&item-view-approvalObtained.en;</script>
</ts:item-view>
<ts:view xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">&style;</style>
<script type="text/javascript">&receivedApproval.en;</script>
</ts:view>
</ts:card>
</ts:cards>
<ts:attribute name="name">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.26</ts:syntax>
</ts:type>
<ts:label>
<ts:string xml:lang="en">name</ts:string>
</ts:label>
<ts:origins>
<ethereum:call function="name" contract="ERC20" as="utf8"/>
</ts:origins>
</ts:attribute>
<ts:attribute name="ownerBalance">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:label>
<ts:string xml:lang="en">balance</ts:string>
</ts:label>
<ts:origins>
<ethereum:call function="balanceOf" contract="ERC20" as="uint">
<ts:data>
<ts:address ref="ownerAddress"/>
</ts:data>
</ethereum:call>
</ts:origins>
</ts:attribute>
<ts:attribute name="decimals">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.36</ts:syntax>
</ts:type>
<ts:label>
<ts:string xml:lang="en">decimals</ts:string>
</ts:label>
<ts:origins>
<ethereum:call function="decimals" contract="ERC20" as="uint"/>
</ts:origins>
</ts:attribute>
<ts:attribute name="symbol">
<ts:type>
<ts:syntax>1.3.6.1.4.1.1466.115.121.1.26</ts:syntax>
</ts:type>
<ts:label>
<ts:string xml:lang="en">symbol</ts:string>
</ts:label>
<ts:origins>
<ethereum:call function="symbol" contract="ERC20" as="utf8"/>
</ts:origins>
</ts:attribute>
</ts:token>