11
src/cc/dapps/Makefile
Normal file
11
src/cc/dapps/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
# just type make to compile all dapps
|
||||
all: zmigrate oraclefeed
|
||||
|
||||
zmigrate:
|
||||
$(CC) zmigrate.c -o zmigrate -lm
|
||||
|
||||
oraclefeed:
|
||||
$(CC) oraclefeed.c -o oraclefeed -lm
|
||||
|
||||
clean:
|
||||
rm zmigrate oraclefeed
|
||||
28
src/cc/dapps/README.md
Normal file
28
src/cc/dapps/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# CryptoCondition dApps
|
||||
|
||||
## Compiling
|
||||
|
||||
To compile all dapps in this directory:
|
||||
|
||||
make
|
||||
|
||||
## zmigrate - Sprout to Sapling Migration dApp
|
||||
|
||||
This tool converts Sprout zaddress funds into Sapling funds in a new Sapling address.
|
||||
|
||||
### Usage
|
||||
|
||||
./zmigrate zsaplingaddr
|
||||
|
||||
The above command may need to be run multiple times to complete the process.
|
||||
|
||||
This CLI implementation will be called by GUI wallets, average users do not
|
||||
need to worry about using this low-level tool.
|
||||
|
||||
## oraclefeed - feed of price data using oracles
|
||||
|
||||
### Usage
|
||||
|
||||
./oraclefeed $ACNAME $ORACLETXID $MYPUBKEY $FORMAT $BINDTXID [refcoin_cli]
|
||||
|
||||
Supported formats are L and Ihh. Price data from CoinDesk API.
|
||||
@@ -932,20 +932,22 @@ again:
|
||||
if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee )
|
||||
{
|
||||
// generate taddr, send max of 10000.0001
|
||||
static int64_t lastamount,lastamount2,lastamount3,lastamount4;
|
||||
stdamount = 500 * SATOSHIDEN;
|
||||
static int64_t lastamount,lastamount2,lastamount3,lastamount4,refamount = 5000 * SATOSHIDEN;
|
||||
stdamount = refamount;
|
||||
if ( amount == lastamount && amount == lastamount2 )
|
||||
{
|
||||
stdamount /= 10;
|
||||
if ( amount == lastamount3 && amount == lastamount4 )
|
||||
stdamount /= 5;
|
||||
stdamount /= 10;
|
||||
}
|
||||
if ( stdamount < refamount )
|
||||
refamount = stdamount;
|
||||
lastamount4 = lastamount3;
|
||||
lastamount3 = lastamount2;
|
||||
lastamount2 = lastamount;
|
||||
lastamount = amount;
|
||||
if ( amount > stdamount+txfee )
|
||||
amount = stdamount + txfee;
|
||||
if ( amount > stdamount+2*txfee )
|
||||
amount = stdamount + 2*txfee;
|
||||
if ( getnewaddress(coinaddr,coinstr,"") == 0 )
|
||||
{
|
||||
z_sendmany(opidstr,coinstr,"",zcaddr,coinaddr,amount-txfee);
|
||||
|
||||
Reference in New Issue
Block a user