├── .all-contributorsrc ├── .gitignore ├── .travis.yml ├── 1.jpg ├── LICENSE ├── README.md ├── examples ├── 2020-06.mk ├── ENS │ ├── ENS.xml │ ├── Makefile │ ├── item-view.css │ ├── item-view.en.js │ ├── package-lock.json │ ├── package.json │ ├── records.en.js │ ├── recordsBundle.en.js │ ├── renew.en.js │ ├── shared.css │ ├── view.css │ ├── view.en.js │ └── viewBundle.en.js ├── EntryToken │ ├── EntryToken.xml │ ├── Makefile │ ├── enter.en.js │ ├── enter.en.shtml │ ├── icon.en.shtml │ ├── js │ │ ├── generalized-time-test.html │ │ └── generalized-time.js │ ├── shared.css │ ├── shong.wang.p12 │ └── token.en.js ├── Karma │ ├── Makefile │ ├── attestations.en.shtml │ ├── item-view.en.shtml │ ├── karma.xml │ ├── market.en.shtml │ ├── start.en.shtml │ └── style.css ├── UEFA │ ├── Makefile │ ├── UEFA.en.js │ ├── UEFA.xml │ ├── UEFA.zh.js │ └── shared.css ├── action │ ├── Makefile │ ├── XDAI-bridge.xml │ ├── shared.css │ └── xdai-bridge.en.js ├── edcon │ ├── Makefile │ ├── shared.css │ ├── unicon.en.js │ └── unicon.xml ├── erc20 │ ├── AAVE │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── aDAI.xml │ │ ├── enable.en.js │ │ ├── shared.css │ │ ├── supply.en.js │ │ └── withdraw.en.js │ ├── BestRates │ │ └── bestRates.en.js │ ├── COMP │ │ ├── COMP.xml │ │ ├── Makefile │ │ ├── README.md │ │ ├── about.en.js │ │ ├── claim.en.js │ │ ├── delegate.en.js │ │ └── shared.css │ ├── Compound │ │ ├── Makefile │ │ ├── cBAT.xml │ │ ├── cDAI.xml │ │ ├── cETH.xml │ │ ├── cREP.xml │ │ ├── cSAI.xml │ │ ├── cUSDC.xml │ │ ├── cWBTC.xml │ │ ├── cZRX.xml │ │ ├── enable.en.js │ │ ├── shared.css │ │ ├── supply.en.js │ │ └── withdraw.en.js │ ├── DAI │ │ ├── DAI.xml │ │ ├── Makefile │ │ ├── dai-bridge.en.js │ │ └── shared.css │ ├── DDEX │ │ ├── Makefile │ │ ├── guide.en.js │ │ ├── pDAI.xml │ │ ├── pETH.xml │ │ ├── pUSDT.xml │ │ └── shared.css │ ├── DeFiMoneyMarket │ │ ├── Makefile │ │ ├── enable.en.js │ │ ├── mDAI.xml │ │ ├── mETH.xml │ │ ├── mUSDC.xml │ │ ├── shared.css │ │ ├── supply.en.js │ │ └── withdraw.en.js │ ├── NEST │ │ ├── Makefile │ │ ├── NEST.xml │ │ ├── deposit.en.js │ │ ├── dividend.en.js │ │ ├── enable.en.js │ │ ├── shared.css │ │ └── withdraw.en.js │ ├── SAI │ │ ├── Makefile │ │ ├── SAI.xml │ │ ├── important.en.js │ │ └── shared.css │ ├── USDC │ │ ├── Makefile │ │ └── USDC.xml │ ├── Uniswap │ │ ├── Makefile │ │ ├── about.en.shtml │ │ ├── daiPool.xml │ │ ├── saiPool.xml │ │ ├── sethPool.xml │ │ ├── shared.css │ │ ├── usdcPool.xml │ │ ├── wbtcPool.xml │ │ └── wethPool.xml │ ├── WETH │ │ ├── Makefile │ │ ├── WETH.xml │ │ ├── shared.css │ │ ├── weth-unwrap.en.js │ │ └── weth-wrap.en.js │ └── dForce │ │ ├── Makefile │ │ ├── USDx.xml │ │ ├── guide.en.js │ │ ├── moreInfo.en.js │ │ └── shared.css ├── fifa │ ├── Makefile │ ├── fifa.en.js │ ├── fifa.xml │ └── shared.css └── validate.sh ├── img └── readme │ └── tokenscript-examples.jpg ├── resources └── fast-token-onboarding │ ├── README.md │ ├── erc20.canonicalized.xml │ ├── erc721.canonicalized.xml │ └── sign.sh └── tutorial ├── README.md ├── img └── QR_EntryToken_ETH_address.png ├── step-1-forming-the-layout.md ├── step-2-assembling-the-XML-file.md ├── step-3-debugging-and-testing.md ├── step-4-signing-and-publishing.md └── tutorial-files ├── Coin.sol ├── Coin.xml ├── Makefile ├── app.css └── mint.shtml /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "James-Sangalli", 10 | "name": "James Sangalli", 11 | "avatar_url": "https://avatars2.githubusercontent.com/u/16630514?v=4", 12 | "profile": "https://github.com/James-Sangalli", 13 | "contributions": [ 14 | "code" 15 | ] 16 | }, 17 | { 18 | "login": "colourful-land", 19 | "name": "Weiwu Zhang", 20 | "avatar_url": "https://avatars3.githubusercontent.com/u/548435?v=4", 21 | "profile": "https://github.com/colourful-land", 22 | "contributions": [ 23 | "code" 24 | ] 25 | }, 26 | { 27 | "login": "jzaki", 28 | "name": "James Zaki", 29 | "avatar_url": "https://avatars3.githubusercontent.com/u/939603?v=4", 30 | "profile": "https://github.com/jzaki", 31 | "contributions": [ 32 | "code" 33 | ] 34 | }, 35 | { 36 | "login": "JamesSmartCell", 37 | "name": "James Brown", 38 | "avatar_url": "https://avatars2.githubusercontent.com/u/12689544?v=4", 39 | "profile": "https://github.com/JamesSmartCell", 40 | "contributions": [ 41 | "code" 42 | ] 43 | }, 44 | { 45 | "login": "hboon", 46 | "name": "Hwee-Boon Yar", 47 | "avatar_url": "https://avatars1.githubusercontent.com/u/56189?v=4", 48 | "profile": "https://github.com/hboon", 49 | "contributions": [ 50 | "code" 51 | ] 52 | }, 53 | { 54 | "login": "zhangzhongnan928", 55 | "name": "Victor Zhang", 56 | "avatar_url": "https://avatars0.githubusercontent.com/u/33795543?v=4", 57 | "profile": "https://github.com/zhangzhongnan928", 58 | "contributions": [ 59 | "code" 60 | ] 61 | }, 62 | { 63 | "login": "hellolucas", 64 | "name": "Lucas Toledo", 65 | "avatar_url": "https://avatars3.githubusercontent.com/u/17125002?v=4", 66 | "profile": "https://github.com/hellolucas", 67 | "contributions": [ 68 | "code" 69 | ] 70 | }, 71 | { 72 | "login": "ChintanRathod", 73 | "name": "Chintan Rathod", 74 | "avatar_url": "https://avatars0.githubusercontent.com/u/4371780?s=460&u=aeffa77e91dfaf95990f355328b2b0636bcb9877&v=4", 75 | "profile": "https://github.com/ChintanRathod", 76 | "contributions": [ 77 | "code" 78 | ] 79 | }, 80 | { 81 | "login": "coreycaplan3", 82 | "name": "Corey Caplan", 83 | "avatar_url": "https://avatars3.githubusercontent.com/u/13280244?s=460&u=4a4261476b882e93238af58910e3b39150216454&v=4", 84 | "profile": "https://github.com/coreycaplan3", 85 | "contributions": [ 86 | "code" 87 | ] 88 | } 89 | ], 90 | "contributorsPerLine": 5, 91 | "projectName": "tokenscript-examples", 92 | "projectOwner": "AlphaWallet", 93 | "repoType": "github", 94 | "repoHost": "https://github.com", 95 | "skipCi": true 96 | } 97 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | *.TEST 3 | .DS_Store 4 | .idea 5 | *.canonicalized.xml 6 | *.canonicalized.xml.* 7 | !resources/fast-token-onboarding/*.canonicalized.xml 8 | *.tsml 9 | *.p12 10 | !shong.wang.p12 11 | /examples/ENS/node_modules/ 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: osx 2 | 3 | language: bash 4 | 5 | branches: 6 | only: 7 | - master 8 | env: 9 | - LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 10 | 11 | before_install: 12 | - brew update 13 | - brew install xmlsectool 14 | - brew install xmlstarlet 15 | 16 | script: 17 | - cd examples && ./validate.sh */*.xml */*/*.xml 18 | 19 | after_success: 20 | - bash <(curl -s https://codecov.io/bash) 21 | -------------------------------------------------------------------------------- /1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartTokenLabs/TokenScript-Examples/ddfe8425b5d27277aed3f4a15594b23da8caf416/1.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 AlphaWallet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/2020-06.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(TOKENSCRIPT_SCHEMA),) 2 | TOKENSCRIPT_SCHEMA=http://tokenscript.org/2020/06/tokenscript.xsd 3 | endif 4 | 5 | ifeq ($(XMLSECTOOL),) 6 | XMLSECTOOL=xmlsectool 7 | endif 8 | 9 | ifeq ($(XMLLINT),) 10 | XMLLINT=xmllint 11 | endif 12 | 13 | ifeq ($(XMLSEC),) 14 | XMLSEC=xmlsec1 # xmlsec for Linux/Windows 15 | endif 16 | 17 | ifeq ($(SIGNATURE_ALGORITHM),) 18 | SIGNATURE_ALGORITHM=rsa-sha256 19 | endif 20 | 21 | help: 22 | # Needs a target, example: $$ make EntryToken.canonicalized.xml 23 | # 24 | # Let's say you have a TokenScript "EntryToken.xml" 25 | # - to validate and canonicalize, add 'canonicalized' in the filename 26 | @echo $$ make EntryToken.canonicalized.xml 27 | # - to sign, use tsml as file extension: 28 | @echo $$ make EntryToken.tsml 29 | 30 | %.canonicalized.xml : %.xml 31 | # XML canonicalization and validation against TS schema 32 | $(XMLLINT) --c14n $^ > $@ && \ 33 | $(XMLLINT) --noout --schema $(TOKENSCRIPT_SCHEMA) $@ || \ 34 | (mv $@ $@.TEST && exit 1) 35 | 36 | %.tsml: %.canonicalized.xml 37 | ifeq (,$(KEYPARAMS)) 38 | @echo ---------------- KEYPARAMS missing. Examples on how to use this ---------------- 39 | @echo Example using key file and certificate files 40 | @echo $$ make SIGNATURE_ALGORITHM=ecdsa-sha256 KEYPARAMS='"--key ~/KEYS/aw.app.key --certificate ~/KEYS/positiveSSL/aw_app.crt --keyInfoKeyName AlphaWallet"' $@ 41 | @echo Example using keystore file 42 | @echo $$ make KEYPARAMS='--keystore shong.wang.p12 --keyPassword=shong.wang --keyInfoName="Shong Wang"' $@ 43 | @echo replace it with your .p12 file and your password 44 | rm $^ 45 | else 46 | # Signing with xmlsec requires original .xml file to contain the Signature tag. 47 | # $(XMLSEC) sign --pkcs12:"$(KEYINFO)" $(KEYSTORE) --pwd "$(KEYPASSWORD)" --output $@ $^ 48 | # For now use xmlsectool... 49 | $(XMLSECTOOL) --sign --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#$(SIGNATURE_ALGORITHM) --inFile $^ --outFile $@ --signaturePosition LAST $(KEYPARAMS) 50 | # removing the canonicalized created for validation 51 | rm $^ 52 | endif 53 | -------------------------------------------------------------------------------- /examples/ENS/ENS.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ]> 12 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ENS 37 | 38 | 39 | 40 | 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85 41 | 42 | 43 | 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e 44 | 45 | 46 | 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41 47 | 48 | 49 | 50 | 51 | 0x283af0b28c62c092c9727f1ee09c02ca627eb7f5 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | &item-view-style; 62 | &item-view.en; 63 | 64 | 65 | &view-style; 66 | &view.en; 67 | 68 | 69 | 70 | 71 | 72 | Records 73 | 74 | 75 | 76 | 1.3.6.1.4.1.1466.115.121.1.15 77 | 78 | new record value 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 1.3.6.1.4.1.1466.115.121.1.15 87 | 88 | 89 | 90 | 91 | email 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | email 102 | 103 | 104 | 105 | 106 | 107 | 108 | &style; 109 | &records.en; 110 | 111 | 112 | 113 | 114 | 115 | 116 | Renew 117 | 118 | 119 | 120 | 1.3.6.1.4.1.1466.115.121.1.36 121 | 122 | renewal price per year 123 | 124 | 125 | 126 | 127 | 128 | 31556952 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 31556952 139 | 140 | 141 | 142 | 143 | 144 | &style; 145 | &renew.en; 146 | 147 | 148 | 149 | 150 | 151 | 152 | 1.3.6.1.4.1.1466.115.121.1.15 153 | 154 | 155 | 156 | 157 | 158 | 159 | 1.3.6.1.4.1.1466.115.121.1.36 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 1.3.6.1.4.1.1466.115.121.1.15 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /examples/ENS/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/ENS/item-view.css: -------------------------------------------------------------------------------- 1 | .item-view-container { 2 | width: 360px; 3 | height: 80px; 4 | background-color: #ffffff; 5 | } 6 | 7 | .arrow { 8 | position: absolute; 9 | left: 95%; 10 | top: 50%; 11 | margin-left: auto; 12 | margin-right: auto; 13 | display: block; 14 | padding-top: 11%; 15 | } 16 | 17 | .ensInfoBox { 18 | float: right; 19 | } 20 | 21 | .ENS-logo { 22 | width: 40px; 23 | height: 40px; 24 | object-fit: contain; 25 | float: left; 26 | padding: 7% 2.5% 5%; 27 | } 28 | 29 | .ens-title { 30 | width: 264px; 31 | height: 25%; 32 | font-family: SourceSansPro, sans-serif; 33 | font-size: 20px; 34 | font-weight: normal; 35 | font-stretch: normal; 36 | font-style: normal; 37 | line-height: 1.7; 38 | letter-spacing: normal; 39 | color: #000000; 40 | } 41 | 42 | .token-interface-details { 43 | width: 282px; 44 | height: 20px; 45 | font-family: SourceSansPro, sans-serif; 46 | font-size: 12px; 47 | font-weight: normal; 48 | font-stretch: normal; 49 | font-style: normal; 50 | line-height: 1.67; 51 | letter-spacing: normal; 52 | color: #727272; 53 | } 54 | 55 | #ensNameText { 56 | width: 264px; 57 | height: 34px; 58 | font-family: SourceSansPro-Regular, sans-serif; 59 | font-size: 20px; 60 | font-weight: normal; 61 | font-stretch: normal; 62 | font-style: normal; 63 | line-height: 1.7; 64 | letter-spacing: normal; 65 | color: #000000; 66 | } 67 | 68 | #ensInfo { 69 | width: 282px; 70 | height: 20px; 71 | font-family: SourceSansPro-Regular, sans-serif; 72 | font-size: 12px; 73 | font-weight: normal; 74 | font-stretch: normal; 75 | font-style: normal; 76 | line-height: 1.67; 77 | letter-spacing: normal; 78 | color: #727272; 79 | } 80 | -------------------------------------------------------------------------------- /examples/ENS/item-view.en.js: -------------------------------------------------------------------------------- 1 | // 24 | 27 |
28 |
29 |

${this.props.fullName}

30 |
31 |
32 |

Ethereum Name Service | ERC721

33 |
34 |
35 |
36 | 37 | 38 |
39 | `; 40 | } 41 | } 42 | 43 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenCardId) => { 44 | const currentTokenInstance = updatedTokens.currentInstance; 45 | let token = new Token(currentTokenInstance); 46 | document.getElementById(tokenCardId).innerHTML = token.render(); 47 | token.displayWarningNotOnLatestRegistry(); 48 | }; 49 | 50 | //]]> 51 | -------------------------------------------------------------------------------- /examples/ENS/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ENS", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "subdomain.en.js", 6 | "scripts": { 7 | "build": "browserify records.en.js > recordsBundle.en.js && browserify view.en.js > viewBundle.en.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "MIT", 12 | "dependencies": { 13 | "eth-ens-namehash": "^2.0.8" 14 | }, 15 | "devDependencies": { 16 | "browserify": "^16.5.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/ENS/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | #duration { 15 | -webkit-appearance: menulist-button; 16 | height: 25px; 17 | width: 50%; 18 | } 19 | body { 20 | margin: 0px; 21 | padding: 0px; 22 | overflow-x: hidden; 23 | min-width: 320px; 24 | background: #FFFFFF; 25 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 26 | font-size: 14px; 27 | line-height: 1.4285em; 28 | color: rgba(0, 0, 0, 0.87); 29 | font-smoothing: antialiased; 30 | } 31 | .ui.container { 32 | display: block; 33 | max-width: 100% !important; 34 | } 35 | @media only screen and (max-width: 767px) { 36 | .ui.container { 37 | width: auto !important; 38 | margin-left: 1em !important; 39 | margin-right: 1em !important; 40 | } 41 | } 42 | @media only screen and (min-width: 768px) and (max-width: 991px) { 43 | .ui.container { 44 | width: 723px; 45 | margin-left: auto !important; 46 | margin-right: auto !important; 47 | } 48 | } 49 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 50 | .ui.container { 51 | width: 933px; 52 | margin-left: auto !important; 53 | margin-right: auto !important; 54 | } 55 | } 56 | @media only screen and (min-width: 1200px) { 57 | .ui.container { 58 | width: 1127px; 59 | margin-left: auto !important; 60 | margin-right: auto !important; 61 | } 62 | } 63 | .ui.segment { 64 | position: relative; 65 | background: #FFFFFF; 66 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 67 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 68 | margin: 0.5rem 0em; 69 | padding: 0.5em 0.5em; 70 | border-radius: 0.28571429rem; 71 | border: 1px solid rgba(34, 36, 38, 0.15); 72 | text-align: center; 73 | } 74 | .ui.segment:first-child { 75 | margin-top: 0em; 76 | } 77 | .ui.segment:last-child { 78 | margin-bottom: 0em; 79 | } 80 | input { 81 | position: relative; 82 | font-weight: normal; 83 | font-style: normal; 84 | font-size: 12px; 85 | display: -ms-inline-flexbox; 86 | display: inline-flex; 87 | color: rgba(0, 0, 0, 0.87); 88 | padding: 9.5px 14px; 89 | width: 300px; 90 | border-color: #D8D8D8; 91 | } 92 | input[type=text]:focus { 93 | border-color: #D8D8D8; 94 | background: #FAFAFA; 95 | color: rgba(0, 0, 0, 0.87); 96 | -webkit-box-shadow: none; 97 | box-shadow: none; 98 | } 99 | label { 100 | font-size: 12px; 101 | font-weight: 500; 102 | margin-top: 6px; 103 | } 104 | -------------------------------------------------------------------------------- /examples/ENS/view.css: -------------------------------------------------------------------------------- 1 | #view { 2 | width: 100%; 3 | height: 100%; 4 | } 5 | 6 | .title-container { 7 | margin-top: 10%; 8 | width: 100%; 9 | height: 200px; 10 | background-color: #ffffff; 11 | text-align: center; 12 | } 13 | 14 | .ENS-logo { 15 | width: 60px; 16 | height: 60px; 17 | object-fit: contain; 18 | display: inline-block; 19 | } 20 | 21 | .ensNameContainer { 22 | width: 100%; 23 | height: 15%; 24 | font-family: SourceSansPro, sans-serif; 25 | font-size: 36px; 26 | font-weight: normal; 27 | font-stretch: normal; 28 | font-style: normal; 29 | line-height: 1.69; 30 | letter-spacing: normal; 31 | text-align: center; 32 | color: #000000; 33 | word-wrap: break-word; 34 | } 35 | 36 | .separator { 37 | width: 100%; 38 | height: 1px; 39 | background-color: #e9e9e9; 40 | } 41 | 42 | .expiry-information { 43 | width: 100%; 44 | height: 29px; 45 | font-family: SourceSansPro, sans-serif; 46 | font-size: 15px; 47 | font-weight: normal; 48 | font-stretch: normal; 49 | font-style: normal; 50 | line-height: 1.67; 51 | letter-spacing: normal; 52 | text-align: center; 53 | color: #727272; 54 | } 55 | 56 | .resolver-title-box { 57 | width: 100%; 58 | height: 50px; 59 | background-color: #ffffff; 60 | } 61 | 62 | .resolver-title-text { 63 | width: 246px; 64 | height: 41px; 65 | font-family: SourceSansPro, sans-serif; 66 | font-size: 24px; 67 | font-weight: bold; 68 | font-stretch: normal; 69 | font-style: normal; 70 | line-height: 1.71; 71 | letter-spacing: normal; 72 | color: #000000; 73 | } 74 | 75 | .status-box { 76 | width: 100%; 77 | height: 64px; 78 | } 79 | 80 | .status-title { 81 | width: 212px; 82 | height: 22px; 83 | font-family: SourceSansPro, sans-serif; 84 | font-size: 13px; 85 | font-weight: normal; 86 | font-stretch: normal; 87 | font-style: normal; 88 | line-height: 1.69; 89 | letter-spacing: normal; 90 | color: #727272; 91 | } 92 | 93 | #resolvedImage { 94 | width: 24px; 95 | height: 24px; 96 | object-fit: contain; 97 | } 98 | 99 | #resolvedText { 100 | width: 182px; 101 | height: 29px; 102 | font-family: SourceSansPro-Semibold, sans-serif; 103 | font-size: 17px; 104 | font-weight: 600; 105 | font-stretch: normal; 106 | font-style: normal; 107 | line-height: 1.71; 108 | letter-spacing: normal; 109 | color: #75b943; 110 | float: right; 111 | display: contents; 112 | } 113 | 114 | .resolverAddressBox { 115 | width: 100%; 116 | /*height: 94px;*/ 117 | } 118 | 119 | .subtitle { 120 | width: 100%; 121 | height: 2px; 122 | font-family: SourceSansPro, sans-serif; 123 | font-size: 13px; 124 | font-weight: normal; 125 | font-stretch: normal; 126 | font-style: normal; 127 | line-height: 1.69; 128 | letter-spacing: normal; 129 | color: #727272; 130 | } 131 | 132 | .viewText { 133 | width: 100%; 134 | /*height: 58px;*/ 135 | font-family: SourceSansPro, sans-serif; 136 | font-size: 17px; 137 | font-weight: normal; 138 | font-stretch: normal; 139 | font-style: normal; 140 | line-height: 1.71; 141 | letter-spacing: normal; 142 | color: #2f2f2f; 143 | word-wrap: break-word; 144 | } 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /examples/EntryToken/EntryToken.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | ]> 9 | 16 | 17 | 18 | Ticket 19 | Tickets 20 | 21 | 22 | Boleto de admisión 23 | Boleto de admisiónes 24 | 25 | 26 | 入場券 27 | 入場券 28 | 29 | 30 | 31 | 0x63cCEF733a093E5Bd773b41C96D3eCE361464942 32 | 0xFB82A5a2922A249f32222316b9D1F5cbD3838678 33 | 0x2B58A9403396463404c2e397DBF37c5EcCAb43e5 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Expired Ticket 43 | Expired Tickets 44 | 45 | 已经过期的票 46 | 47 | 48 | 49 | 50 | 51 | 52 | &icon.en; 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 66 | 67 | Enter 68 | 入場 69 | Entrar 70 | 71 | 72 | 73 | 74 | &enter.en.shtml; 75 | 76 | 77 | 78 | 79 | 1.3.6.1.4.1.1466.115.121.1.15 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 1.3.6.1.4.1.1466.115.121.1.24 91 | 92 | Time 93 | 时间 94 | 95 | 96 | 97 | 98 | 99 | 100 | 1.3.6.1.4.1.1466.115.121.1.7 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 1.3.6.1.4.1.1466.115.121.1.15 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 1.3.6.1.4.1.1466.115.121.1.15 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 1.3.6.1.4.1.1466.115.121.1.15 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /examples/EntryToken/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/EntryToken/enter.en.js: -------------------------------------------------------------------------------- 1 | // { 10 | const currentTokenInstance = updatedTokens.currentInstance; 11 | document.getElementById(tokenCardId).innerHTML = new Token(currentTokenInstance).render(); 12 | }; 13 | 14 | document.addEventListener("DOMContentLoaded", function() { 15 | window.onload = function startup() { 16 | // 1. call API to fetch challenge 17 | fetch('http://stormbird.duckdns.org:8080/api/getChallenge') 18 | .then(function (response) { 19 | return response.text() 20 | }) 21 | .then(function (response) { 22 | document.getElementById('msg').innerHTML = 'Challenge: ' + response 23 | window.challenge = response 24 | }) 25 | } 26 | 27 | window.onConfirm = function onConfirm(signature) { 28 | if (window.challenge === undefined || window.challenge.length == 0) return 29 | const challenge = window.challenge 30 | document.getElementById('status').innerHTML = 'Wait for signature...' 31 | // 2. sign challenge to generate response 32 | web3.personal.sign({ data: challenge }, function (error, value) { 33 | if (error != null) { 34 | document.getElementById('status').innerHTML = error 35 | window.onload(); 36 | return 37 | } 38 | 39 | document.getElementById('status').innerHTML = 'Verifying credentials ...' 40 | // 3. open door 41 | let contractAddress = document.getElementById("contractAddress").textContent; 42 | fetch(`http://stormbird.duckdns.org:8080/api/checkSignature?contract=${contractAddress}&challenge=${challenge}&sig=${value}`) 43 | .then(function (response) { 44 | return response.text() 45 | }) 46 | .then(function (response) { 47 | if (response == "pass") { 48 | document.getElementById('status').innerHTML = 'Entrance granted!' 49 | window.close() 50 | } else { 51 | document.getElementById('status').innerHTML = 'Failed with: ' + response 52 | } 53 | }) 54 | }); 55 | window.challenge = ''; 56 | document.getElementById('msg').innerHTML = ''; 57 | } 58 | }); 59 | //]]> 60 | -------------------------------------------------------------------------------- /examples/EntryToken/enter.en.shtml: -------------------------------------------------------------------------------- 1 |

Welcome to Craig Wright's house!

2 |
Preparing to unlock the entrance door.
3 |
4 |
5 | -------------------------------------------------------------------------------- /examples/EntryToken/js/generalized-time-test.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Generalized Time testing page 6 | 8 | 9 | 10 |

You will see a few alerts

11 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/EntryToken/js/generalized-time.js: -------------------------------------------------------------------------------- 1 | ;(function() { 2 | 'use strict' 3 | 4 | function pad2(num) { 5 | if (num < 10) return '0' + num 6 | return '' + num 7 | } 8 | 9 | function pad4(num) { 10 | if (num < 10) return '000' + num 11 | if (num < 100) return '00' + num 12 | if (num < 1000) return '0' + num 13 | return '' + num 14 | } 15 | 16 | function GeneralizedTime(generalizedTime) { 17 | this.rawData = generalizedTime; 18 | } 19 | 20 | GeneralizedTime.prototype.getYear = function () { 21 | return parseInt(this.rawData.substring(0, 4), 10); 22 | } 23 | 24 | GeneralizedTime.prototype.getMonth = function () { 25 | return parseInt(this.rawData.substring(4, 6), 10) - 1; 26 | } 27 | 28 | GeneralizedTime.prototype.getDay = function () { 29 | return parseInt(this.rawData.substring(6, 8), 10) 30 | }, 31 | 32 | GeneralizedTime.prototype.getHours = function () { 33 | return parseInt(this.rawData.substring(8, 10), 10) 34 | }, 35 | 36 | GeneralizedTime.prototype.getMinutes = function () { 37 | var minutes = parseInt(this.rawData.substring(10, 12), 10) 38 | if (minutes) return minutes 39 | return 0 40 | }, 41 | 42 | GeneralizedTime.prototype.getSeconds = function () { 43 | var seconds = parseInt(this.rawData.substring(12, 14), 10) 44 | if (seconds) return seconds 45 | return 0 46 | }, 47 | 48 | GeneralizedTime.prototype.getMilliseconds = function () { 49 | var startIdx 50 | if (time.indexOf('.') !== -1) { 51 | startIdx = this.rawData.indexOf('.') + 1 52 | } else if (time.indexOf(',') !== -1) { 53 | startIdx = this.rawData.indexOf(',') + 1 54 | } else { 55 | return 0 56 | } 57 | 58 | var stopIdx = time.length - 1 59 | var fraction = '0' + '.' + time.substring(startIdx, stopIdx) 60 | var ms = parseFloat(fraction) * 1000 61 | return ms 62 | }, 63 | 64 | GeneralizedTime.prototype.getTimeZone = function () { 65 | let time = this.rawData; 66 | var length = time.length 67 | var symbolIdx 68 | if (time.charAt(length - 1 ) === 'Z') return 0 69 | if (time.indexOf('+') !== -1) { 70 | symbolIdx = time.indexOf('+') 71 | } else if (time.indexOf('-') !== -1) { 72 | symbolIdx = time.indexOf('-') 73 | } else { 74 | return NaN 75 | } 76 | 77 | var minutes = time.substring(symbolIdx + 2) 78 | var hours = time.substring(symbolIdx + 1, symbolIdx + 2) 79 | var one = (time.charAt(symbolIdx) === '+') ? 1 : -1 80 | 81 | var intHr = one * parseInt(hours, 10) * 60 * 60 * 1000 82 | var intMin = one * parseInt(minutes, 10) * 60 * 1000 83 | var ms = minutes ? intHr + intMin : intHr 84 | return ms 85 | } 86 | 87 | if (typeof exports === 'object') { 88 | module.exports = GeneralizedTime 89 | } else if (typeof define === 'function' && define.amd) { 90 | define(GeneralizedTime) 91 | } else { 92 | window.GeneralizedTime = GeneralizedTime 93 | } 94 | }()) 95 | -------------------------------------------------------------------------------- /examples/EntryToken/shared.css: -------------------------------------------------------------------------------- 1 | .ts-count { 2 | font-family: "SourceSansPro"; 3 | font-weight: bolder; 4 | font-size: 21px; 5 | color: rgb(117, 185, 67); 6 | } 7 | .ts-category { 8 | font-family: "SourceSansPro"; 9 | font-weight: lighter; 10 | font-size: 21px; 11 | color: rgb(67, 67, 67); 12 | } 13 | .ts-venue { 14 | font-family: "SourceSansPro"; 15 | font-weight: lighter; 16 | font-size: 16px; 17 | color: rgb(67, 67, 67); 18 | } 19 | .ts-date { 20 | font-family: "SourceSansPro"; 21 | font-weight: bold; 22 | font-size: 14px; 23 | color: rgb(112, 112, 112); 24 | margin-left: 7px; 25 | margin-right: 7px; 26 | } 27 | .ts-time { 28 | font-family: "SourceSansPro"; 29 | font-weight: lighter; 30 | font-size: 16px; 31 | color: rgb(112, 112, 112); 32 | } 33 | html { 34 | } 35 | 36 | body { 37 | padding: 0px; 38 | margin: 0px; 39 | } 40 | 41 | div { 42 | margin: 0px; 43 | padding: 0px; 44 | } 45 | 46 | .data-icon { 47 | height:16px; 48 | vertical-align: middle 49 | } 50 | 51 | .tbml-count {
 font-family: "SourceSansPro";
 font-weight: bolder;
 font-size: 21px;
 color: rgb(117, 185, 67);
}
.tbml-category {
 font-family: "SourceSansPro";
 font-weight: lighter;
 font-size: 21px;
 color: rgb(67, 67, 67);
}
.tbml-venue {
 font-family: "SourceSansPro";
 font-weight: lighter;
 font-size: 16px;
 color: rgb(67, 67, 67);
}
.tbml-date {
 font-family: "SourceSansPro";
 font-weight: bold;
 font-size: 14px;
 color: rgb(112, 112, 112);
 margin-left: 7px;
 margin-right: 7px;
}
.tbml-time {
 font-family: "SourceSansPro";
 font-weight: lighter;
 font-size: 16px;
 color: rgb(112, 112, 112);
}
 html {
 }
 
 body {
 padding: 0px;
 margin: 0px;
 }
 
 div {
 margin: 0px;
 padding: 0px;
 }

 .data-icon {
 height:16px;
 vertical-align: middle
 }
 52 | 53 | 54 | -------------------------------------------------------------------------------- /examples/EntryToken/shong.wang.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartTokenLabs/TokenScript-Examples/ddfe8425b5d27277aed3f4a15594b23da8caf416/examples/EntryToken/shong.wang.p12 -------------------------------------------------------------------------------- /examples/EntryToken/token.en.js: -------------------------------------------------------------------------------- 1 | // 110 |
111 | x${this.props._count} ${this.props.label} 112 |
113 |
114 | ${this.props.building} 115 |
116 |
117 |   118 |
119 |
120 | 121 | ${date} 122 |
123 |
124 | ${time}, ${this.props.locality} 125 |
126 | `; 127 | } 128 | } 129 | 130 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenCardId) => { 131 | const currentTokenInstance = updatedTokens.currentInstance; 132 | document.getElementById(tokenCardId).innerHTML = new Token(currentTokenInstance).render(); 133 | }; 134 | 135 | //]]> 136 | -------------------------------------------------------------------------------- /examples/Karma/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/Karma/karma.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | ]> 9 | 17 | 18 | 19 | Car Ownership Token 20 | Car Ownership Tokens 21 | 22 | 23 | Token de propiedad del automóvil 24 | Token de propiedad del automóviles 25 | 26 | 27 | 汽车所有权令牌 28 | 汽车所有权令牌 29 | 30 | 31 | 32 | 0x75cb2cc380d1387a79ee64b1b7c9fa051139a319 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | &item-view.en; 44 | 45 | 46 | 47 | &item-view.en; 48 | 49 | 50 | 51 | 52 | 53 | Start 54 | 开车 55 | Start 56 | 57 | 58 | 59 | &start.en; 60 | 61 | 62 | 63 | 64 | Attestations 65 | 认证 66 | Attestationes 67 | 68 | 69 | 70 | &attestations.en; 71 | 72 | 73 | 74 | 75 | Market 76 | 市场 77 | Market 78 | 79 | 80 | 81 | &market.en; 82 | 83 | 84 | 85 | 86 | 1.3.6.1.4.1.1466.115.121.1.15 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 1.3.6.1.4.1.1466.115.121.1.24 98 | 99 | Time 100 | 时间 101 | 102 | 103 | 104 | 105 | 106 | 107 | 1.3.6.1.4.1.1466.115.121.1.7 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 1.3.6.1.4.1.1466.115.121.1.15 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 1.3.6.1.4.1.1466.115.121.1.15 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 1.3.6.1.4.1.1466.115.121.1.15 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /examples/Karma/market.en.shtml: -------------------------------------------------------------------------------- 1 | 19 |
20 |
21 |

List for Sale arrrow

22 |
23 |
24 |

Auction arrrow

25 |
26 |
27 |

Collateralise arrrow

28 |
29 |
30 |

List for Hire arrrow

31 |
32 |
33 | -------------------------------------------------------------------------------- /examples/UEFA/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/UEFA/shared.css: -------------------------------------------------------------------------------- 1 | .tbml-category { 2 | font-family: "SourceSansPro"; 3 | font-weight: 400; 4 | font-size: 12px; 5 | color: white; 6 | } 7 | .tbml-venue { 8 | font-family: "SourceSansPro"; 9 | font-weight: 500; 10 | font-size: 15px; 11 | color: white; 12 | display: block; 13 | padding-top: 3%; 14 | } 15 | .tbml-match { 16 | font-family: "SourceSansPro"; 17 | font-weight: bold; 18 | font-size: 19px; 19 | color: white; 20 | padding: 2%; 21 | background-color: rgb(117, 185, 67); 22 | display: block; 23 | text-align: center; 24 | margin-top: 1px; 25 | width: 80%; 26 | margin: auto; 27 | margin-top: 8%; 28 | } 29 | .tbml-time { 30 | font-family: "SourceSansPro"; 31 | font-weight: lighter; 32 | font-size: 15px; 33 | color: white; 34 | } 35 | .data-icon { 36 | height: 20px; 37 | vertical-align: middle; 38 | color: white; 39 | } 40 | .ticket { 41 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUEAAACjCAMAAAAjK1w+AAABL1BMVEU1qro1qrsyorEyobAyo7IvmqovmakzpbU1qbozpLMypLQyo7MumKgvmagxoK8zpbQvm6szprYvmqkumKctlaQyorIyoa8ul6YulqQzprUul6cvm6oyorAulqUxoK4tlaU1q7stlaM1qbk0qLc0qLgzprQ0qLkwnKsypLUxobEzpbYwnKwxoLA0p7UulqYxn64zp7csk6ItlKItlKMwnawxn680p7g0qLYwna0wnq4yo7Q0p7YtlKUumKYwnKoul6UvmaoxoLEyo7EzpbM0qLo1qbgtlaYvmaYvmacvmqgvmqsvm6kwnq0xn60xn7AxobIskqIsk6MtlKEtlKQtlaculqMul6gwnK0wnaswnq8xn7EyorMypLYzprczp7gzp7k1qbc1qrk1q7pNpK7///+0JaGfAAAKd0lEQVRo3u3bh3rbOBIHcIwlkiuKslmko4oVadXc4hLbidN7tt/u7V7v9f2f4VwjkgLAMgOE+pj/I/y+wQAgMazGy68i2UzPvZXYIAzLmIF5k1Y0zkqCZPqXcScsX76QZPdBm58vL3P6P1ZLJSxi2AQ04WPTzGTIITxmuVOY8L8CQazhNqAJ75kFCftPGaMlbJ5JCIWCOMNNvGDdLEhoMWrBL/7SFhNKBFGGgCacm5kJo4b9HmP0hAdtoaFUEGE4QxNOTFNkKCEMiwKmEA6FhCmChQ0P8UXoiAmFK3lYHDCF8KywYEFDC9CECcEshK+eMlWC3oPigoUMm4AmHJi5CfcYU0b4GCNYwHAbL7hj5iN0gnPGFBLiBHMbpglmIHximjkNmVLB6SlOMO9VD9CEdTMfYTBhagkNrGA+Q0ATHpr5CP/KmGJC7mbCtmtqDGf4IvRzEQ6YcsEf+YLb20UJpYZTfBG2+IR8w/6EqSf8mSe4saHGcA5owu/9HIQ1xtQTvhlxBdUY2njBl77vZ13JAWM6CB+M+IIqDJuAJjz2sxM29Aj+cTQa8QWvCGkNNwBN2PDFhElDxvQQ/naF8E6Q3HAbL/jBz0zYYZoIu6Mk4VIw91KWG9YAT9jyZYYRwIDpEuy1k4RRQVLDjIJSQtfPSPiYaSP8zWgUN4wLUhoCnnDHkBPeGX4zZdoIg1GCMClIZ0gg+NAwjCyEPtMnOO9244SrgjjDpeACT2gb2Qg3mUbC0wQhT5DG8J+AJpwYUUJxM5wxjYTtbpyQL0hheIEXZEYGwktDplPwZfcj4UgmiL+mHAKe0DXihnzCc6aT8KQbJxQLYg17gCc8NrIQNplWwnY3YigXxBnOCARtI0nIM5wwrYSn3RihXBBj+C/AE06MDIQO0yt4W4N3hGmCxa/L74CA8Dtj1TApaDC9hEE3RpgqWNiwQSHoGumE50wv4ZNuN2qYQbDg0SafIIhvJWkr+b5mwafdGGEmwUKGb4GAcNdIJ7SZXsJFN0aYUbCA4QZQEL5OJ5wwzYSjGGFmwdyGTRLBHcPgGy4FmW7BdlHBnIZ1oCB8YogIfdWHGSHhaXHBXIa5VzGX0DZSCZluwjZGMIchjeDESCNsMd2ECcFOR5FhB0gIDwyJ4ZWg/+kFFRkWEeQQ7hmGvAyVC64QPl8VVGJIJHhopBCqF0wSdnmCCgwLCUKmRhgjNHQLTod8wdyGadflOtAQPjTkht8zzYRvhjFCVq8rMixWg6uEHUNOOGCaCd1hjPBSEGeoXPDCSCHULfhqGCO8FlRiWFRwhXCQQsg0E54Nh1HDW8GIIdWW0gAiwtpAbsg0Ez4Yxgg/CpIbNqkE5wMpock0E46GMcKIILFhccEE4WQgJ5zoFXw6HMYIY4KkhgjBBOFDOWFPbxG2wjhhQpDQkE7QdgcywwbTSngWRgiHHEEywwZQET5yXVdCuKdXsB3GCTmCxY82MUOUYJzwiZTwmOkkfBOGcUKeII3hFpAR2q6M8JzpJByFYdyQL0hhaNEJXi1jV9gMd7QKtsMEoUgQf12eAx3hpuuKy/A7ppHwxzBMEIoFsYb7QEdouzJCjYLsyzBJKBPEGT4jFJy4MkKNgLNRGCYM5YIYwwsgJNyLEg4+0ZH6MmEiGQSLHw8fASFhz5UQNvUJtlcJ0wWLGi4oBdlj1xWu5E1tgG64kkyCxQwZUBI2XTHh+acrwctkEyxiCEBJOHEThINPcCBshTzBZlONYZ1WkN2XEOraiJ/3+YJqDN8CLaHnuq5gJb/WJNjtX4YvmNUwz9GmAcSEB2JCPd9YO0d9HuGtIL1hHYgJm66Q8FDPdaTf5xF+FKQ2tKkF2Q6HcKDvQBj2+1zCiCCt4T6oLsJlGdY0AN5fCsYNY4KUhh6QE+6ICP+sHnDa7vf5hAlBOsMT0FCEt4QavvM/DwIB4YogleEjoCd0+YQD9av4RRCICFmjiTbkCr4HesJ9l294XzXgILgJz5A1GmoMQYHg9S8nDqFqwcdBICa8EuQRYg07oIJw6nIJFQv+OgwkhNeCiDIUGTZACaHNJaxpA+QQ3gqSG+6CGsL7PMGOSsCDGOCq4UdBinbYUXGgjgvOeIKWQkDfCQIpYUSQ1PAZKCI85Aj+Q+FdznFSCGOChIYzUEVYXxVU5mc/d5w0woQgmeF7ZYLL/3Z32VDWAo8ch08YSARpDN8CqCNM7CY7UzV+F6HzMRJCjiCFoQ0qCTsxQUXfts6/cqIREnIF8YaWUkE231F9lOn8zklERCgQxBp6oJZwdtcMf5ir8NsKWy0nI6FQEGd4AooJ2SN77+FmR8mDj+YLp9XKQhikCGIMF8oFleVev3UbJ1MZMjsnYSbDJsB6Etb+ELQiyULIbNumL0Mb1pFwMwhN02zlJLwSpDfcgrUjrLf65k1yEt4IUhv21kzwcBCYy8gJHYEgreEjWCfChy0zkTxluBSUEuY0nMDaEE5fOuZqchBGBAkNYV0ErcvpWtNEEcYEqQzfwXoQPr2e8C5C6AgFaQz3YR0I7W99X0KYtQxXBCkMD9dA0Lp6LkJByBHEGy6g7IQfDm7Hu/GEXEGkYROg5IS113ePN32pYZZmKBBEGeoQxBA+iw4C+NgyFAraxT852OUW7JjxgR4koUSw8DVlCmUmPFiZy8MRsi2b3BCgvITTPmdCGdUM2dYWtWGzxILzwDByE5pSwitBYkMbSksoAETtJzeCcsOc23IPykrYEwFimuGdIKHhoqyCH4ac8W50M1wKUhnWAUpK6HCmu/GEUUEaw10oKeFP3PFudDOMC1IY9qCkhH03jbBQM0wKFt+WG9rbYD7BDn+8G72SVwSxhnWAchIGrhpCZm3RGu5CSQn7LgEhx5BZFqlh0yurYIszFErRDK8ESQ0ZlJTQF4x3Y1fyjSChIUBJCQNXDeGdIJXh7noIEjbDpSCN4QzKStjhDIVSNMOoYG7DcizirIQBf7wbSxgXRBtulVhw6hQiTGuGSUGk4QWUmNBuERJeG3ZPv363Kogy/DeUmbDXd8maodP+pXXzCt7KRpjNcA5QakLmmxTN8Kuz7vFs+frBsvBleGd4UnbBy2bYwqzkVvts+ENihsqyCA0XUHpCNjsIjQKER+32q5fc8SnLojPcB1gDQsYmx0FgZmyGQbf7+6//tDeTvGGy6Ay9NRG8Wc+1nW/Co6Ph0VHwIgj8WzDz8ie6EwZhGL74duf4p2dZXoFZdIbvYZ0Iyd7BWmSGuwBVJLQsMsO/fxZEGi6gkoSWRWVoAVSSsNejMjyBahL2shKmGi6qK0hjuA9QTcJeL4eh7JPDCVSUsNfDGt4eBllVBT2PxrAki/gTEHoRQozhDKpK6Hk0hlBtQbxhDypL6HkkhguoLKHnURha8FkQZ3gB1SX0PApDgOoSep7IMMdVrwcVJvQ8AsPFZ0Gc4RygwoSehzecQpUJPQ9tuDX+LIgzPBlXmtDLQig1nP9nXGlCz8MaeuPPgjjDybjahJ6HNNwfj6tN6HlIw1mZBaEkgjLD3fG44kXoeTjD6bjqhJ6X2zAmOC65IJRIkGv4bDyuehF6Hsbwb+Nx1Qn/Dw+uFm1XcXfwAAAAAElFTkSuQmCC'); 42 | border-radius: 15px; 43 | display: flex; 44 | flex-direction: column; 45 | background-size: cover; 46 | height: -webkit-fill-available; 47 | width: -webkit-fill-available; 48 | } 49 | .ticketname { 50 | font-family: "SourceSansPro"; 51 | font-weight: 500; 52 | font-size: 15px; 53 | color: white; 54 | width: 100%; 55 | display: block; 56 | padding-top: 3%; 57 | } 58 | .tbml-city { 59 | font-family: "SourceSansPro"; 60 | font-weight: bolder; 61 | font-size: 25px; 62 | color: white; 63 | display: block; 64 | padding-top: 3%; 65 | } 66 | 67 | .ticket-bottom-section { 68 | padding-left: 3%; 69 | display: flex; 70 | width: 100%; 71 | margin: auto; 72 | padding-bottom: 10%; 73 | align-self: center; 74 | } 75 | .left-column{ 76 | flex: 70%; 77 | align-items: center; 78 | display: block; 79 | padding-top: 5%; 80 | } 81 | .right-column{ 82 | flex: 30%; 83 | display: block; 84 | } 85 | .uefa-logo { 86 | height: 60px; 87 | width: -webkit-fill-available; 88 | display: block; 89 | margin: auto; 90 | } 91 | .date { 92 | font-family: "SourceSansPro"; 93 | font-weight: 400; 94 | font-size: 12px; 95 | color: white; 96 | } 97 | .top-section { 98 | display: flex; 99 | flex-direction: row; 100 | padding: 5%; 101 | margin-bottom: 30%; 102 | } 103 | .local-time { 104 | font-family: "SourceSansPro"; 105 | font-weight: lighter; 106 | font-size: 10px; 107 | color: white; 108 | } 109 | 110 | .left-col { 111 | flex: 50%; 112 | margin-left: 2%; 113 | } 114 | .right-col { 115 | flex: 50%; 116 | } 117 | .white-line { 118 | border: 5% solid white; 119 | width: -webkit-fill-available; 120 | margin-bottom: 3%; 121 | } 122 | .redeemed { 123 | color: #cffFAB; 124 | font-family: "SourceSansPro"; 125 | font-weight: 500; 126 | font-size: 15px; 127 | } -------------------------------------------------------------------------------- /examples/action/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/action/XDAI-bridge.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 13 | 14 | Convert to DAI 15 | 將xDAI轉爲DAI 16 | 17 | 18 | 1.3.6.1.4.1.1466.115.121.1.36 19 | 20 | Amount 21 | 代幣金額 22 | 23 | 24 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 0x6b175474e89094c44da98b954eedeac495271d0f 43 | 44 | 45 | 46 | 63 | 64 | 65 | 0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /examples/action/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/edcon/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/edcon/unicon.en.js: -------------------------------------------------------------------------------- 1 | // 17 |
18 |
19 | 20 | TYPE ${this.props.category} 21 | 22 |
23 |
24 | `; 25 | } 26 | } 27 | 28 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenCardId) => { 29 | const currentTokenInstance = updatedTokens.currentInstance; 30 | document.getElementById(tokenCardId).innerHTML = new Token(currentTokenInstance).render(); 31 | }; 32 | //]]> 33 | -------------------------------------------------------------------------------- /examples/edcon/unicon.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | 16 | Ticket 17 | Tickets 18 | 19 | 20 | 21 | 22 | 0xF6b8DD8Ba9996bEaE6Ad0eE3481F1E9cF080A9eB 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | &style; 34 | 35 | 36 | 37 | &style; 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 1.3.6.1.4.1.1466.115.121.1.24 46 | 47 | Time 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 1.3.6.1.4.1.1466.115.121.1.15 58 | 59 | City 60 | 61 | 62 | 63 | 64 | 65 | Welthandelspl. 1, 1020 Wien, Austria 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 1.3.6.1.4.1.1466.115.121.1.15 74 | 75 | Venue 76 | 77 | 78 | 79 | 80 | 81 | Vienna University of Economics and Business 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 1.3.6.1.4.1.1466.115.121.1.15 90 | 91 | Cat 92 | 等级 93 | Cat 94 | 95 | 96 | 97 | 98 | 99 | A 100 | 101 | 102 | B 103 | 104 | 105 | C 106 | 107 | 108 | D 109 | 110 | 111 | E 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 1.3.6.1.4.1.1466.115.121.1.27 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 1.3.6.1.4.1.1466.115.121.1.27 130 | 131 | Redeemed 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /examples/erc20/AAVE/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 David Truong 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/erc20/AAVE/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/AAVE/README.md: -------------------------------------------------------------------------------- 1 | # WIP: AlphaWallet integration 2 | Modelled on AlphaWallet's Compound 'integration', as suggested from AlphaWallet. 3 | 4 | ## Information 5 | See [TokenScript examples directory](https://github.com/AlphaWallet/TokenScript-Examples) 6 | -------------------------------------------------------------------------------- /examples/erc20/AAVE/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/COMP/COMP.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ]> 8 | 17 | 18 | 19 | COMP 20 | 21 | 22 | 0xc00e94Cb662C3520282E6f5717214004A7f26888 23 | 24 | 25 | 26 | 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | About 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Claim COMP 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Delegate Vote 64 | 65 | 66 | 67 | 1.3.6.1.4.1.1466.115.121.1.15 68 | 69 | 70 | Delegate to Address 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 1.3.6.1.4.1.1466.115.121.1.36 93 | 94 | 95 | compAccrued 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /examples/erc20/COMP/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(TOKENSCRIPT_SCHEMA),) 2 | TOKENSCRIPT_SCHEMA=http://tokenscript.org/2020/06/tokenscript.xsd 3 | endif 4 | 5 | ifeq ($(XMLSECTOOL),) 6 | XMLSECTOOL=xmlsectool 7 | endif 8 | 9 | ifeq ($(XMLLINT),) 10 | XMLLINT=xmllint 11 | endif 12 | 13 | ifeq ($(XMLSEC),) 14 | XMLSEC=xmlsec1 # xmlsec for Linux/Windows 15 | endif 16 | 17 | 18 | ifndef KEY 19 | KEY=1 20 | endif 21 | 22 | SIGNATURE_ALGORITHM=rsa-sha256 23 | 24 | help: 25 | # Needs a target, example: $$ make EntryToken.canonicalized.xml 26 | # 27 | # Let's say you have a TokenScript "EntryToken.xml" 28 | # - to validate and canonicalize, add 'canonicalized' in the filename 29 | @echo $$ make EntryToken.canonicalized.xml 30 | # - to sign, use tsml as file extension: 31 | @echo $$ make EntryToken.tsml 32 | 33 | %.canonicalized.xml : %.xml 34 | # XML canonicalization and validation against TS schema 35 | $(XMLLINT) --c14n $^ > $@ && \ 36 | $(XMLLINT) --noout --schema $(TOKENSCRIPT_SCHEMA) $@ || \ 37 | (mv $@ $@.TEST && exit 1) 38 | 39 | %.tsml: %.canonicalized.xml 40 | ifeq (,$(KEYPASSWORD)) 41 | $(error KEYPASSWORD is not set) 42 | endif 43 | ifeq (,$(KEYSTORE)) 44 | @echo ---------------- Keystore missing. Try this ---------------- 45 | @echo $$ make KEYSTORE=shong.wang.p12 KEYPASSWORD=shong.wang KEYINFO='"Shong Wang"' $@ 46 | @echo replace it with your .p12 file and your password 47 | rm $^ 48 | else 49 | # Signing with xmlsec requires original .xml file to contain the Signature tag. 50 | # $(XMLSEC) sign --pkcs12:"$(KEYINFO)" $(KEYSTORE) --pwd "$(KEYPASSWORD)" --output $@ $^ 51 | # For now use xmlsectool... 52 | $(XMLSECTOOL) --sign --keyInfoKeyName "$(KEYINFO)" --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#$(SIGNATURE_ALGORITHM) --inFile $^ --outFile $@ --keystore $(KEYSTORE) --keystoreType PKCS12 --key $(KEY) --keyPassword "$(KEYPASSWORD)" --signaturePosition LAST 53 | # removing the canonicalized created for validation 54 | rm $^ 55 | endif 56 | -------------------------------------------------------------------------------- /examples/erc20/COMP/README.md: -------------------------------------------------------------------------------- 1 | ## Congratulations on generating a TokenScript for your token! 2 | 3 | ### For more information 4 | Check out the tutorial here: https://github.com/AlphaWallet/TokenScript-Examples/tree/master/tutorial, it includes comprehensive information on what a TokenScript is, how to use it on AlphaWallet and AlphaWallet forks, what tools you need to debug and more! 5 | 6 | ### Happy with your TokenScript and wanna show off your token to everyone on AlphaWallet? 7 | Submit a pull request with your token added to https://github.com/AlphaWallet/TokenScript-Examples 8 | 9 | ### Learn More about AlphaWallet 10 | iOS download: https://apps.apple.com/us/app/alphawallet/id1358230430 11 | 12 | Android download: https://play.google.com/store/apps/details?id=io.stormbird.wallet&hl=en_AU 13 | 14 | Website: AlphaWallet.com 15 | 16 | GitHub: https://github.com/AlphaWallet/ 17 | 18 | Forum: https://community.tokenscript.org/ 19 | 20 | Twitter: @AlphaWallet 21 | 22 | Telegram: t.me/AlphaWalletGroup 23 | 24 | Facebook: https://www.facebook.com/AlphaWallet/ 25 | -------------------------------------------------------------------------------- /examples/erc20/COMP/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/Compound/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/Compound/cBAT.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ]> 8 | 16 | 17 | cBAT 18 | 19 | 20 | 0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E 21 | 22 | 23 | 0x0d8775f648430679a709e98d2b0cb6250d2887ef 24 | 25 | 26 | 27 | 28 | 29 | 30 | contract already enabled 31 | 32 | 33 | 34 | 35 | contract not enabled 36 | 37 | 38 | 39 | 40 | 41 | 42 | Enable 43 | 44 | 45 | 46 | 47 | 0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E 48 | 115792089237316195423570985008687907853269984665640564039457584007913129639935 49 | 50 | 51 | 52 | 53 | &style; 54 | &enable.en; 55 | 56 | 57 | 58 | 59 | 60 | Deposit 61 | 62 | 63 | 1.3.6.1.4.1.1466.115.121.1.36 64 | 65 | Amount to supply 66 | 67 | 68 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | &style; 82 | &mint.en; 83 | 84 | 85 | 86 | 87 | 88 | Withdraw 89 | 90 | 91 | 1.3.6.1.4.1.1466.115.121.1.36 92 | 93 | Amount to withdraw 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | &style; 108 | &redeem.en; 109 | 110 | 111 | 112 | 113 | 114 | 115 | 1.3.6.1.4.1.1466.115.121.1.36 116 | 117 | 118 | 119 | 120 | 0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 1.3.6.1.4.1.1466.115.121.1.36 129 | 130 | Balance 131 | 餘額 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 1.3.6.1.4.1.1466.115.121.1.36 145 | 146 | Exchange Rate 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 1.3.6.1.4.1.1466.115.121.1.36 156 | 157 | Balance 158 | 餘額 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 1.3.6.1.4.1.1466.115.121.1.36 171 | 172 | Supply Interest Rate 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /examples/erc20/Compound/cETH.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | ]> 7 | 15 | 16 | cETH 17 | 18 | 19 | 0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Deposit 29 | 30 | 31 | 1.3.6.1.4.1.1466.115.121.1.36 32 | 33 | Amount to supply 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | &style; 50 | &mint.en; 51 | 52 | 53 | 54 | 55 | 56 | Withdraw 57 | 58 | 59 | 1.3.6.1.4.1.1466.115.121.1.36 60 | 61 | Amount to withdraw 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | &style; 76 | &redeem.en; 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 1.3.6.1.4.1.1466.115.121.1.36 86 | 87 | Exchange Rate 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 1.3.6.1.4.1.1466.115.121.1.36 97 | 98 | Balance 99 | 餘額 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 1.3.6.1.4.1.1466.115.121.1.36 112 | 113 | Supply Interest Rate 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /examples/erc20/Compound/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/DAI/DAI.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | ]> 7 | 15 | 16 | DAI 17 | 18 | 19 | 0x6b175474e89094c44da98b954eedeac495271d0f 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Convert to xDAI 28 | 29 | 30 | 1.3.6.1.4.1.1466.115.121.1.36 31 | 32 | Amount in DAI 33 | 代幣金額 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016 46 | 47 | 48 | 49 | 50 | 51 | &style; 52 | &DAI-bridge.en; 53 | 54 | 55 | 56 | 57 | Best Rates 58 | 59 | 60 | &style; 61 | &bestRates.en; 62 | 63 | 64 | 65 | 66 | 1.3.6.1.4.1.1466.115.121.1.36 67 | 68 | DAI-Balance 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /examples/erc20/DAI/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/DAI/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/DDEX/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/DDEX/pDAI.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | DDEX pDAI 16 | 17 | 18 | 0x6f9D718CaF76055E697AdfFD5E9f9f94753a7501 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Guide 30 | 31 | 32 | &style; 33 | &guide.en; 34 | 35 | 36 | 37 | 38 | 39 | 40 | 1.3.6.1.4.1.1466.115.121.1.26 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /examples/erc20/DDEX/pETH.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | DDEX pETH 16 | 17 | 18 | 0x26F5f49E3bb3626b53E4573F07F8587F010019B5 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Guide 31 | 32 | 33 | &style; 34 | &guide.en; 35 | 36 | 37 | 38 | 39 | 40 | 41 | 1.3.6.1.4.1.1466.115.121.1.26 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /examples/erc20/DDEX/pUSDT.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | DDEX pUSDT 16 | 17 | 18 | 0x7a6aAB486A2Bed37c7Cd523Eb60B3A42533f8906 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Guide 30 | 31 | 32 | &style; 33 | &guide.en; 34 | 35 | 36 | 37 | 38 | 39 | 40 | 1.3.6.1.4.1.1466.115.121.1.26 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /examples/erc20/DDEX/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/DeFiMoneyMarket/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/DeFiMoneyMarket/mETH.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ]> 8 | 16 | 17 | mETH 18 | 19 | 20 | 0xdF9307DFf0a1B57660F60f9457D32027a55ca0B2 21 | 22 | 23 | 0x4cb120dd1d33c9a3de8bc15620c7cd43418d77e2 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Deposit 33 | 34 | 35 | 1.3.6.1.4.1.1466.115.121.1.36 36 | 37 | Amount to supply 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | &style; 52 | &supply.en; 53 | 54 | 55 | 56 | 57 | 58 | Withdraw 59 | 60 | 61 | 1.3.6.1.4.1.1466.115.121.1.36 62 | 63 | Amount to withdraw 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | &style; 79 | &withdraw.en; 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 1.3.6.1.4.1.1466.115.121.1.36 88 | 89 | 90 | 91 | 92 | 0xdF9307DFf0a1B57660F60f9457D32027a55ca0B2 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 1.3.6.1.4.1.1466.115.121.1.36 101 | 102 | Balance 103 | 餘額 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 1.3.6.1.4.1.1466.115.121.1.36 117 | 118 | Exchange Rate 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 1.3.6.1.4.1.1466.115.121.1.36 128 | 129 | Token Decimals 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 1.3.6.1.4.1.1466.115.121.1.36 139 | 140 | Balance 141 | 餘額 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 1.3.6.1.4.1.1466.115.121.1.36 154 | 155 | Supply Interest Rate 156 | 157 | 158 | 159 | 160 | 0xdF9307DFf0a1B57660F60f9457D32027a55ca0B2 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /examples/erc20/DeFiMoneyMarket/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } 99 | -------------------------------------------------------------------------------- /examples/erc20/NEST/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/NEST/deposit.en.js: -------------------------------------------------------------------------------- 1 | // 12 |
13 | 14 |

${message}

15 | 16 |
17 |
18 |

for more information about NEST visit https://nestprotocol.org/

19 |
20 | 21 | `; 22 | } 23 | } 24 | 25 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenIdCard) => { 26 | const currentTokenInstance = web3.tokens.data.currentInstance; 27 | document.getElementById(tokenIdCard).innerHTML = new Token(currentTokenInstance).render(); 28 | }; 29 | //]]> 30 | -------------------------------------------------------------------------------- /examples/erc20/NEST/dividend.en.js: -------------------------------------------------------------------------------- 1 | //= nextTime.sub(timeLimit) && nowTime <= nextTime.sub(timeLimit).add(getAbonusTimeLimit)); 17 | render() { 18 | let message = ""; 19 | let now = Date.now() / 1000; 20 | let claimPeriod = parseInt(this.props.nextTime) - parseInt(this.props.timeLimit); 21 | let bonusTimePeriod = parseInt(this.props.nextTime) - parseInt(this.props.timeLimit) + parseInt(this.props.checkGetAbonusTimeLimit); 22 | let NESTTotalCirculation = 10000000000000000000000000000 - this.props.NESTLockedForMining 23 | if(now >= claimPeriod && now <= bonusTimePeriod) { 24 | message = "This week's total dividend is " + (this.props.TotalDividend / 1e18).toFixed(2) + " ETH." + " Your estimate income is " + ((this.props.TotalDividend / 1e18) * (this.props.withdrawable / NESTTotalCirculation)).toFixed(2) + " Your NEST dividend is claimable now until " + this.formatTimeStamp(bonusTimePeriod); 25 | window.onConfirm = null; 26 | } else { 27 | message = "This week's total dividend is " + (this.props.TotalDividend / 1e18).toFixed(2) + " ETH." + " Your estimate income is " + ((this.props.TotalDividend / 1e18) * (this.props.withdrawable / NESTTotalCirculation)).toFixed(2) + " ETH." + " Your NEST dividend is claimable on " + this.formatTimeStamp(parseInt(this.props.nextTime)) + " please come back later"; 28 | window.onConfirm = function() { window.close() }; 29 | } 30 | return` 31 |
32 |
33 | 34 |

${message}

35 |
36 |
37 |

for more information about NEST visit https://nestprotocol.org/

38 |
39 |
40 | `; 41 | } 42 | } 43 | 44 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenIdCard) => { 45 | const currentTokenInstance = web3.tokens.data.currentInstance; 46 | document.getElementById(tokenIdCard).innerHTML = new Token(currentTokenInstance).render(); 47 | }; 48 | //]]> 49 | -------------------------------------------------------------------------------- /examples/erc20/NEST/enable.en.js: -------------------------------------------------------------------------------- 1 | // 12 |
13 | 14 |

${message}

15 |
16 |
17 |

for more information about NEST visit https://nestprotocol.org/

18 |
19 | 20 | `; 21 | } 22 | } 23 | 24 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenIdCard) => { 25 | const currentTokenInstance = web3.tokens.data.currentInstance; 26 | document.getElementById(tokenIdCard).innerHTML = new Token(currentTokenInstance).render(); 27 | }; 28 | //]]> 29 | -------------------------------------------------------------------------------- /examples/erc20/NEST/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/NEST/withdraw.en.js: -------------------------------------------------------------------------------- 1 | // 20 |
21 | 22 |

${message}

23 | 24 |
25 |
26 |

for more information about NEST visit https://nestprotocol.org/

27 |
28 | 29 | `; 30 | } 31 | } 32 | 33 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenIdCard) => { 34 | const currentTokenInstance = web3.tokens.data.currentInstance; 35 | document.getElementById(tokenIdCard).innerHTML = new Token(currentTokenInstance).render(); 36 | }; 37 | //]]> 38 | -------------------------------------------------------------------------------- /examples/erc20/SAI/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/SAI/SAI.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | SAI 16 | 17 | 18 | 0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Important! 27 | 28 | 29 | &style; 30 | &important.en; 31 | 32 | 33 | 34 | 35 | 1.3.6.1.4.1.1466.115.121.1.36 36 | 37 | 38 | 39 | 40 | 0xc73e0383f3aff3215e6f04b0331d58cecf0ab849 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/SAI/important.en.js: -------------------------------------------------------------------------------- 1 | //
You may be able to exchange it on Uniswap" + 11 | " by opening this website in the AlphaWallet browser

https://uniswap.exchange/swap?use=v1"; 12 | return` 13 |
14 |
15 |

${message}

16 |
17 |
18 | `; 19 | } 20 | } 21 | 22 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenCardId) => { 23 | const currentTokenInstance = updatedTokens.currentInstance; 24 | document.getElementById(tokenCardId).innerHTML = new Token(currentTokenInstance).render(); 25 | }; 26 | //]]> 27 | -------------------------------------------------------------------------------- /examples/erc20/SAI/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/USDC/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/USDC/USDC.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | USDC 16 | 17 | 18 | 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Best Rates 27 | 28 | 29 | &style; 30 | &bestRates.en; 31 | 32 | 33 | 34 | 35 | 1.3.6.1.4.1.1466.115.121.1.36 36 | 37 | USDC-Balance 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/daiPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap DAI V1 16 | 17 | 18 | 0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/saiPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap SAI V1 16 | 17 | 18 | 0x09cabEC1eAd1c0Ba254B09efb3EE13841712bE14 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/sethPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap sETH V1 16 | 17 | 18 | 0x4740C758859D4651061CC9CDEFdBa92BDc3a845d 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/Uniswap/usdcPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap USDC V1 16 | 17 | 18 | 0x97dec872013f6b5fb443861090ad931542878126 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/wbtcPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap WBTC V1 16 | 17 | 18 | 0x4d2f5cfba55ae412221182d8475bc85799a5644b 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/Uniswap/wethPool.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 14 | 15 | Uniswap WETH V1 16 | 17 | 18 | 0xA2881A90Bf33F03E7a3f803765Cd2ED5c8928dFb 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | About 30 | 31 | 32 | 33 | &about.en; 34 | 35 | 36 | 37 | 38 | 39 | 1.3.6.1.4.1.1466.115.121.1.26 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/erc20/WETH/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/WETH/WETH.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ]> 8 | 16 | 17 | WETH 18 | 19 | 20 | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Wrap 29 | 30 | 31 | 1.3.6.1.4.1.1466.115.121.1.36 32 | 33 | Amount in WETH 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | &style; 48 | &wrap.en; 49 | 50 | 51 | 52 | 53 | Unwrap 54 | 55 | 56 | 1.3.6.1.4.1.1466.115.121.1.36 57 | 58 | Amount in WETH 59 | 60 | 61 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | &style; 75 | &unwrap.en; 76 | 77 | 78 | 79 | 80 | Best Rates 81 | 82 | 83 | &style; 84 | &bestRates.en; 85 | 86 | 87 | 88 | 89 | 1.3.6.1.4.1.1466.115.121.1.36 90 | 91 | WETH-Balance 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /examples/erc20/WETH/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/erc20/dForce/Makefile: -------------------------------------------------------------------------------- 1 | include ../../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/erc20/dForce/USDx.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | ]> 7 | 15 | 16 | dForce USDx 17 | 18 | 19 | 0xeb269732ab75A6fD61Ea60b06fE994cD32a83549 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Guide 31 | 32 | 33 | &style; 34 | &guide.en; 35 | 36 | 37 | 38 | 39 | 40 | More info 41 | 42 | 43 | &style; 44 | &moreInfo.en; 45 | 46 | 47 | 48 | 49 | 50 | 51 | 1.3.6.1.4.1.1466.115.121.1.26 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /examples/erc20/dForce/shared.css: -------------------------------------------------------------------------------- 1 | h3 { color: #111; font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 300; line-height: 32px; } 2 | 3 | #inputBox { 4 | text-align: center; 5 | } 6 | 7 | html, 8 | body { 9 | height: 100%; 10 | } 11 | html { 12 | font-size: 14px; 13 | } 14 | body { 15 | margin: 0px; 16 | padding: 0px; 17 | overflow-x: hidden; 18 | min-width: 320px; 19 | background: #FFFFFF; 20 | font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; 21 | font-size: 14px; 22 | line-height: 1.4285em; 23 | color: rgba(0, 0, 0, 0.87); 24 | font-smoothing: antialiased; 25 | } 26 | .ui.container { 27 | display: block; 28 | max-width: 100% !important; 29 | } 30 | @media only screen and (max-width: 767px) { 31 | .ui.container { 32 | width: auto !important; 33 | margin-left: 1em !important; 34 | margin-right: 1em !important; 35 | } 36 | } 37 | @media only screen and (min-width: 768px) and (max-width: 991px) { 38 | .ui.container { 39 | width: 723px; 40 | margin-left: auto !important; 41 | margin-right: auto !important; 42 | } 43 | } 44 | @media only screen and (min-width: 992px) and (max-width: 1199px) { 45 | .ui.container { 46 | width: 933px; 47 | margin-left: auto !important; 48 | margin-right: auto !important; 49 | } 50 | } 51 | @media only screen and (min-width: 1200px) { 52 | .ui.container { 53 | width: 1127px; 54 | margin-left: auto !important; 55 | margin-right: auto !important; 56 | } 57 | } 58 | .ui.segment { 59 | position: relative; 60 | background: #FFFFFF; 61 | -webkit-box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 62 | box-shadow: 0px 1px 2px 0 rgba(34, 36, 38, 0.15); 63 | margin: 0.5rem 0em; 64 | padding: 0.5em 0.5em; 65 | border-radius: 0.28571429rem; 66 | border: 1px solid rgba(34, 36, 38, 0.15); 67 | text-align: center; 68 | } 69 | .ui.segment:first-child { 70 | margin-top: 0em; 71 | } 72 | .ui.segment:last-child { 73 | margin-bottom: 0em; 74 | } 75 | input { 76 | position: relative; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 12px; 80 | display: -ms-inline-flexbox; 81 | display: inline-flex; 82 | color: rgba(0, 0, 0, 0.87); 83 | padding: 9.5px 14px; 84 | width: 300px; 85 | border-color: #D8D8D8; 86 | } 87 | input[type=text]:focus { 88 | border-color: #D8D8D8; 89 | background: #FAFAFA; 90 | color: rgba(0, 0, 0, 0.87); 91 | -webkit-box-shadow: none; 92 | box-shadow: none; 93 | } 94 | label { 95 | font-size: 12px; 96 | font-weight: 500; 97 | margin-top: 6px; 98 | } -------------------------------------------------------------------------------- /examples/fifa/Makefile: -------------------------------------------------------------------------------- 1 | include ../2020-06.mk 2 | -------------------------------------------------------------------------------- /examples/fifa/fifa.en.js: -------------------------------------------------------------------------------- 1 | // 111 |
112 | 113 |
114 | ${this.props.numero}x ${this.props.countryA} vs ${this.props.countryB} 115 |
116 | 117 |
118 | ${date} | ${time} 119 |
120 | 121 |
122 | ${this.props.venue} | ${this.props.locality} 123 |
124 | 125 |
126 | ${this.props.category}, M${this.props.match} 127 |
128 | 129 |
130 | 131 | `; 132 | } 133 | } 134 | 135 | web3.tokens.dataChanged = (oldTokens, updatedTokens, tokenCardId) => { 136 | const currentTokenInstance = updatedTokens.currentInstance; 137 | document.getElementById(tokenCardId).innerHTML = new Token(currentTokenInstance).render(); 138 | }; 139 | //]]> 140 | -------------------------------------------------------------------------------- /examples/validate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# -eq 0 ]; then 4 | echo Usage: 5 | echo ' $ ./validate.sh directory/filename.xml' 6 | echo which validates the said XML file - a TokenScript file 7 | echo ' ' 8 | echo You can do a blanket test of all xml files by: 9 | echo ' $ ./validate.sh */*.xml */*/*.xml' 10 | echo ' ' 11 | echo 'You can specify a schema file (with absolute path)' 12 | echo ' $ TOKENSCRIPT_SCHEMA=/home/james/TokenScript-Repo/www/2020/03/tokenscript/tokenscript.xsd ./validate.sh */*.xml */*/*.xml' 13 | fi 14 | 15 | CWD=${PWD} 16 | PASS=TRUE 17 | for i in "$@" 18 | do 19 | # ignore all folders with space in it 20 | echo "$i" | grep ' ' && continue 21 | 22 | if [ -f "${i%.xml}.canonicalized.xml" ]; then 23 | rm "${i%.xml}.canonicalized.xml" 24 | fi 25 | 26 | if [ ${i##*.} != "xml" ]; then 27 | echo "Only accepts .xml file." 28 | exit 29 | fi 30 | 31 | BN=`basename "$i" .xml` 32 | 33 | cd "${i%/*.xml}" 34 | 35 | if make "${BN}.canonicalized.xml" > /dev/null; then 36 | echo "[Valid] : $i" 37 | else 38 | PASS=FALSE 39 | fi 40 | 41 | cd $CWD 42 | ## the following is very important to prevent these XML files being picked up in the next run 43 | if [ -f "${i%.xml}.canonicalized.xml" ]; then 44 | rm "${i%.xml}.canonicalized.xml" 45 | fi 46 | done; 47 | if [ $PASS = FALSE ] ; then exit 1; fi 48 | -------------------------------------------------------------------------------- /img/readme/tokenscript-examples.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartTokenLabs/TokenScript-Examples/ddfe8425b5d27277aed3f4a15594b23da8caf416/img/readme/tokenscript-examples.jpg -------------------------------------------------------------------------------- /resources/fast-token-onboarding/README.md: -------------------------------------------------------------------------------- 1 | # AlphaWallet 2 | Verifying your tokens for TokenScript, and thus recognition in AlphaWallet. 3 | 4 | # xmlsectool - xml signing tool 5 | Signing of xml requires xmlsectool: 6 | - Mac: brew install xmlsectool 7 | - Linux/Windows: https://wiki.shibboleth.net/confluence/display/XSTJ2/xmlsectool+V2+Home#xmlsectoolV2Home-ObtainingandUsingxmlsectool 8 | 9 | # TokenScript 10 | Open the relevant erc20 or erc721 canonicalized.xml file, and modify the parameters accordingly: 11 | - Name as it will appear to users (eg CryptoKitty / CryptoKitties): 12 | - `Singular Name` 13 | - `Plural Name` 14 | - Token Name (eg CryptoKitties): `` 15 | - Smart Contract address: `0xYOUR_CONTRACT_ADDRESS_HERE` 16 | - Contract Name (eg CryptoKitties): ` ` 17 | 18 | # Signing 19 | A script has been provided for convenience (sign.sh), please open and modify parameters accordingly: 20 | - `NAME='YOUR COMPANY NAME'` 21 | - `KEYSTORE_FILE=./YOUR_KEY_FILE.p12 # of your domain` 22 | - `TOKEN_FILE=erc20.canonicalized.xml # or erc721.canonicalized.xml` 23 | - keyPassword `"YOUR .P12 PASSWORD"` 24 | 25 | # Testing your .tsml 26 | Command: `curl -X POST -F file=@"/full/path/YOUR_TSML_FILE.tsml" https://aw.app/api/v1/verifyXMLDSig` 27 | Success: `{"result":"pass", ...}` 28 | 29 | # You're in! 30 | Please send the resulting .tsml file (signed/certified xml), or get in touch if you have any questions/comments. 31 | 32 | We look forward to sharing your token with our users! 33 | The AlphaWallet Team 34 | -------------------------------------------------------------------------------- /resources/fast-token-onboarding/erc20.canonicalized.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | Token 11 | Tokens 12 | 13 | 17 | 18 | 19 | 0xYOUR_CONTRACT_ADDRESS_HERE 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/fast-token-onboarding/erc721.canonicalized.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | Token 11 | Tokens 12 | 13 | 17 | 18 | 19 | 0xYOUR_CONTRACT_ADDRESS_HERE 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/fast-token-onboarding/sign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | NAME='YOUR COMPANY NAME' 3 | KEYSTORE_FILE=./YOUR_KEY_FILE.p12 # of your domain 4 | # set .p12 password in last line of xmlsectool command below 5 | 6 | TOKEN_FILE=USDx.xml # or erc721.canonicalized.xml 7 | SIGNATURE_ALGORITHM=rsa-sha256 # or ecdsa-sha256 8 | 9 | echo "Signing xml with $KEYSTORE_FILE..." 10 | xmlsectool --sign --keyInfoKeyName "$NAME" --digest SHA-256 \ 11 | --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#$SIGNATURE_ALGORITHM \ 12 | --inFile $TOKEN_FILE --outFile "$NAME".tsml --keystore $KEYSTORE_FILE --keystoreType PKCS12 \ 13 | --key 1 --keyPassword "YOUR .P12 PASSWORD" --signaturePosition LAST 14 | -------------------------------------------------------------------------------- /tutorial/img/QR_EntryToken_ETH_address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartTokenLabs/TokenScript-Examples/ddfe8425b5d27277aed3f4a15594b23da8caf416/tutorial/img/QR_EntryToken_ETH_address.png -------------------------------------------------------------------------------- /tutorial/step-1-forming-the-layout.md: -------------------------------------------------------------------------------- 1 | ## Forming the layout in TokenScript 2 | 3 | ### Resources 4 | All the files to complete this tutorial are contained in the example nft directory [here](https://github.com/AlphaWallet/TokenScript-Examples/tree/master/examples/EntryToken). 5 | 6 | ### Adding your layout 7 | Since TokenScript is essentially an XML dialect, it is possible to plug in your existing layout files in HTML, CSS and JS. To begin, simply clone this repo and take a look at the token.en.shtml and enter.en.shtml files inside the example NFT directory. 8 | 9 | $ git clone https://github.com/AlphaWallet/TokenScript-Examples && cd TokenScript-Examples/examples/EntryToken 10 | 11 | This demo will go through an example token which allows you to enter fake Satoshi's house with an NFT token and a challenge response off chain. 12 | 13 | ## View iconified and regular layout 14 | In our wallet, you can render both an iconified and regular view. The iconified view is shown 15 | in the wallet token card and gives a summary of all the tokens you have within a contract. 16 | 17 | It looks something like this: 18 | 19 | [](https://github.com/AlphaWallet/TokenScript/blob/master/doc/img/iconified-view.jpeg) 20 | 21 | 22 | 23 | The regular view is displayed after a user clicks on a particular token and it shows all the 24 | functions available to the user as well as a more in depth view of the token. It looks something like this: 25 | 26 | [](https://github.com/AlphaWallet/TokenScript/blob/master/doc/img/regular-view.jpeg) 27 | -------------------------------------------------------------------------------- /tutorial/step-2-assembling-the-XML-file.md: -------------------------------------------------------------------------------- 1 | ## Assembling the XML File 2 | 3 | So, now that you have your token.en.shtml, enter.en.shtml and shared.css file, we are now ready to continue on to the XML file. This file will define the function calls, how we define the meaning of our tokens, off chain functionality of the token (in our example, it would be entering a building with a token via a challenge response) and plugging in the layout. 4 | 5 | Since NFTs can encode information inside their 32 bytes such as genes or what time the event is supposed to be held, we can use TokenScript to interpret the meaning of such tokens so that the user is given context. Furthermore, it is also possible to define logic which queries the smart contract for additional information, within the context of the token id itself. 6 | 7 | To inspect the example EntryToken.xml file we have for you, simply: 8 | 9 | $ cd examples/EntryToken && cat EntryToken.xml 10 | 11 | We have set up contracts on mainnet, ropsten, kovan & rinkeby that will always return a balance of two NFTs. You can use these to test against the sample TokenScript provided in the tutorial examples. 12 | 13 | ### Creating your own XML file or editing ours 14 | 15 | You can make your own changes to the sample XML file in the examples directory and change it to match whatever you like. Once you drag and drop it in the next step, you will be able to see the changes reload and since there is a hardcoded balance of two NFTs, you will be able to play around with it. 16 | -------------------------------------------------------------------------------- /tutorial/step-3-debugging-and-testing.md: -------------------------------------------------------------------------------- 1 | ## Debugging and testing on iOS and Android 2 | So you now have your completed .xml and .shtml files, excellent! You can now merge the files together and drop them for testing in AlphaWallet iOS and Android. To merge the files together run 'make EntryToken.canonicalized.xml' which will validate the files and put them all together. Since we have hardcoded the balances for this contract, you will be able to see them immediately in your wallet after you add them by clicking the + button in the top-right of the wallet tab, and entering the contract address. 3 | 4 | For Ethereum mainnet: 5 | 6 | ![qr code](https://github.com/AlphaWallet/TokenScript-Examples/blob/master/tutorial/img/QR_EntryToken_ETH_address.png) 7 | '0x63cCEF733a093E5Bd773b41C96D3eCE361464942' 8 | 9 | Or your choice of testnet (see the `ts:address` tag in EntryToken.xml for each available network's address). 10 | 11 | ** We have uploaded this example xml file to our repo server, this means you do not have to drag and drop it to the device unless you are planning to edit it or create your own ** 12 | 13 | ### Get AlphaWallet iOS or Android 14 | [](https://itunes.apple.com/us/app/alphawallet/id1358230430?ls=1&mt=8) [](https://play.google.com/store/apps/details?id=io.stormbird.wallet&hl=en_US) 15 | 16 | ### Clone the source 17 | Go to either [iOS](https://github.com/AlphaWallet/alpha-wallet-ios) or [Android](https://github.com/AlphaWallet/alpha-wallet-android) source repo 18 | 19 | ### Debugging on iOS 20 | After cloning the source code you can run it with either the emulator or your own phone via xcode or AppCode. If you are using the emulator, simply copy the path it prints when loading up in xcode and cd into it. Once there you shoud see a directory called 'assetDefinitionsOverrides', simply drop the file into this directory. 21 | 22 | If you are using your real device, simply airdrop the canonicalized.xml file or drop the xml file with its three layout files (shared.css, enter.en.shtml & token.en.shtml). 23 | 24 | ### Debugging on Android 25 | As with iOS you can either use your own device or the emulator. Run on Android Studio/Intellij and use your device or the emulator. In the AlphaWallet settings choose 'enable dev override', allow the app access to file structure then drag and drop the file into the AlphaWallet directory at root or upload to sdcard/AlphaWallet using the Device File Explorer. If the 'enable dev override' is not chosen inside the app, it will not be able to pick up files in this directory. 26 | 27 | -------------------------------------------------------------------------------- /tutorial/step-4-signing-and-publishing.md: -------------------------------------------------------------------------------- 1 | ## Signing and publishing your TokenScript file 2 | 3 | To publish your Tokenscript, it has to be signed. 4 | 5 | Currently, a TokenScript is signed by an SSL key. For example, a TokenScript signed by the SSL key for the domain name shong.wang is displayed as "reputation relies on shong.wang" when rendered. To make your first signing easy, we provided both the signing key and needed SSL certificates. 6 | 7 | ** Dapps like DAI will have a signature from MakerDAO.com's SSL certificate; this gives the user peace of mind that the TokenScript is actually intended by the issuer. The file includes all the relevant code and therefore cannot be tampered with, as that would break the signature verification. ** 8 | 9 | ### Install the tools 10 | 11 | All XML signing tools should work, but we will we demonstrate here with xmlsectool. 12 | 13 | First, check that you have the right tool installed. Say, in OS X with brew installed: 14 | 15 | $ brew install xmlsectool 16 | 17 | If your package manager doesn't provide xmlsectool, you can download from its [home page](https://wiki.shibboleth.net/confluence/display/XSTJ2/xmlsectool+V2+Home) and install it manually. 18 | 19 | From here I'll assume your system supports make. If not, it's easier to wait for the tutorial on how to sign with GUI, which we will produce based on [Oxygen's document](https://www.oxygenxml.com/doc/versions/21.0/ug-editor/topics/signing-files.html#signing-files) by late 2019. 20 | 21 | If you installed xmlsectool manually, for example to `/opt/xmlsectool-2.0.0/`, you will need to change the first line of the MakeFile to this: 22 | 23 | XMLSECTOOL=/opt/xmlsectool-2.0.0/xmlsectool.sh 24 | 25 | Having that sorted out, please also install xmlstarlet and xmllint 26 | 27 | $ brew install xmlstarlet xmllint 28 | 29 | Now we have all the tools ready. 30 | 31 | ### Validate the test TokenScript 32 | 33 | Do a `make`. It will validate EntryToken.xml. It should pass if you haven't changed it. 34 | 35 | $ make EntryToken.canonicalized.xml 36 | # XML Canonicalization 37 | xmlstarlet c14n EntryToken.xml > EntryToken.canonicalized.xml 38 | # XML Validation 39 | -xmlstarlet val --xsd http://tokenscript.org/2019/10/tokenscript/tokenscript.xsd $@ || (mv $@ $@.INVALID; xmllint --noout --schema http://tokenscript.org/2019/10/tokenscript/tokenscript.xsd $@.INVALID) 40 | 41 | ** If the file has errors, it will produce a file named EntryToken.canonicalized.xml.FAILED which you can use for debugging ** 42 | 43 | ### Using your SSL key 44 | To sign a TokenScript file you must retrieve the relevant SSL key that corresponds to the Token you are making a TokenScript for. e.g. `cdp.makerdao.com` for DAI related TokenScripts. 45 | 46 | This file must be converted to .p12 for signing and since most services will give you your file in .pem, here are the steps using OpenSSL to convert it from pem to p12. 47 | 48 | $ openssl pkcs12 -export -out keystore.p12 -inkey pathToYourPrivateKey.pem -in pathToYourCert.pem -certfile pathToYourChain.pem 49 | 50 | This command will ask for you to provide a password to encrypt the .p12, you will need to use this password again for the step below. The output of this command will be `keystore.p12`. 51 | 52 | If you do not want to use your own key for this tutorial, simply skip this step and go to the next which uses the sample key `shong.wang`. 53 | 54 | ### Sign the test TokenScript 55 | 56 | We prepared the signing key and SSL certificates in ssl directory. If you use yours, remember to replace their references in the Makefile or use the command below with your encrypted .p12. 57 | 58 | Run `make` with `EntryToken.tsml` 59 | 60 | $ make EntryToken.tsml 61 | /opt/xmlsectool-2.0.0/xmlsectool.sh --sign --keyInfoKeyName 'Shong Wang' --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 --inFile EntryToken.canonicalized.xml --outFile EntryToken.tsml --key ssl/shong.wang.key --certificate ssl/shong.wang.certs 62 | INFO XMLSecTool - Reading XML document from file 'EntryToken.canonicalized.xml' 63 | INFO XMLSecTool - XML document parsed and is well-formed. 64 | INFO XMLSecTool - XML document successfully signed 65 | INFO XMLSecTool - XML document written to file /home/weiwu/IdeaProjects/TokenScript/examples/ticket/EntryToken.tsml 66 | # removing the canonicalized created for validation 67 | rm EntryToken.canonicalized.xml 68 | 69 | And now you get a signed TokenScript EntryToken.tsml which is ready to be published. This file can also be dropped to the iOS or Android app as described in the previous step. 70 | 71 | If you are signing with your own key from the step above, run: 72 | 73 | $ make EntryToken.tsml KEYSTORE=keystore.p12 KEYPASSWORD=YourPassword 74 | 75 | ### Publishing your TokenScript 76 | 77 | To test your current .tsml file, you can simply drop in onto your device with the instructions provided by step 3. As of now, we are serving signed tsml files from a server that the device can pull from to load into it's corresponding token card. 78 | 79 | If you would like to publish your own tsml file to run on this server, create a PR in this [repo](https://github.com/AlphaWallet/TokenScript-Repo) and we will review it. 80 | -------------------------------------------------------------------------------- /tutorial/tutorial-files/Coin.sol: -------------------------------------------------------------------------------- 1 | 2 | // Specifies that the source code is for a version 3 | // of Solidity greater than 0.5.0 4 | pragma solidity >=0.5.0 <0.7.0; 5 | 6 | // A contract is a collection of functions and data (its state) 7 | // that resides at a specific address on the Ethereum blockchain. 8 | contract Coin { 9 | // The keyword "public" makes variables accessible from outside a contract 10 | // and creates a function that other contracts or SDKs can call to access the value 11 | 12 | string public name = "Coin"; //fancy name: eg Simon Bucks 13 | uint256 public decimals = 18; //How many decimals to show. 14 | string public symbol = "COIN"; //An identifier: eg SBX 15 | 16 | // Returns balance of an address 17 | function balanceOf(address addr) public view returns (uint) { 18 | return balances[addr]; 19 | } 20 | 21 | // An address stores addresses of contracts or external (user) accounts 22 | address public minter; 23 | 24 | // A mapping lets you create complex custom data types. 25 | // This mapping assigns an unsigned integer to an address 26 | // and is also a public variable. 27 | mapping (address => uint) public balances; 28 | 29 | // Events allow Ethereum clients to react to specific 30 | // contract changes you declare. 31 | // This defines the event and it is sent later 32 | event Sent(address from, address to, uint amount); 33 | 34 | // A special function only run during the creation of the contract 35 | constructor() public { 36 | // Uses the special msg global variable to store the 37 | // address of the contract creator 38 | minter = msg.sender; 39 | } 40 | 41 | // Sends an amount of newly created coins to an address 42 | function mint(address receiver, uint amount) public { 43 | // require statements define conditions that must pass 44 | // before state is changed. 45 | // If it fails (equals false), an exception is triggered 46 | // and reverts all modifications to state from the current call 47 | 48 | // Can only be called by the contract creator 49 | require(msg.sender == minter); 50 | 51 | // Ensures a maximum amount of tokens 52 | require(amount < 1e60); 53 | balances[receiver] += amount; 54 | } 55 | 56 | // Sends an amount of existing coins 57 | // from any caller to an address 58 | function transfer(address receiver, uint amount) public { 59 | // The sender must have enough coins to send 60 | require(amount <= balances[msg.sender], "Insufficient balance."); 61 | // Adjust balances 62 | balances[msg.sender] -= amount; 63 | balances[receiver] += amount; 64 | // Emit event defined earlier 65 | emit Sent(msg.sender, receiver, amount); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tutorial/tutorial-files/Coin.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 13 | 14 | Coin 15 | 16 | 17 | 0x9E9002A92e91f66fe7F94D2394B3AF68eb886f39 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Mint 26 | 27 | 28 | 29 | Address to receive created tokens 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Amount to create 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | &mint.en; 55 | 56 | 57 | 58 | 59 | 60 | Balance 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /tutorial/tutorial-files/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(TOKENSCRIPT_SCHEMA),) 2 | TOKENSCRIPT_SCHEMA=http://tokenscript.org/2019/10/tokenscript/tokenscript.xsd 3 | endif 4 | 5 | ifeq ($(XMLSECTOOL),) 6 | XMLSECTOOL=xmlsectool 7 | endif 8 | 9 | ifeq ($(XMLLINT),) 10 | XMLLINT=xmllint 11 | endif 12 | 13 | ifeq ($(XMLSEC),) 14 | XMLSEC=xmlsec1 # xmlsec for Linux/Windows 15 | endif 16 | 17 | 18 | ifndef KEY 19 | KEY=1 20 | endif 21 | 22 | SIGNATURE_ALGORITHM=rsa-sha256 23 | 24 | help: 25 | # Needs a target, example: $$ make EntryToken.canonicalized.xml 26 | # 27 | # Let's say you have a TokenScript "EntryToken.xml" 28 | # - to validate and canonicalize, add 'canonicalized' in the filename 29 | @echo $$ make EntryToken.canonicalized.xml 30 | # - to sign, use tsml as file extension: 31 | @echo $$ make EntryToken.tsml 32 | 33 | %.canonicalized.xml : %.xml 34 | # XML canonicalization and validation against TS schema 35 | $(XMLLINT) --c14n $^ > $@ && \ 36 | $(XMLLINT) --noout --schema $(TOKENSCRIPT_SCHEMA) $@ || \ 37 | (mv $@ $@.TEST && exit 1) 38 | 39 | %.tsml: %.canonicalized.xml 40 | ifeq (,$(KEYPASSWORD)) 41 | $(error KEYPASSWORD is not set) 42 | endif 43 | ifeq (,$(KEYSTORE)) 44 | @echo ---------------- Keystore missing. Try this ---------------- 45 | @echo $$ make KEYSTORE=shong.wang.p12 KEYPASSWORD=shong.wang KEYINFO='"Shong Wang"' $@ 46 | @echo replace it with your .p12 file and your password 47 | rm $^ 48 | else 49 | # Signing with xmlsec requires original .xml file to contain the Signature tag. 50 | # $(XMLSEC) sign --pkcs12:"$(KEYINFO)" $(KEYSTORE) --pwd "$(KEYPASSWORD)" --output $@ $^ 51 | # For now use xmlsectool... 52 | $(XMLSECTOOL) --sign --keyInfoKeyName "$(KEYINFO)" --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#$(SIGNATURE_ALGORITHM) --inFile $^ --outFile $@ --keystore $(KEYSTORE) --keystoreType PKCS12 --key $(KEY) --keyPassword "$(KEYPASSWORD)" --signaturePosition LAST 53 | # removing the canonicalized created for validation 54 | rm $^ 55 | endif 56 | -------------------------------------------------------------------------------- /tutorial/tutorial-files/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #725BA4; 3 | color: #FCE8DF; 4 | font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; 5 | text-align: center; 6 | } -------------------------------------------------------------------------------- /tutorial/tutorial-files/mint.shtml: -------------------------------------------------------------------------------- 1 | 29 |
30 | --------------------------------------------------------------------------------