• R/O
  • HTTP
  • SSH
  • HTTPS

equity: Zusammenfassung des Repository

Based on BUTXO Programming Language


Neueste Commits RSS

Rev. Zeit Autor Nachricht
d1eb7ab 2019-03-15 15:58:29 oysheng master 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...
feea890 2018-11-20 17:07:12 oysheng add import function (#25) * add import function * mo...

Kürzlich bearbeitete Tags

Name Rev. Zeit Autor
v0.1.1 d1eb7ab 2019-03-15 15:58:29 oysheng

Zweige

Name Rev. Zeit Autor Nachricht
master d1eb7ab 2019-03-15 15:58:29 oysheng optimise equity commandlin...

README.md

equity compiler tool

The equity compiler tool is the equity commandline compiler.

Requirements

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.

bash $ make equity

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

Usage on the commandline

Usage of equity commandline compiler: shell $ ./equity <input_file> [flags]

Using help provides you with an explanation of all options.

shell $ ./equity --help

available flags: shell --bin Binary of the contracts in hex. --instance Object of the Instantiated contracts. --shift Function shift of the contracts.

Example

The contents of the contract file TradeOffer(without file suffix restrictions) are as follows: js 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: shell ./equity TradeOffer --bin

    the return result: shell ======= TradeOffer ======= Binary: 547a6413000000007b7b51547ac1631a000000547a547aae7cac

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

    the return result: shell ======= 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: shell ./equity TradeOffer --instance 84fe51a7739e8e2fe28e7042bb114fd6d6abd09cd22af867729ea001c87cd550 1000 0014d6598ab7dce6b04d43f31ad6eed76b18da553e94 7975f3f71ca7f55ecdef53ccf44224d514bc584bc065770bba8dcdb9d7f9ae6c

    the return result: shell ======= TradeOffer ======= Instantiated program: 207975f3f71ca7f55ecdef53ccf44224d514bc584bc065770bba8dcdb9d7f9ae6c160014d6598ab7dce6b04d43f31ad6eed76b18da553e9402e8032084fe51a7739e8e2fe28e7042bb114fd6d6abd09cd22af867729ea001c87cd550741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0

When you don't know the order of the contract parameters, you can use the prompt function: shell ./equity TradeOffer --instance

the commandline tips: shell ======= TradeOffer ======= Instantiated program: Error: The number of input arguments 0 is less than the number of contract parameters 4 Usage: 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" |

Show on old repository browser