Skip to content
Permalink
Browse files

Updates on example

* LoomJS v1.7.0
* Updates on Tests and Docs
  • Loading branch information...
eduardonunesp committed Jun 7, 2018
1 parent 8b7c240 commit c56d55ae6683354494442e1e6f433363ce63ef80
Showing with 22 additions and 26 deletions.
  1. +3 −5 README.md
  2. +4 −4 contracts/SimpleStore.sol
  3. +1 −1 package.json
  4. +4 −1 test/SimpleStore.js
  5. +3 −8 truffle.js
  6. +7 −7 yarn.lock
@@ -1,6 +1,6 @@
# Truffle DappChain Example

Simple example of Truffle interacting with Loom DappChain, this example uses [loom-truffle-provider](https://github.com/loomnetwork/loom-truffle-provider)
Simple example of Truffle interacting with Loom DappChain, this example uses [loom-truffle-provider](https://github.com/loomnetwork/loom-truffle-provider) (check LoomTruffleProvider repository for more details)

## Requirements

@@ -28,7 +28,7 @@ npm install

```bash
# Download
wget https://storage.googleapis.com/private.delegatecall.com/loom/osx/build-155/loom
wget https://storage.googleapis.com/private.delegatecall.com/loom/osx/build-161/loom
chmod +x loom
# Run
@@ -42,7 +42,7 @@ chmod +x loom
# On second terminal
# Deploy Migrations.sol and SimpleStore.sol
yarn deploy
yarn deploy
# Running test on directory /test
yarn test
@@ -60,8 +60,6 @@ yarn test

* Loom Truffle Provider is currently compatible only with Truffle `v4.1.8`. Support for newer versions will be added soon.

* Only one account is available for testing and deployment, the one associated with the private key.

Loom Network
----
[https://loomx.io](https://loomx.io)
@@ -3,14 +3,14 @@ pragma solidity ^0.4.22;
contract SimpleStore {
uint value;

event NewValueSet(uint _value);
event NewValueSet(uint _value, address _sender);

function set(uint _value) public {
value = _value;
emit NewValueSet(value);
emit NewValueSet(value, msg.sender);
}

function get() public view returns (uint) {
return value;
function get() public view returns (uint, address) {
return (value, msg.sender);
}
}
@@ -8,7 +8,7 @@
"test": "truffle test --network loom_dapp_chain"
},
"dependencies": {
"loom-truffle-provider": "^0.1.0",
"loom-truffle-provider": "^0.1.1",
"truffle": "4.1.8"
}
}
@@ -15,6 +15,9 @@ contract('SimpleStore', (accounts) => {
const newValue = 1
const tx = await simpleStore.set(newValue, {from: accounts[0]})
assert.equal(tx.logs[0].args._value.toNumber(), newValue)
assert.equal((await simpleStore.get.call()).toNumber(), newValue)

const result = await simpleStore.get.call({from: accounts[1]})
assert.equal(result[0], newValue)
assert.equal(result[1], accounts[1])
})
})
@@ -7,18 +7,13 @@ const readUrl = 'ws://127.0.0.1:9999/queryws'
const privateKey = readFileSync('./private_key', 'utf-8')

const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)
loomTruffleProvider.createExtraAccounts(10)

module.exports = {
networks: {
loom_dapp_chain: {
provider: function() {
return loomTruffleProvider
}, network_id: '*'
},
development: {
host: 'localhost',
port: '8545',
provider: loomTruffleProvider,
network_id: '*'
},
}
}
}
@@ -521,9 +521,9 @@ lodash.keys@^3.0.0:
lodash.isarguments "^3.0.0"
lodash.isarray "^3.0.0"

loom-js@1.4.5:
version "1.4.5"
resolved "https://registry.yarnpkg.com/loom-js/-/loom-js-1.4.5.tgz#f960c0e731f5e84e879a53f0999a941975c6d8fc"
loom-js@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/loom-js/-/loom-js-1.7.0.tgz#db2ead76b4ef3083b1ffdc21c6a2f6b211c482c8"
dependencies:
crypto-browserify "^3.12.0"
google-protobuf "^3.5.0"
@@ -532,11 +532,11 @@ loom-js@1.4.5:
rpc-websockets "^4.1.1"
tweetnacl "^1.0.0"

loom-truffle-provider@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/loom-truffle-provider/-/loom-truffle-provider-0.1.0.tgz#2e53aa10711c6af925c160b086d2518152f31b7a"
loom-truffle-provider@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/loom-truffle-provider/-/loom-truffle-provider-0.1.1.tgz#a5f6f3dd5875f1cd6cdf6c93c524d3e9f71be5db"
dependencies:
loom-js "1.4.5"
loom-js "1.7.0"

md5.js@^1.3.4:
version "1.3.4"

0 comments on commit c56d55a

Please sign in to comment.
You can’t perform that action at this time.