Skip to content

Commit

Permalink
strings -> mycoin (cointype change)
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski committed Oct 11, 2017
1 parent d3b4d42 commit 40c79a6
Show file tree
Hide file tree
Showing 24 changed files with 93 additions and 93 deletions.
26 changes: 13 additions & 13 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)
Expand Down Expand Up @@ -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()
Expand All @@ -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"),
)
Expand Down Expand Up @@ -243,34 +243,34 @@ 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)
assert.Equal(amt, diffOut)

//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()
Expand All @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions benchmarks/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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++ {
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions docs/architecture/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ 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,
}
```

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`


```
Expand Down Expand Up @@ -66,7 +66,7 @@ Output (a json encoding of basecoin.Tx):
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
Expand All @@ -81,7 +81,7 @@ Output (a json encoding of basecoin.Tx):
},
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 900000
}
]
Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -193,7 +193,7 @@ Output:
"data": {
"coins": [
{
"denom": "strings",
"denom": "mycoin",
"amount": 12345
}
]
Expand Down
14 changes: 7 additions & 7 deletions docs/basecoin-basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
#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* ]]'
RES=$((echo $KEYPASS) | #shelldown[7][-1] | jq '.deliver_tx.code')
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 ]]'
Expand Down Expand Up @@ -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]
Expand All @@ -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.
Expand All @@ -219,15 +219,15 @@ 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:

.. code:: shelldown[11]

::

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:
Expand Down
4 changes: 2 additions & 2 deletions docs/basecoin-plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/basecoin-tool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 3 additions & 3 deletions docs/ibc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

::

Expand Down
Loading

0 comments on commit 40c79a6

Please sign in to comment.