• R/O
  • HTTP
  • SSH

equity: Résumé du dépôt

Based on BUTXO Programming Language

Commits Récents RSS

Révision l'heure Auteur Message:
86dbf38 2019-09-17 11:46:56 oysheng master delete amount checking for unlock statement (#37)
d1eb7ab 2019-03-15 15:58:29 oysheng v0.1.1 optimise equity commandline (#36) * optimise equity co...
d5a12d4 2019-03-15 14:45:50 oysheng add release version (#35) * add release version * Mak...
a695287 2018-12-28 11:31:55 oysheng add commandline option AST for equity tool (#34)
3650db4 2018-12-27 17:23:17 oysheng add the replacement of defined variable for AST and adjus...
1ec98bb 2018-12-20 19:24:21 oysheng add AST for if-else statement which contains lock or unlo...
f05780c 2018-12-11 15:53:16 oysheng add contract LockPosition (#29) * deposit contract Fixe...
4e795f9 2018-12-11 14:57:43 oysheng deposit contract FixedLimitCollect and FixedLimitProfit (...
8b24b60 2018-11-26 16:57:38 oysheng add the argument type "Sign" to support checking signatur...
c83d354 2018-11-21 17:48:35 oysheng the other statements support to operate contract value be...

Tags récemment modifiées

Nom Révision l'heure Auteur
v0.1.1 d1eb7ab 2019-03-15 15:58:29 oysheng


Nom Révision l'heure Auteur Message:
master 86dbf38 2019-09-17 11:46:56 oysheng delete amount checking for ...


equity compiler tool

The equity compiler tool is the equity commandline compiler.


Go version 1.8 or higher, with $GOPATH set to your preferred directory

Build source code, the build target of the equity compiler commandline tool is equity.

$ make equity

then change directory to equity, and you can find the commandline tool equity :

$ cd equity

Usage on the commandline

Usage of equity commandline compiler:

$ ./equity <input_file> [flags]

Using help provides you with an explanation of all options.

$ ./equity --help

available flags:

    --bin        Binary of the contracts in hex.
    --instance   Object of the Instantiated contracts.
    --shift      Function shift of the contracts.


The contents of the contract file TradeOffer(without file suffix restrictions) are as follows:

contract TradeOffer(assetRequested: Asset,
                    amountRequested: Amount,
                    seller: Program,
                    cancelKey: PublicKey) locks valueAmount of valueAsset {
  clause trade() {
    lock amountRequested of assetRequested with seller
    unlock valueAmount of valueAsset
  clause cancel(sellerSig: Signature) {
    verify checkTxSig(cancelKey, sellerSig)
    unlock valueAmount of valueAsset
  • Compiler contract file to generate the binary:
./equity TradeOffer --bin

the return result:

======= TradeOffer =======
  • Query the clause shift for contract:
./equity TradeOffer --shift

the return result:

======= TradeOffer =======
Clause shift:
    trade:  00000000
    cancel:  13000000
    ending:  1a000000

NOTE: If the contract contains only one clause, Users don't need clause selector when unlock contract. Furthermore, there is no signification for ending clause shift except for display.

  • Instantiated contract with arguments:
./equity TradeOffer --instance 84fe51a7739e8e2fe28e7042bb114fd6d6abd09cd22af867729ea001c87cd550 1000 0014d6598ab7dce6b04d43f31ad6eed76b18da553e94 7975f3f71ca7f55ecdef53ccf44224d514bc584bc065770bba8dcdb9d7f9ae6c

the return result:

======= TradeOffer =======
Instantiated program:

When you don't know the order of the contract parameters, you can use the prompt function:

./equity TradeOffer --instance

the commandline tips:

======= TradeOffer =======
Instantiated program:
Error: The number of input arguments 0 is less than the number of contract parameters 4
  equity TradeOffer <assetRequested> <amountRequested> <seller> <cancelKey>

The input contract argument description:

type value description
Boolean true/1 , false/0
Integer 0 ~ 2^63-1
Amount -2^63 ~ 2^63-1
Asset hex string with length 64
Hash hex string with length 64
PublicKey hex string with length 64
Program hex string
String string with ASCII, e.g., "this is a test string"
Afficher sur ancien navigateur de dépôt.