strings -> mycoin (cointype change)

This commit is contained in:
rigelrozanski
2017-10-11 13:24:49 -04:00
parent d3b4d42458
commit 40c79a65b3
24 changed files with 93 additions and 93 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ $ basecoin start
## Send the money
```
% basecli tx send --name demo --amount 1000strings --sequence 1 --to $YOU
% basecli tx send --name demo --amount 1000mycoin --sequence 1 --to $YOU
-> copy hash to HASH
% basecli query tx $HASH
% basecli query account $YOU
+2 -2
View File
@@ -49,8 +49,8 @@ func BuildApp(feeDenom string) sdk.Handler {
}
func main() {
// require all fees in strings - change this in your app!
commands.Handler = BuildApp("strings")
// require all fees in mycoin - change this in your app!
commands.Handler = BuildApp("mycoin")
RootCmd.AddCommand(
commands.InitCmd,
+3 -3
View File
@@ -59,7 +59,7 @@ $ curl -X POST $URL/sign --data '{
"tx": {
"type": "sigs/multi",
"data": {
"tx": {"type":"coin/send","data":{"inputs":[{"address":{"chain":"","app":"role","addr":"62616E6B32"},"coins":[{"denom":"strings","amount":900000}]}],"outputs":[{"address":{"chain":"","app":"sigs","addr":"BDADF167E6CF2CDF2D621E590FF1FED2787A40E0"},"coins":[{"denom":"strings","amount":900000}]}]}},
"tx": {"type":"coin/send","data":{"inputs":[{"address":{"chain":"","app":"role","addr":"62616E6B32"},"coins":[{"denom":"mycoin","amount":900000}]}],"outputs":[{"address":{"chain":"","app":"sigs","addr":"BDADF167E6CF2CDF2D621E590FF1FED2787A40E0"},"coins":[{"denom":"mycoin","amount":900000}]}]}},
"signatures": null
}
}
@@ -82,7 +82,7 @@ $ curl -X POST $URL/sign --data '{
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
@@ -97,7 +97,7 @@ $ curl -X POST $URL/sign --data '{
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
+7 -7
View File
@@ -33,9 +33,9 @@ test01SendTx() {
SENDER=$(getAddr $RICH)
RECV=$(getAddr $POOR)
assertFalse "line=${LINENO}, missing dest" "${CLIENT_EXE} tx send --amount=992strings --sequence=1"
assertFalse "line=${LINENO}, bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992strings --sequence=1 --to=$RECV --name=$RICH"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992strings --sequence=1 --to=$RECV --name=$RICH)
assertFalse "line=${LINENO}, missing dest" "${CLIENT_EXE} tx send --amount=992mycoin --sequence=1"
assertFalse "line=${LINENO}, bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -54,7 +54,7 @@ test02SendTxWithFee() {
RECV=$(getAddr $POOR)
# Test to see if the auto-sequencing works, the sequence here should be calculated to be 2
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90strings --fee=10strings --to=$RECV --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90mycoin --fee=10mycoin --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -67,7 +67,7 @@ test02SendTxWithFee() {
checkSendFeeTx $HASH $TX_HEIGHT $SENDER "90" "10"
# assert replay protection
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90strings --fee=10strings --sequence=2 --to=$RECV --name=$RICH 2>/dev/null)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90mycoin --fee=10mycoin --sequence=2 --to=$RECV --name=$RICH 2>/dev/null)
assertFalse "line=${LINENO}, replay: $TX" $?
# checking normally
@@ -102,8 +102,8 @@ test03CreditTx() {
RECV=$(getAddr $POOR)
# make sure we are controlled by permissions (only rich can issue credit)
assertFalse "line=${LINENO}, bad password" "echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=1000strings --sequence=1 --to=$RECV --name=$POOR"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=1000strings --sequence=3 --to=$RECV --name=$RICH)
assertFalse "line=${LINENO}, bad password" "echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=1000mycoin --sequence=1 --to=$RECV --name=$POOR"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=1000mycoin --sequence=3 --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
+5 -5
View File
@@ -174,7 +174,7 @@ test04SendIBCPacket() {
SENDER=$(getAddr $RICH)
RECV=$(BC_HOME=${CLIENT_2} getAddr $POOR)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002strings \
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \
--to=${CHAIN_ID_2}::${RECV} --name=$RICH)
txSucceeded $? "$TX" "${CHAIN_ID_2}::${RECV}"
# quit early if there is no point in more tests
@@ -209,7 +209,7 @@ test05ReceiveIBCPacket() {
export BC_HOME=${CLIENT_2}
# make some credit, so we can accept the packet
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=60006strings --to=$CHAIN_ID_1:: --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx credit --amount=60006mycoin --to=$CHAIN_ID_1:: --name=$RICH)
txSucceeded $? "$TX" "${CHAIN_ID_1}::"
checkAccount $CHAIN_ID_1:: "60006"
@@ -269,7 +269,7 @@ assertNewHeight() {
# RECV=$(BC_HOME=${CLIENT_2} getAddr $POOR)
# export BC_HOME=${CLIENT_1}
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002strings \
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \
# --sequence=1 --to=${CHAIN_ID_2}/${RECV} --name=$RICH)
# txSucceeded $? "$TX" "${CHAIN_ID_2}/${RECV}"
# # an example to quit early if there is no point in more tests
@@ -318,7 +318,7 @@ assertNewHeight() {
# # Get paid on chain1
# export BC_HOME=${CLIENT_1}
# SENDER=$(getAddr $RICH)
# RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000strings \
# RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
# --sequence=$1 --to=$RELAY_ADDR --name=$RICH)
# txSucceeded $? "$RES" "$RELAY_ADDR"
# if [ $? != 0 ]; then echo "can't pay chain1!"; return 1; fi
@@ -326,7 +326,7 @@ assertNewHeight() {
# # Get paid on chain2
# export BC_HOME=${CLIENT_2}
# SENDER=$(getAddr $RICH)
# RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000strings \
# RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
# --sequence=$2 --to=$RELAY_ADDR --name=$RICH)
# txSucceeded $? "$RES" "$RELAY_ADDR"
# if [ $? != 0 ]; then echo "can't pay chain2!"; return 1; fi
+3 -3
View File
@@ -62,7 +62,7 @@ test01SendTx() {
SENDER=$(restAddr $RICH)
RECV=$(restAddr $POOR)
CMD="{\"from\": {\"app\": \"sigs\", \"addr\": \"$SENDER\"}, \"to\": {\"app\": \"sigs\", \"addr\": \"$RECV\"}, \"amount\": [{\"denom\": \"strings\", \"amount\": 992}], \"sequence\": 1}"
CMD="{\"from\": {\"app\": \"sigs\", \"addr\": \"$SENDER\"}, \"to\": {\"app\": \"sigs\", \"addr\": \"$RECV\"}, \"amount\": [{\"denom\": \"mycoin\", \"amount\": 992}], \"sequence\": 1}"
UNSIGNED=$(curl -XPOST ${URL}/build/send -d "$CMD" 2>/dev/null)
if [ -n "$DEBUG" ]; then echo $UNSIGNED; echo; fi
@@ -120,7 +120,7 @@ test04CreateRoleInvalid() {
# RECV=$(getAddr $POOR)
# # Test to see if the auto-sequencing works, the sequence here should be calculated to be 2
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90strings --fee=10strings --to=$RECV --name=$RICH)
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90mycoin --fee=10mycoin --to=$RECV --name=$RICH)
# txSucceeded $? "$TX" "$RECV"
# HASH=$(echo $TX | jq .hash | tr -d \")
# TX_HEIGHT=$(echo $TX | jq .height)
@@ -133,7 +133,7 @@ test04CreateRoleInvalid() {
# checkSendFeeTx $HASH $TX_HEIGHT $SENDER "90" "10"
# # assert replay protection
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90strings --fee=10strings --sequence=2 --to=$RECV --name=$RICH 2>/dev/null)
# TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90mycoin --fee=10mycoin --sequence=2 --to=$RECV --name=$RICH 2>/dev/null)
# assertFalse "line=${LINENO}, replay: $TX" $?
# checkAccount $SENDER "9007199254739900"
# checkAccount $RECV "1082"
+3 -3
View File
@@ -21,7 +21,7 @@ test00PreRestart() {
SENDER=$(getAddr $RICH)
RECV=$(getAddr $POOR)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992strings --sequence=1 --to=$RECV --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -38,7 +38,7 @@ test01OnRestart() {
SENDER=$(getAddr $RICH)
RECV=$(getAddr $POOR)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000strings --sequence=2 --to=$RECV --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000mycoin --sequence=2 --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
if [ $? != 0 ]; then echo "can't make tx!"; return 1; fi
@@ -52,7 +52,7 @@ test01OnRestart() {
echo "done waiting!"
# last minute tx just at the block cut-off...
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000strings --sequence=3 --to=$RECV --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000mycoin --sequence=3 --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
if [ $? != 0 ]; then echo "can't make second tx!"; return 1; fi
+4 -4
View File
@@ -45,7 +45,7 @@ test02SendTxToRole() {
SENDER=$(getAddr $RICH)
RECV=role:${ROLE}
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --fee=90strings --amount=10000strings --to=$RECV --sequence=2 --name=$RICH)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --fee=90mycoin --amount=10000mycoin --to=$RECV --sequence=2 --name=$RICH)
txSucceeded $? "$TX" "${ROLE}"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -67,14 +67,14 @@ test03SendMultiFromRole() {
assertFalse "line=${LINENO}, has no money yet" "${CLIENT_EXE} query account $TWO 2>/dev/null"
# let's try to send money from the role directly without multisig
FAIL=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000strings --from=$BANK --to=$TWO --sequence=1 --name=$POOR 2>/dev/null)
FAIL=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000mycoin --from=$BANK --to=$TWO --sequence=1 --name=$POOR 2>/dev/null)
assertFalse "need to assume role" $?
FAIL=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000strings --from=$BANK --to=$TWO --sequence=2 --assume-role=${ROLE} --name=$POOR 2>/dev/null)
FAIL=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000mycoin --from=$BANK --to=$TWO --sequence=2 --assume-role=${ROLE} --name=$POOR 2>/dev/null)
assertFalse "need two signatures" $?
# okay, begin a multisig transaction mr. poor...
TX_FILE=$BASE_DIR/tx.json
echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000strings --from=$BANK --to=$TWO --sequence=1 --assume-role=${ROLE} --name=$POOR --multi --prepare=$TX_FILE
echo qwertyuiop | ${CLIENT_EXE} tx send --amount=6000mycoin --from=$BANK --to=$TWO --sequence=1 --assume-role=${ROLE} --name=$POOR --multi --prepare=$TX_FILE
assertTrue "line=${LINENO}, successfully prepare tx" $?
# and get some dude to sign it
# FAIL=$(echo qwertyuiop | ${CLIENT_EXE} tx --in=$TX_FILE --name=$POOR 2>/dev/null)
+1 -1
View File
@@ -21,7 +21,7 @@ var RootCmd = &cobra.Command{
func main() {
// TODO: register the counter here
commands.Handler = counter.NewHandler("strings")
commands.Handler = counter.NewHandler("mycoin")
RootCmd.AddCommand(
commands.InitCmd,
+7 -7
View File
@@ -34,9 +34,9 @@ test01SendTx() {
RECV=$(getAddr $POOR)
# sequence should work well for first time also
assertFalse "Line=${LINENO}, missing dest" "${CLIENT_EXE} tx send --amount=992strings 2>/dev/null"
assertFalse "Line=${LINENO}, bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992strings --to=$RECV --name=$RICH 2>/dev/null"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992strings --to=$RECV --name=$RICH)
assertFalse "Line=${LINENO}, missing dest" "${CLIENT_EXE} tx send --amount=992mycoin 2>/dev/null"
assertFalse "Line=${LINENO}, bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --to=$RECV --name=$RICH 2>/dev/null"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --to=$RECV --name=$RICH)
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -66,9 +66,9 @@ checkCounter() {
test03AddCount() {
SENDER=$(getAddr $RICH)
assertFalse "Line=${LINENO}, bad password" "echo hi | ${CLIENT_EXE} tx counter --countfee=100strings --sequence=2 --name=${RICH} 2>/dev/null"
assertFalse "Line=${LINENO}, bad password" "echo hi | ${CLIENT_EXE} tx counter --countfee=100mycoin --sequence=2 --name=${RICH} 2>/dev/null"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=10strings --sequence=2 --name=${RICH} --valid)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=10mycoin --sequence=2 --name=${RICH} --valid)
txSucceeded $? "$TX" "counter"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)
@@ -94,7 +94,7 @@ test03AddCount() {
fi
# test again with fees...
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=7strings --fee=4strings --sequence=3 --name=${RICH} --valid)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=7mycoin --fee=4mycoin --sequence=3 --name=${RICH} --valid)
txSucceeded $? "$TX" "counter"
# make sure the counter was updated, added 7
@@ -104,7 +104,7 @@ test03AddCount() {
checkAccount $SENDER "9007199254739979"
# make sure we cannot replay the counter, no state change
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=10strings --sequence=2 --name=${RICH} --valid 2>/dev/null)
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --countfee=10mycoin --sequence=2 --name=${RICH} --valid 2>/dev/null)
assertFalse "line=${LINENO}, replay: $TX" $?
checkCounter "2" "17"
checkAccount $SENDER "9007199254739979"