tools.texi (2163B)
1 @node tools 2 @chapter Tools 3 4 5 When installed as a python package, @code{erc20-demurrage-token} installs the @code{erc20-demurrage-token-publish} executable script, which can be used to publish smart contract instances. 6 7 While the man page for the tool can be referred to for general information of the tool usage, two argument flags warrant special mention in the context of this documentation. 8 9 @table @code 10 @item --demurrage-level 11 The percentage of demurrage in terms of the redistribution period, defined as parts-per-million. 12 @item --redistribution-period 13 A numeric value denominated in @emph{minutes} to define the redistribution period of the voucher demurrage. 14 @end table 15 16 For example, to define a 2% demurrage value for a redistribution period of 30 days (43200 minutes), the argument to the argument flags would be: 17 18 @verbatim 19 erc20-demurrage-token-publish --demurrage-level 20000 --redistribution-period 43200 ... 20 @end verbatim 21 22 23 @section Calculating fixed-point values 24 25 The @code{erc20-demurrage-token} package installs the python package @code{dexif} as part of its dependencies. 26 27 This package in turn provides an epinymous command-line tool (@code{dexif}) which converts decimal values to a 128-bit fixed-point value expected by the contract constructor. 28 29 An example: 30 31 @example 32 $ dexif 123.456 33 7b74bc6a7ef9db23ff 34 35 $ dexif -x 7b74bc6a7ef9db23ff 36 123.456 37 @end example 38 39 40 @section Contract interaction with chainlib-eth 41 42 All smart contract tests are implementing using @url{https://git.defalsify.org/chainlib-eth, chainlib-eth} from the chaintool suite. 43 44 The @code{eth-encode} tool from the @code{chainlib-eth} python package may be a convenient way to interact with contract features. 45 46 Some examples include: 47 48 @example 49 # explicitly call changePeriod() 50 $ eth-encode --mode tx --signature changePeriod -e <contract_address> -y <key_file> ... 51 52 # Set the sink address seal (The integer value of the SINK_STATE flag is 2 at the time of writing) 53 $ eth-encode --mode tx --signature seal -e <contract_address> -y <key_file> ... u:2 54 55 # Query current sink address of contract 56 $ eth-encode --mode call --signature sinkAddress -e <contract_address> ... 57 @end example