Coder Social home page Coder Social logo

tokenscript / tokenscript-examples Goto Github PK

View Code? Open in Web Editor NEW
78.0 11.0 45.0 2.79 MB

A repo full of complete TokenScripts which you can use for your own tokens that run natively on AlphaWallet iOS and Android

Home Page: https://tokenscript.org

License: MIT License

Shell 11.83% Makefile 34.12% CSS 3.25% Solidity 50.81%

tokenscript-examples's People

Contributors

bitcoinwarrior1 avatar chintanrathod avatar coreycaplan3 avatar dependabot[bot] avatar hboon avatar jamessmartcell avatar jzaki avatar zhangzhongnan928 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tokenscript-examples's Issues

VC time token TBC don't deploy main net contracts, as the names, date and time are TBC

  • Token actions:
  • Sell
  • Transfer
  • Redeem(or a better name):
  1. this opens up a form: Name, Email address, Topic
  2. once confirmed, sign the form and pass it to paymaster server
  3. Then we manually pick up the information, quick check the token is still held by the original signed, if yes, mark it as redeemed in smart contract
  4. Then create calendar invite for both parties
    Storyboard for VC Time Slot tokens 0.3.pptx
  • Deploy three 721 compatible contracts on the main net:
    Contract name:
  1. Crypto Wednesday Fenbushi
  2. Crypto Wednesday HashKey
  3. Crypto Wednesday LongHash
  • 10 token for each contract

  • Token name: 1-hour meeting with Fenbushi Rin Huang

  • Date

  • Time 9 am-10 am (GMT+8)

  • a photo

  • top 5 portfolios:

  • interest areas:

  • make a sexy layout @tomekalphawallet

  • Ask the 3 VCs use their SSL key to sign TS

  • Get OpenSea to be able to display redeemed or not, and signature.

Nest Dividend time calculation is wrong

There is a time window of 60 hours for you to claim
uint256 getAbonusTimeLimit = 60 hours; // Trigger calculation settlement time
in 0xF67B829397Dc05751a98f243DbdE5Db63f86E7f6

Feedback to Tokenscript Examples for Android Readme

cc @nicktaras

Gulshan Vasnani

GA Q1: I was trying the instruction on https://github.com/AlphaWallet/TokenScript-Examples#for-android
At step-5, I wasn't able to find path sdcard/home/AlphaWallet in phone. Is there any way out to achieve this?

Alphawallet VZ: If you have the TokenScript file ready, you can simply save the file in a place where you can access from your mobile(like google drive, telegram, email and etc.), then open the TokenScript file from your mobile with AlphaWallet( when systerm ask what app to use for opening the TokenScript file, choos e AlphaWallet)

GV: Suggested way out worked for me. I think it would be better to add it to ReadMe of Tokenscript-Examples repo.

ENS layout fixes required

  • Set correctly text should be aligned with image
  • Arrow CSS is problematic on different devices
  • Resolver address text is not checksummed (issue with ASN.1 syntax)
  • iPhone and android views turn out slightly different in item-view (positioning)

About rounding the balance number

For example, if the real balance is 1.537356754, the display balance should be 1.5373 instead of 1.5374

reason:

  1. don't set a wrong expectation, users will expect they can get the full display balance available to use
  2. since we don't have a "send maximum balance" function, users may manually key in the number display in balance, they will key in 1.5374 which will trigger "insufficient balance" or if it is a contract call, will result in transaction fail (I did many times😢)

improve the data loading speed and stability for DeFi tokens

For example: cUSDC token
the speed of displaying the balance from NaN to a real number is no stable(iOS), The speed of showing the layout(Andriod)

sometimes, it shows immediately
sometimes, it takes a few minutes
Sometimes, it will time out, just show NaN(iOS), the loading icon(Andriod)

Schema 2020/03 needs to allow specifying whether an event's parameter is indexed

This is necessary so we can form the RPC payload for event filtering. In the Etherenm node RPC call, the filter part of the payload is a sequence based only by the indexed parameters, not key-value pairs.

https://github.com/AlphaWallet/TokenScript-Examples/blob/master/examples/ENS/ENS.xml#L32

Something to this effect:

    <asnx:module name="NameRegistered">
      <sequence>
        <element name="name" ethereum-type="string"/>
        <element name="label" ethereum-type="bytes32" indexed=true/>
        <element name="owner" ethereum-type="address" indexed=true/>
        <element name="cost" ethereum-type="uint"/>
        <element name="expires" ethereum-type="uint"/>
      </sequence>
    </asnx:module>

(but then, maybe that implies heavily that the module is ethereum-based?)

Handling a token contract which has been migrated/replaced (like DAI->SAI, or TUSD)

Tomek reports that he sees 2 TUSD tokens with the same balance in his wallet. This is happening because they have migrated their contract:

https://etherscan.io/address/0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E
https://etherscan.io/address/0x0000000000085d4780B73119b644AE5ecd22b376

This is just a placeholder so we don't forget about the problem. Some design is needed.

eg:

We can have a simple fix like storing a list of such contract pairs where 1 is replaced by the other and display the old version slightly differently ("legacy" or a bit of generic explanation text). We can't just hide the tokens automatically since the user might want/need to migrate manually (like DAI/SAI).

ENS Token Layout and Actions

actions button:

    • Transfer
    • Renew
    • set ETH address
    • set Content: IPFS, Swam
  1. Records-TEXT
  • DESCRIPTION
  • URL
  • email
    • the existing "Open on ENS" "button"

Layout

TokenCard for Compound tokens

Compond Tokens:

On tap you switch between Interest Rate: 5.75% and Earned so far: 4.3343 ETH

  • DEFI token with interest rate and earned value

Screenshot 2020-07-03 09 59 42

Makefile incomplete

$ make KEYSTORE=~/Desktop/keystore.p12 KEYPASSWORD=*** keyInfoKeyName=AlphaWallet EntryToken.tsml

@colourful-land the above flags should be sufficient

xmlsectool --sign --keyInfoKeyName --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 --inFile EntryToken.canonicalized.xml --outFile EntryToken.tsml --keystore /Desktop/keystore.p12 --keystoreType PKCS12 --key 1 --keyPassword ***make KEYSTORE=/Desktop/keystore.p12 KEYPASSWORD=*** keyInfoKeyName=AlphaWallet EntryToken.tsml
xmlsectool --sign --keyInfoKeyName --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 --inFile EntryToken.canonicalized.xml --outFile EntryToken.tsml --keystore ~/Desktop/keystore.p12 --keystoreType PKCS12 --key 1 --keyPassword *** --signaturePosition LAST
Was passed main parameter 'SHA-256' but no main parameter was defined

XML Security Tool
Provides a command line interface for schema validating, signing, and signature validating an XML file.

==== Command Line Options ====

--help Prints this help information

Action Options - 'sign' and 'verifySignature' are mutually exclusive. At least one option is required.
--validateSchema Schema validate the document.
--sign Sign the XML document.
--verifySignature Check the signature on a signed document.

Data Input Options - 'inFile' and 'inUrl' are mutually exclusive, one is required.
--inFile Specifies the file from which the XML document will be read.
--inUrl Specifies the URL from which the XML document will be read. HTTPS certificates are not validated.
--base64DecodeInput Base64 decodes input. Useful when reading in data produced with the base64EncodeOutput option
--inflateInput Inflates a file created with the "deflate" compression algorithm. This property is ignored if inUrl is used. Instead the returned headers determine if content was deflated
--gunzipInput Inflates a file created with the "gzip" compression algorithm. This property is ignored if inUrl is used. Instead the returned headers determine if content was gzip'ed
--httpProxy HTTP proxy address used when fetching URL-based input files.
--httpProxyPort HTTP proxy port. (default: 80)
--httpProxyUsername Username used to authenticate to the HTTP proxy.
--httpProxyPassword Password used to authenticate to the HTTP proxy.

Schema Validation Option - 'xsd' (default) and 'relaxng' are mutually exclusive option.
--schemaDirectory Specifies a schema file or directory of schema files. Subdirectories are also read.
--xsd Indicates schema files are W3 XML Schema 1.0 files (.xsd).
--relaxng Indicates schema files are OASIS RELAX NG files (.rng).

Signature Creation Options
--referenceIdAttributeName Specifies the name of the attribute on the document element whose value is used as the URI reference of the signature. If omitted, a null reference URI is used.
--signaturePosition Specifies, by 1-based index, which element to place the signature BEFORE. 'FIRST' may be used to indicate that the signature goes BEFORE the first element. 'LAST' may be used to indicate that the signature goes AFTER the last element. (default value: FIRST)
--digest Specifies the name of the digest algorithm to use: SHA-1, SHA-256 (default), SHA-384, SHA-512. For RSA and EC credentials, dictates both the digest and signature algorithms.
--digestAlgorithm Specifies the URI of the digest algorithm to use; overrides --digest.
--signatureAlgorithm Specifies the URI of the signature algorithm to use; overrides --digest.
--keyInfoKeyName Specifies a key name to be included in the key info. Option may be used more than once.
--keyInfoCRL Specifies a file path for a CRL to be included in the key info. Option may be used more than once.

PEM/DER Encoded Certificate/Key Options - these options are mutually exclusive with the Keystore and PKCS#11 options. The 'certificate' option is required for signature verification. The 'certificate' and 'key' options are required for signing.
--certificate Specifies the file from which the signing, or validation, certificate is read.
--key Specifies the file from which the signing key is read.
--keyPassword Specifies the password for the signing key.

Keystore Certificate/Key Options - these options are mutually exclusive with the PEM/DER and PKCS#11 options. Options 'keystore', 'key', and 'keyPassword' are required.
--keystore Specifies the keystore file.
--keystorePassword Specifies the password for the keystore. If not provided then the key password is used.
--keystoreType Specifies the type of the keystore.
--keystoreProvider Specifies the keystore provider class to use instead of the default one for the JVM.
--key Specifies the key alias for the signing key is read.
--keyPassword Specifies the password for the signing key. Keystore password used if none is given.

PKCS#11 Device Certificate/Key Options - these options are mutually exclusive with the PEM/DER and Keystore options. Options 'pkcs11Config' and 'key' are required. Option 'keyPassword' required when signing and, with some PKCS#11 devices, during signature verification.
--pkcs11Config The PKCS#11 token configuration file.
--key Specifies the key alias for the signing key is read.
--keyPassword Specifies the pin for the signing key.
--keystoreProvider The fully qualified class name of the PKCS#11 keystore provider implementation. (e.g., sun.security.pkcs11.SunPKCS11)

Signature verification algorithm blacklist options:
--clearBlacklist Clear the algorithm blacklist.
--blacklistDigest Blacklist a digest by name (e.g., "SHA-1"). Can be used any number of times.
--whitelistDigest Whitelist a digest by name (e.g., "SHA-1"). Can be used any number of times.
--listBlacklist List the contents of the algorithm blacklist.

Data Output Options - Option 'outFile' is required.
--outFile Specifies the file to which the signed XML document will be written.
--base64EncodeOutput Base64 encode the output. Ensures signed content isn't corrupted.
--deflateOutput Deflate compresses the output.
--gzipOutput GZip compresses the output.

Logging Options - these options are mutually exclusive
--verbose Turn on verbose messages.
--quiet Do not write any messages to STDERR or STDOUT.
--logConfig Specifies a logback configuration file to use to configure logging.

make: *** [EntryToken.tsml] Error 1
--signaturePosition LAST
Was passed main parameter 'SHA-256' but no main parameter was defined

XML Security Tool
Provides a command line interface for schema validating, signing, and signature validating an XML file.

==== Command Line Options ====

--help Prints this help information

Action Options - 'sign' and 'verifySignature' are mutually exclusive. At least one option is required.
--validateSchema Schema validate the document.
--sign Sign the XML document.
--verifySignature Check the signature on a signed document.

Data Input Options - 'inFile' and 'inUrl' are mutually exclusive, one is required.
--inFile Specifies the file from which the XML document will be read.
--inUrl Specifies the URL from which the XML document will be read. HTTPS certificates are not validated.
--base64DecodeInput Base64 decodes input. Useful when reading in data produced with the base64EncodeOutput option
--inflateInput Inflates a file created with the "deflate" compression algorithm. This property is ignored if inUrl is used. Instead the returned headers determine if content was deflated
--gunzipInput Inflates a file created with the "gzip" compression algorithm. This property is ignored if inUrl is used. Instead the returned headers determine if content was gzip'ed
--httpProxy HTTP proxy address used when fetching URL-based input files.
--httpProxyPort HTTP proxy port. (default: 80)
--httpProxyUsername Username used to authenticate to the HTTP proxy.
--httpProxyPassword Password used to authenticate to the HTTP proxy.

Schema Validation Option - 'xsd' (default) and 'relaxng' are mutually exclusive option.
--schemaDirectory Specifies a schema file or directory of schema files. Subdirectories are also read.
--xsd Indicates schema files are W3 XML Schema 1.0 files (.xsd).
--relaxng Indicates schema files are OASIS RELAX NG files (.rng).

Signature Creation Options
--referenceIdAttributeName Specifies the name of the attribute on the document element whose value is used as the URI reference of the signature. If omitted, a null reference URI is used.
--signaturePosition Specifies, by 1-based index, which element to place the signature BEFORE. 'FIRST' may be used to indicate that the signature goes BEFORE the first element. 'LAST' may be used to indicate that the signature goes AFTER the last element. (default value: FIRST)
--digest Specifies the name of the digest algorithm to use: SHA-1, SHA-256 (default), SHA-384, SHA-512. For RSA and EC credentials, dictates both the digest and signature algorithms.
--digestAlgorithm Specifies the URI of the digest algorithm to use; overrides --digest.
--signatureAlgorithm Specifies the URI of the signature algorithm to use; overrides --digest.
--keyInfoKeyName Specifies a key name to be included in the key info. Option may be used more than once.
--keyInfoCRL Specifies a file path for a CRL to be included in the key info. Option may be used more than once.

PEM/DER Encoded Certificate/Key Options - these options are mutually exclusive with the Keystore and PKCS#11 options. The 'certificate' option is required for signature verification. The 'certificate' and 'key' options are required for signing.
--certificate Specifies the file from which the signing, or validation, certificate is read.
--key Specifies the file from which the signing key is read.
--keyPassword Specifies the password for the signing key.

Keystore Certificate/Key Options - these options are mutually exclusive with the PEM/DER and PKCS#11 options. Options 'keystore', 'key', and 'keyPassword' are required.
--keystore Specifies the keystore file.
--keystorePassword Specifies the password for the keystore. If not provided then the key password is used.
--keystoreType Specifies the type of the keystore.
--keystoreProvider Specifies the keystore provider class to use instead of the default one for the JVM.
--key Specifies the key alias for the signing key is read.
--keyPassword Specifies the password for the signing key. Keystore password used if none is given.

PKCS#11 Device Certificate/Key Options - these options are mutually exclusive with the PEM/DER and Keystore options. Options 'pkcs11Config' and 'key' are required. Option 'keyPassword' required when signing and, with some PKCS#11 devices, during signature verification.
--pkcs11Config The PKCS#11 token configuration file.
--key Specifies the key alias for the signing key is read.
--keyPassword Specifies the pin for the signing key.
--keystoreProvider The fully qualified class name of the PKCS#11 keystore provider implementation. (e.g., sun.security.pkcs11.SunPKCS11)

Signature verification algorithm blacklist options:
--clearBlacklist Clear the algorithm blacklist.
--blacklistDigest Blacklist a digest by name (e.g., "SHA-1"). Can be used any number of times.
--whitelistDigest Whitelist a digest by name (e.g., "SHA-1"). Can be used any number of times.
--listBlacklist List the contents of the algorithm blacklist.

Data Output Options - Option 'outFile' is required.
--outFile Specifies the file to which the signed XML document will be written.
--base64EncodeOutput Base64 encode the output. Ensures signed content isn't corrupted.
--deflateOutput Deflate compresses the output.
--gzipOutput GZip compresses the output.

Logging Options - these options are mutually exclusive
--verbose Turn on verbose messages.
--quiet Do not write any messages to STDERR or STDOUT.
--logConfig Specifies a logback configuration file to use to configure logging.

make: *** [EntryToken.tsml] Error 1

ENS namehash and tokenId do not match

For bitcoinwarrior1:

  • the token id is 90709120367741562884254292919602093639525327191072711268749299765912123279527 or 0xC88B8AEFEA2B850EF0937F0C2E2F388CA915F3F8BBE3DE0EC40CA83F39F508A7
  • the name hash is 0x0613f0918a589446b4dee8e39a3d66ada50a37d2b2286d2ea34098dd2855f67e

the ENS function add subdomain require that the latter is provided but we are using the token id

Hate to Spread Negativity

I think that the concept behind 'TokenScript' is honestly one of the most redundant, useless ideas I've seen that also has so much effort behind it in terms of development.

That's my honest assessment. I'm not saying this to cut the project down even though that's exactly what this message does. I just want to provide my feedback because I feel like nobody else has ever said that to you guys before and this is how I genuinely feel.

You All are Talented and Needed Though

This feedback doesn't mean you guys aren't brilliant. What you did with AlphaWallet is absolutely superb and this space will forever remain indebted to you all for it.

My dream is to revisit this project / entity behind both 'TokenScript' & AlphaWallet and find that you all have re-shifted focus and decided to put all of your energies behind the direction pursued by AlphaWallet.

That's not an order. You don't have to listen to me and I don't expect you to. My criticism is going to sound biting, but its an honest opinion.

Cannot use attributes as contract refs

Example:

ENS allows you to use their public resolvers (for which there are 3, maybe more) and your own resolvers.

We can get the resolver via a function call like we do in ENS view.en.js but we cannot use this attribute as a contract reference and therefore cannot dynamically provide the resolver to the user.

attribute value caching needs a dependency graph

Need the following cases to test the dependency graph generation.

  • local-ref to an undefined attribute (therefore its value can only be from a view)
  • local-ref to an attribute defined without <origins>
  • an attribute defined in a card whose origin is an etheruem:call that has ref=…
  • an attribute defined in a token which has an ethereum:call origin that has ref=… to another attribute defined in the token (i.e. not tokenID)
  • like the one above, but with a looping reference (which shouldn't be allowed)

Most of these cases also need events.

@James-Sangalli @JamesSmartCell @hboon if you remember an example like that please commend so we can complete the examples.

The goal is to get a portable script (portable = between iOS and Android) that:

Take input: installed TokenScripts.

Output:

  1. A list of events to watch for (including the filters)
  2. For each of these events, a list of attributes to update (if its value is not already in the event).
  3. For each card, the events and attributes relevant to update / retrieve its own attributes

(related work is being done on dependency-graph branch)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.