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

View File

@ -7,7 +7,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk"
"github.com/cosmos/cosmos-sdk/modules/auth"
"github.com/cosmos/cosmos-sdk/modules/base"
@ -18,6 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/modules/roles"
"github.com/cosmos/cosmos-sdk/stack"
"github.com/cosmos/cosmos-sdk/state"
abci "github.com/tendermint/abci/types"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/tmlibs/log"
)
@ -104,10 +104,10 @@ func (at *appTest) initAccount(acct *coin.AccountWithKey) {
require.EqualValues(at.t, res, "Success")
}
// reset the in and out accs to be one account each with 7strings
// reset the in and out accs to be one account each with 7mycoin
func (at *appTest) reset() {
at.acctIn = coin.NewAccountWithKey(coin.Coins{{"strings", 7}})
at.acctOut = coin.NewAccountWithKey(coin.Coins{{"strings", 7}})
at.acctIn = coin.NewAccountWithKey(coin.Coins{{"mycoin", 7}})
at.acctOut = coin.NewAccountWithKey(coin.Coins{{"mycoin", 7}})
// Note: switch logger if you want to get more info
logger := log.TestingLogger()
@ -116,7 +116,7 @@ func (at *appTest) reset() {
require.Nil(at.t, err, "%+v", err)
at.app = NewBasecoin(
DefaultHandler("strings"),
DefaultHandler("mycoin"),
store,
logger.With("module", "app"),
)
@ -243,25 +243,25 @@ func TestTx(t *testing.T) {
at := newAppTest(t)
//Bad Balance
at.acctIn.Coins = coin.Coins{{"strings", 2}}
at.acctIn.Coins = coin.Coins{{"mycoin", 2}}
at.initAccount(at.acctIn)
at.app.Commit()
res, _, _ := at.exec(t, at.getTx(coin.Coins{{"strings", 5}}, 1), true)
res, _, _ := at.exec(t, at.getTx(coin.Coins{{"mycoin", 5}}, 1), true)
assert.True(res.IsErr(), "ExecTx/Bad CheckTx: Expected error return from ExecTx, returned: %v", res)
res, diffIn, diffOut := at.exec(t, at.getTx(coin.Coins{{"strings", 5}}, 1), false)
res, diffIn, diffOut := at.exec(t, at.getTx(coin.Coins{{"mycoin", 5}}, 1), false)
assert.True(res.IsErr(), "ExecTx/Bad DeliverTx: Expected error return from ExecTx, returned: %v", res)
assert.True(diffIn.IsZero())
assert.True(diffOut.IsZero())
//Regular CheckTx
at.reset()
res, _, _ = at.exec(t, at.getTx(coin.Coins{{"strings", 5}}, 1), true)
res, _, _ = at.exec(t, at.getTx(coin.Coins{{"mycoin", 5}}, 1), true)
assert.True(res.IsOK(), "ExecTx/Good CheckTx: Expected OK return from ExecTx, Error: %v", res)
//Regular DeliverTx
at.reset()
amt := coin.Coins{{"strings", 3}}
amt := coin.Coins{{"mycoin", 3}}
res, diffIn, diffOut = at.exec(t, at.getTx(amt, 1), false)
assert.True(res.IsOK(), "ExecTx/Good DeliverTx: Expected OK return from ExecTx, Error: %v", res)
assert.Equal(amt.Negative(), diffIn)
@ -269,8 +269,8 @@ func TestTx(t *testing.T) {
//DeliverTx with fee.... 4 get to recipient, 1 extra taxed
at.reset()
amt = coin.Coins{{"strings", 4}}
toll := coin.Coin{"strings", 1}
amt = coin.Coins{{"mycoin", 4}}
toll := coin.Coin{"mycoin", 1}
res, diffIn, diffOut = at.exec(t, at.feeTx(amt, toll, 1), false)
assert.True(res.IsOK(), "ExecTx/Good DeliverTx: Expected OK return from ExecTx, Error: %v", res)
payment := amt.Plus(coin.Coins{toll}).Negative()
@ -283,7 +283,7 @@ func TestQuery(t *testing.T) {
assert := assert.New(t)
at := newAppTest(t)
res, _, _ := at.exec(t, at.getTx(coin.Coins{{"strings", 5}}, 1), false)
res, _, _ := at.exec(t, at.getTx(coin.Coins{{"mycoin", 5}}, 1), false)
assert.True(res.IsOK(), "Commit, DeliverTx: Expected OK return from DeliverTx, Error: %v", res)
resQueryPreCommit := at.app.Query(abci.RequestQuery{

View File

@ -21,7 +21,7 @@ func TestLoadGenesisDoNotFailIfAppOptionsAreMissing(t *testing.T) {
logger := log.TestingLogger()
store, err := NewStore("", 0, logger)
require.Nil(t, err, "%+v", err)
app := NewBasecoin(DefaultHandler("strings"), store, logger)
app := NewBasecoin(DefaultHandler("mycoin"), store, logger)
err = app.LoadGenesis("./testdata/genesis3.json")
require.Nil(t, err, "%+v", err)
}
@ -33,7 +33,7 @@ func TestLoadGenesis(t *testing.T) {
store, err := NewStore("", 0, logger)
require.Nil(err, "%+v", err)
app := NewBasecoin(DefaultHandler("strings"), store, logger)
app := NewBasecoin(DefaultHandler("mycoin"), store, logger)
err = app.LoadGenesis(genesisFilepath)
require.Nil(err, "%+v", err)
@ -65,7 +65,7 @@ func TestLoadGenesisAccountAddress(t *testing.T) {
store, err := NewStore("", 0, logger)
require.Nil(err, "%+v", err)
app := NewBasecoin(DefaultHandler("strings"), store, logger)
app := NewBasecoin(DefaultHandler("mycoin"), store, logger)
err = app.LoadGenesis(genesisAcctFilepath)
require.Nil(err, "%+v", err)

View File

@ -78,7 +78,7 @@ func NewBenchApp(h sdk.Handler, chainID string, n int,
}
// make keys
money := coin.Coins{{"strings", 1234567890}}
money := coin.Coins{{"mycoin", 1234567890}}
accts := make([]*coin.AccountWithKey, n)
for i := 0; i < n; i++ {
accts[i] = coin.NewAccountWithKey(money)
@ -100,10 +100,10 @@ func (b BenchApp) makeTx(useFee bool) []byte {
n := len(b.Accounts)
sender := b.Accounts[cmn.RandInt()%n]
recipient := b.Accounts[cmn.RandInt()%n]
amount := coin.Coins{{"strings", 123}}
amount := coin.Coins{{"mycoin", 123}}
tx := coin.NewSendOneTx(sender.Actor(), recipient.Actor(), amount)
if useFee {
toll := coin.Coin{"strings", 2}
toll := coin.Coin{"mycoin", 2}
tx = fee.NewFee(tx, toll, sender.Actor())
}
sequence := sender.NextSequence()
@ -116,7 +116,7 @@ func (b BenchApp) makeTx(useFee bool) []byte {
}
func BenchmarkMakeTx(b *testing.B) {
h := DefaultHandler("strings")
h := DefaultHandler("mycoin")
app := NewBenchApp(h, "bench-chain", 10, false)
b.ResetTimer()
for i := 1; i <= b.N; i++ {
@ -192,7 +192,7 @@ func BenchmarkSimpleTransfer(b *testing.B) {
prefix += "-memdb"
}
h := DefaultHandler("strings")
h := DefaultHandler("mycoin")
app := NewBenchApp(h, "bench-chain", bb.accounts, bb.toDisk)
b.Run(prefix, func(sub *testing.B) {
benchmarkTransfers(sub, app, bb.blockSize, bb.useFee)

View File

@ -23,7 +23,7 @@ Input:
{
"to": {"app": "role", "addr": "62616E6B32" },
"from": {"app": "sigs", "addr": "BDADF167E6CF2CDF2D621E590FF1FED2787A40E0" },
"amount": { "denom": "strings", "amount": 900000 },
"amount": { "denom": "mycoin", "amount": 900000 },
"sequence": 1,
"multi": true,
}
@ -31,7 +31,7 @@ Input:
Output (a json encoding of basecoin.Tx):
`basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000strings --sequence=1 --multi --prepare=- --no-sign`
`basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000mycoin --sequence=1 --multi --prepare=- --no-sign`
```
@ -66,7 +66,7 @@ Output (a json encoding of basecoin.Tx):
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
@ -81,7 +81,7 @@ Output (a json encoding of basecoin.Tx):
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
@ -123,7 +123,7 @@ Input:
Output:
`basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000strings --sequence=1 --multi --no-sign --prepare=unsigned.json`
`basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000mycoin --sequence=1 --multi --no-sign --prepare=unsigned.json`
`echo 1234567890 | basecli tx --in=unsigned.json --prepare=- --name=matt`
@ -162,7 +162,7 @@ Signed tx as json, directly copy output of `/sign`
Output:
`echo 1234567890 | basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000strings --sequence=1 --multi --name=matt --prepare=signed.json`
`echo 1234567890 | basecli tx send --to=role:62616E6B32 --from=sigs:91C959ADE03D8973E8F2FBA9FD2EED327DCE2B0A --amount=900000mycoin --sequence=1 --multi --name=matt --prepare=signed.json`
`basecli tx --in=signed.json --no-sign`
@ -193,7 +193,7 @@ Output:
"data": {
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 12345
}
]

View File

@ -28,7 +28,7 @@
#shelldown[6][0]
#shelldown[6][1]
RES=$(#shelldown[6][2] | jq '.data.coins[0].denom' | tr -d '"')
assertTrue "Line $LINENO: Expected to have stringss, got $RES" '[[ $RES == strings ]]'
assertTrue "Line $LINENO: Expected to have mycoins, got $RES" '[[ $RES == mycoin ]]'
RES="$(#shelldown[6][3] 2>&1)"
assertTrue "Line $LINENO: Expected to contain ERROR, got $RES" '[[ $RES == *ERROR* ]]'
@ -36,7 +36,7 @@
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
RES=$(#shelldown[8][-1] | jq '.data.coins[0].amount')
assertTrue "Line $LINENO: Expected to contain 1000 strings, got $RES" '[[ $RES == 1000 ]]'
assertTrue "Line $LINENO: Expected to contain 1000 mycoin, got $RES" '[[ $RES == 1000 ]]'
RES=$((echo $KEYPASS) | #shelldown[9][-1] | jq '.deliver_tx.code')
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
@ -191,9 +191,9 @@ exist. Let's send funds from the first account to the second:
::
basecli tx send --name=cool --amount=1000strings --to=$YOU --sequence=1
basecli tx send --name=cool --amount=1000mycoin --to=$YOU --sequence=1
Now if we check the second account, it should have ``1000`` 'strings'
Now if we check the second account, it should have ``1000`` 'mycoin'
coins!
.. code:: shelldown[8]
@ -208,7 +208,7 @@ We can send some of these coins back like so:
::
basecli tx send --name=friend --amount=500strings --to=$ME --sequence=1
basecli tx send --name=friend --amount=500mycoin --to=$ME --sequence=1
Note how we use the ``--name`` flag to select a different account to
send from.
@ -219,7 +219,7 @@ If we try to send too much, we'll get an error:
::
basecli tx send --name=friend --amount=500000strings --to=$ME --sequence=2
basecli tx send --name=friend --amount=500000mycoin --to=$ME --sequence=2
Let's send another transaction:
@ -227,7 +227,7 @@ Let's send another transaction:
::
basecli tx send --name=cool --amount=2345strings --to=$YOU --sequence=2
basecli tx send --name=cool --amount=2345mycoin --to=$YOU --sequence=2
Note the ``hash`` value in the response - this is the hash of the
transaction. We can query for the transaction by this hash:

View File

@ -113,7 +113,7 @@ initialize the light-client and send a transaction:
countercli init --node=tcp://localhost:46657 --genesis=$HOME/.counter/genesis.json
YOU=$(countercli keys get friend | awk '{print $2}')
countercli tx send --name=cool --amount=1000strings --to=$YOU --sequence=1
countercli tx send --name=cool --amount=1000mycoin --to=$YOU --sequence=1
But the Counter has an additional command, ``countercli tx counter``,
which crafts an ``AppTx`` specifically for this plugin:
@ -142,7 +142,7 @@ the counter)
.. code:: shelldown[4]
countercli tx counter --name cool --countfee=2strings --sequence=2 --valid
countercli tx counter --name cool --countfee=2mycoin --sequence=2 --valid
countercli query counter
The Counter value should be 2, because we sent a second valid

View File

@ -277,6 +277,6 @@ Any required plugin initialization should be constructed using
``SetOption`` will be called for each item the genesis file. Within
genesis.json file entries are made in the format:
``"<plugin>/<key>", "<value>"``, where ``<plugin>`` is the plugin name,
and ``<key>`` and ``<value>`` are the strings passed into the plugin
and ``<key>`` and ``<value>`` are the mycoin passed into the plugin
SetOption function. This function is intended to be used to set plugin
specific information such as the plugin state.

View File

@ -360,10 +360,10 @@ start the actual relay.
RELAY_KEY=$BCHOME1_SERVER/key.json
RELAY_ADDR=$(cat $RELAY_KEY | jq .address | tr -d \")
basecli1 tx send --amount=100000strings --sequence=1 --to=$RELAY_ADDR--name=money
basecli1 tx send --amount=100000mycoin --sequence=1 --to=$RELAY_ADDR--name=money
basecli1 query account $RELAY_ADDR
basecli2 tx send --amount=100000strings --sequence=1 --to=$RELAY_ADDR --name=moremoney
basecli2 tx send --amount=100000mycoin --sequence=1 --to=$RELAY_ADDR --name=moremoney
basecli2 query account $RELAY_ADDR
Now we can start the relay process.
@ -398,7 +398,7 @@ labor...
::
# Let's send some funds from test-chain-1
basecli1 tx send --amount=12345strings --sequence=2 --to=test-chain-2/$BROKE --name=money
basecli1 tx send --amount=12345mycoin --sequence=2 --to=test-chain-2/$BROKE --name=money
::

View File

@ -32,7 +32,7 @@ has plenty of coins:
"data": {
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 9007199254740992
}
],
@ -118,10 +118,10 @@ the second transaction being sent by rich, we need to increase
::
basecli tx send --fee=90strings --amount=10000strings --to=role:10CAFE4E --sequence=2 --name=rich
basecli tx send --fee=90mycoin --amount=10000mycoin --to=role:10CAFE4E --sequence=2 --name=rich
We need to pay a transaction fee to the validators, in this case 90
``strings`` to send 10000 ``strings`` Notice that for the ``--to`` flag,
``mycoin`` to send 10000 ``mycoin`` Notice that for the ``--to`` flag,
to specify that we are sending to a role instead of an account, the
``role:`` prefix is added before the role. Because it's ``rich``'s
second transaction, we've incremented the sequence. The output will be
@ -144,7 +144,7 @@ and this time you'll see the coins in the role's account:
"data": {
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 10000
}
],
@ -157,7 +157,7 @@ role's account. First, it must be prepared like so:
::
basecli tx send --amount=6000strings --from=role:10CAFE4E --to=65D406E028319289A0706E294F3B764F44EBA3CF --sequence=1 --assume-role=10CAFE4E --name=poor --multi --prepare=tx.json
basecli tx send --amount=6000mycoin --from=role:10CAFE4E --to=65D406E028319289A0706E294F3B764F44EBA3CF --sequence=1 --assume-role=10CAFE4E --name=poor --multi --prepare=tx.json
you'll be prompted for ``poor``'s password and there won't be any
``stdout`` to the terminal. Note that the address in the ``--to`` flag
@ -207,7 +207,7 @@ The ``tx.json`` file will look like this:
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 6000
}
]
@ -222,7 +222,7 @@ The ``tx.json`` file will look like this:
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 6000
}
]
@ -305,7 +305,7 @@ and get the result:
"data": {
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 4000
}
],
@ -313,7 +313,7 @@ and get the result:
}
}
and see that ``poor`` now has 6000 ``strings``:
and see that ``poor`` now has 6000 ``mycoin``:
::

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

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,

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
}
]

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)

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

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"

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

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)

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,

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"

View File

@ -27,7 +27,7 @@ func BenchmarkSimpleTransfer(b *testing.B) {
logger := log.NewNopLogger()
// set the initial account
acct := NewAccountWithKey(Coins{{"strings", 1234567890}})
acct := NewAccountWithKey(Coins{{"mycoin", 1234567890}})
h.InitState(logger, store, NameCoin, "account", acct.MakeOption(), nil)
sender := acct.Actor()
receiver := sdk.Actor{App: "foo", Address: cmn.RandBytes(20)}
@ -35,7 +35,7 @@ func BenchmarkSimpleTransfer(b *testing.B) {
// now, loop...
for i := 1; i <= b.N; i++ {
ctx := stack.MockContext("foo", 100).WithPermissions(sender)
tx := makeSimpleTx(sender, receiver, Coins{{"strings", 2}})
tx := makeSimpleTx(sender, receiver, Coins{{"mycoin", 2}})
_, err := h.DeliverTx(ctx, store, tx, nil)
// never should error
if err != nil {

View File

@ -69,7 +69,7 @@ func TestParse(t *testing.T) {
{"98 bar , 1 foo ", true, Coins{{"bar", 98}, {"foo", 1}}},
{" 55\t \t bling\n", true, Coins{{"bling", 55}}},
{"2foo, 97 bar", true, Coins{{"bar", 97}, {"foo", 2}}},
{"5 strings,", false, nil}, // no empty coins in a list
{"5 mycoin,", false, nil}, // no empty coins in a list
{"2 3foo, 97 bar", false, nil}, // 3foo is invalid coin name
{"11me coin, 12you coin", false, nil}, // no spaces in coin names
{"1.2btc", false, nil}, // amount must be integer

View File

@ -46,7 +46,7 @@ func (FeeWrapper) Wrap(tx sdk.Tx) (res sdk.Tx, err error) {
// Register adds the sequence flags to the cli
func (FeeWrapper) Register(fs *pflag.FlagSet) {
fs.String(FlagFee, "0strings", "Coins for the transaction fee of the format <amt><coin>")
fs.String(FlagFee, "0mycoin", "Coins for the transaction fee of the format <amt><coin>")
fs.String(FlagPayer, "", "Account to pay fee if not current signer (for multisig)")
}

View File

@ -162,7 +162,7 @@ func CreateGenesisValidatorFiles(cfg *config.Config, genesis, privVal, appName s
}
// GetGenesisJSON returns a new tendermint genesis with Basecoin app_options
// that grant a large amount of "strings" to a single address
// that grant a large amount of "mycoin" to a single address
// TODO: A better UX for generating genesis files
func GetGenesisJSON(pubkey, chainID, addr string, options string) string {
return fmt.Sprintf(`{
@ -184,7 +184,7 @@ func GetGenesisJSON(pubkey, chainID, addr string, options string) string {
"address": "%s",
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 9007199254740992
}
]

View File

@ -253,7 +253,7 @@ package commands
// ibc.IBCTx `json:"unwrap"`
// }{ibcTx}))
// smallCoins := coin.Coin{"strings", 1}
// smallCoins := coin.Coin{"mycoin", 1}
// input := types.NewTxInput(r.privKey.PubKey, coin.Coins{smallCoins}, sequence)
// tx := &types.AppTx{