diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a11cbc2a6..c92fdca83 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ stages: - test - js-build - - build - push-release + - build variables: GIT_DEPTH: "3" SIMPLECOV: "true" @@ -26,14 +26,14 @@ linux-stable: - cargo build -j $(nproc) --release -p ethstore - cargo build -j $(nproc) --release -p ethkey - strip target/release/parity - - strip target/release/evm + - strip target/release/parity-evm - strip target/release/ethstore - strip target/release/ethkey - export SHA3=$(target/release/parity tools hash target/release/parity) - md5sum target/release/parity > parity.md5 - sh scripts/deb-build.sh amd64 - cp target/release/parity deb/usr/bin/parity - - cp target/release/evm deb/usr/bin/evm + - cp target/release/parity-evm deb/usr/bin/parity-evm - cp target/release/ethstore deb/usr/bin/ethstore - cp target/release/ethkey deb/usr/bin/ethkey - export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") @@ -55,9 +55,9 @@ linux-stable: artifacts: paths: - target/release/parity - - target/release/parity/evmbin - - target/release/parity/ethstore - - target/release/parity/ethkey + - target/release/parity-evm + - target/release/ethstore + - target/release/ethkey name: "stable-x86_64-unknown-linux-gnu_parity" linux-stable-debian: stage: build @@ -73,14 +73,14 @@ linux-stable-debian: - cargo build -j $(nproc) --release -p ethstore - cargo build -j $(nproc) --release -p ethkey - strip target/release/parity - - strip target/release/evm + - strip target/release/parity-evm - strip target/release/ethstore - strip target/release/ethkey - export SHA3=$(target/release/parity tools hash target/release/parity) - md5sum target/release/parity > parity.md5 - sh scripts/deb-build.sh amd64 - cp target/release/parity deb/usr/bin/parity - - cp target/release/evm deb/usr/bin/evm + - cp target/release/parity-evm deb/usr/bin/parity-evm - cp target/release/ethstore deb/usr/bin/ethstore - cp target/release/ethkey deb/usr/bin/ethkey - export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") @@ -409,16 +409,16 @@ darwin: packagesbuild -v mac/Parity.pkgproj productsign --sign 'Developer ID Installer: PARITY TECHNOLOGIES LIMITED (P2PX3JU8FT)' target/release/Parity\ Ethereum.pkg target/release/Parity\ Ethereum-signed.pkg export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") - mv target/release/Parity\ Ethereum-signed.pkg "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" - md5sum "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" >> "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5" + mv target/release/Parity\ Ethereum-signed.pkg "parity-"$VER"-macos-installer.pkg" + md5sum "parity-"$VER"-macos-installer.pkg" >> "parity-"$VER"-macos-installer.pkg.md5" aws configure set aws_access_key_id $s3_key aws configure set aws_secret_access_key $s3_secret if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/release/parity aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/"parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" --body "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/"parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5" --body "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5" + aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/"parity-"$VER"-macos-installer.pkg" --body "parity-"$VER"-macos-installer.pkg" + aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/"parity-"$VER"-macos-installer.pkg.md5" --body "parity-"$VER"-macos-installer.pkg.md5" curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/$PLATFORM curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/$PLATFORM tags: @@ -460,9 +460,8 @@ windows: - zip win-installer.zip InstallParity.exe InstallParity.exe.md5 - md5sums win-installer.zip > win-installer.zip.md5 - cd ..\target\release\ - - md5sums parity.exe parity.pdb > parity.md5 - md5sums parity.exe > parity.exe.md5 - - zip parity.zip parity.exe parity.pdb parity.md5 + - zip parity.zip parity.exe parity.md5 - md5sums parity.zip > parity.zip.md5 - cd ..\.. - aws configure set aws_access_key_id %s3_key% @@ -504,6 +503,19 @@ docker-build: - sh scripts/docker-build.sh $DOCKER_TAG tags: - docker +test-coverage: + stage: test + only: + - master + script: + - git submodule update --init --recursive + - rm -rf target/* + - rm -rf js/.coverage + - scripts/cov.sh + # - COVERAGE=$(grep -Po 'covered":.*?[^\\]"' target/cov/index.json | grep "[0-9]*\.[0-9]" -o) + # - echo "Coverage:" $COVERAGE + tags: + - kcov test-darwin: stage: test only: diff --git a/Cargo.lock b/Cargo.lock index 72d0b7778..5502d9556 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "parity" -version = "1.6.0" +version = "1.7.0" dependencies = [ "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -29,9 +29,9 @@ dependencies = [ "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.7.0", "parity-ipfs-api 1.7.0", @@ -44,6 +44,7 @@ dependencies = [ "rpassword 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rpc-cli 1.4.0", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -347,7 +348,7 @@ version = "0.5.6" source = "git+https://github.com/ethcore/rust-secp256k1#98ad9b9ecae44a563efdd64273bcebc6b4ed81c6" dependencies = [ "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -405,7 +406,7 @@ dependencies = [ "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -447,8 +448,8 @@ dependencies = [ "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,10 +622,10 @@ dependencies = [ "ethsync 1.7.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-ipc-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-ipc-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", @@ -667,7 +668,7 @@ dependencies = [ "ethcore-io 1.7.0", "ethcore-rpc 1.7.0", "ethcore-util 1.7.0", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-ui 1.7.0", @@ -687,9 +688,9 @@ dependencies = [ "ethcore-ipc-nano 1.7.0", "ethcore-util 1.7.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", - "jsonrpc-tcp-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", + "jsonrpc-tcp-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (git+https://github.com/ethcore/mio?branch=v0.5.x)", @@ -883,10 +884,10 @@ dependencies = [ [[package]] name = "gcc" -version = "0.3.35" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rayon 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -933,7 +934,7 @@ name = "hidapi" version = "0.3.1" source = "git+https://github.com/ethcore/hidapi-rs#9a127c1dca7e327e4fdd428406a76c9f5ef48563" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1081,7 +1082,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jsonrpc-core" version = "6.0.0" -source = "git+https://github.com/ethcore/jsonrpc.git#86d7a89c85f324b5f6671315d9b71010ca995300" +source = "git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6#86d7a89c85f324b5f6671315d9b71010ca995300" dependencies = [ "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1094,10 +1095,10 @@ dependencies = [ [[package]] name = "jsonrpc-http-server" version = "6.0.0" -source = "git+https://github.com/ethcore/jsonrpc.git#86d7a89c85f324b5f6671315d9b71010ca995300" +source = "git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6#86d7a89c85f324b5f6671315d9b71010ca995300" dependencies = [ "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1106,11 +1107,11 @@ dependencies = [ [[package]] name = "jsonrpc-ipc-server" version = "6.0.0" -source = "git+https://github.com/ethcore/jsonrpc.git#86d7a89c85f324b5f6671315d9b71010ca995300" +source = "git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6#86d7a89c85f324b5f6671315d9b71010ca995300" dependencies = [ "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1122,19 +1123,19 @@ dependencies = [ [[package]] name = "jsonrpc-macros" version = "6.0.0" -source = "git+https://github.com/ethcore/jsonrpc.git#86d7a89c85f324b5f6671315d9b71010ca995300" +source = "git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6#86d7a89c85f324b5f6671315d9b71010ca995300" dependencies = [ - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-tcp-server" version = "6.0.0" -source = "git+https://github.com/ethcore/jsonrpc.git#86d7a89c85f324b5f6671315d9b71010ca995300" +source = "git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6#86d7a89c85f324b5f6671315d9b71010ca995300" dependencies = [ "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1188,7 +1189,7 @@ name = "libusb-sys" version = "0.2.3" source = "git+https://github.com/ethcore/libusb-sys#c10b1180646c9dc3f23a9b6bb825abcd3b7487ce" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1252,7 +1253,7 @@ name = "miniz-sys" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1387,7 +1388,7 @@ name = "nanomsg-sys" version = "0.5.0" source = "git+https://github.com/ethcore/nanomsg.rs.git#c40fe442c9afaea5b38009a3d992ca044dcceb00" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1529,14 +1530,6 @@ name = "num-traits" version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "num_cpus" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num_cpus" version = "1.2.0" @@ -1637,7 +1630,7 @@ dependencies = [ "ethcore 1.7.0", "ethcore-util 1.7.0", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", - "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "multihash 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", @@ -1674,7 +1667,7 @@ dependencies = [ "ethcore-signer 1.7.0", "ethcore-util 1.7.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", + "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1703,7 +1696,7 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.4.0" -source = "git+https://github.com/ethcore/js-precompiled.git#9eef2b78d363560fe942062caaaa7f6b1d64dd17" +source = "git+https://github.com/ethcore/js-precompiled.git#547a5352d779bc7821a7a2ec14c6d480833aeabb" dependencies = [ "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1874,11 +1867,12 @@ dependencies = [ [[package]] name = "rayon" -version = "0.4.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1946,7 +1940,7 @@ name = "rocksdb-sys" version = "0.3.0" source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2001,7 +1995,7 @@ name = "rust-crypto" version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2021,6 +2015,14 @@ dependencies = [ "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc_version" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "schannel" version = "0.1.1" @@ -2090,6 +2092,14 @@ dependencies = [ "semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver-parser" version = "0.6.1" @@ -2099,6 +2109,11 @@ dependencies = [ "regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "0.9.6" @@ -2153,7 +2168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "sha3" version = "0.1.0" dependencies = [ - "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2605,7 +2620,7 @@ dependencies = [ "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8e51e7f9c150ba7fd4cee9df8bf6ea3dea5b63b68955ddad19ccd35b71dcfb4d" "checksum futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bb982bb25cd8fa5da6a8eb3a460354c984ff1113da82bcb4f0b0862b5795db82" -"checksum gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "91ecd03771effb0c968fd6950b37e89476a578aaf1c70297d8e92b6516ec3312" +"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" "checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum hamming 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1" @@ -2623,11 +2638,11 @@ dependencies = [ "checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c" "checksum itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d95557e7ba6b71377b0f2c3b3ae96c53f1b75a926a6901a500f557a370af730a" "checksum itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91fd9dc2c587067de817fec4ad355e3818c3d893a78cab32a0a474c7a15bb8d5" -"checksum jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "" -"checksum jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "" -"checksum jsonrpc-ipc-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "" -"checksum jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "" -"checksum jsonrpc-tcp-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "" +"checksum jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)" = "" +"checksum jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)" = "" +"checksum jsonrpc-ipc-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)" = "" +"checksum jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)" = "" +"checksum jsonrpc-tcp-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)" = "" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f" @@ -2669,7 +2684,6 @@ dependencies = [ "checksum num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "287a1c9969a847055e1122ec0ea7a5c5d6f72aad97934e131c83d5c08ab4e45c" "checksum num-rational 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "48cdcc9ff4ae2a8296805ac15af88b3d88ce62128ded0cb74ffb63a587502a84" "checksum num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "51eab148f171aefad295f8cece636fc488b9b392ef544da31ea4b8ef6b9e9c39" -"checksum num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "51fedae97a05f7353612fe017ab705a37e6db8f4d67c5c6fe739a9e70d6eed09" "checksum num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55aabf4e2d6271a2e4e4c0f2ea1f5b07cc589cc1a9e9213013b54a76678ca4f3" "checksum number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "084d05f4bf60621a9ac9bde941a410df548f4de9545f06e5ee9d3aef4b97cd77" "checksum odds 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b28c06e81b0f789122d415d6394b5fe849bde8067469f4c2980d3cdc10c78ec1" @@ -2699,7 +2713,7 @@ dependencies = [ "checksum quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6683b0e23d80813b1a535841f0048c1537d3f86d63c999e8373b39a9b0eb74a" "checksum quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6732e32663c9c271bfc7c1823486b471f18c47a2dbf87c066897b7b51afc83be" "checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" -"checksum rayon 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "655df67c314c30fa3055a365eae276eb88aa4f3413a352a1ab32c1320eda41ea" +"checksum rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50c575b58c2b109e2fbc181820cbe177474f35610ff9e357dc75f6bac854ffbf" "checksum regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)" = "b4329b8928a284580a1c63ec9d846b12f6d3472317243ff7077aff11f23f2b29" "checksum regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "841591b1e05609a643e3b4d0045fce04f701daba7151ddcd3ad47b080693d5a9" "checksum reqwest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bef9ed8fdfcc30947d6b774938dc0c3f369a474efe440df2c7f278180b2d2e6" @@ -2712,6 +2726,7 @@ dependencies = [ "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" +"checksum rustc_version 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e114e275f7c9b5d50bb52b28f9aac1921209f02aa6077c8b255e21eefaf8ffa" "checksum schannel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "167852e03fcd0029c3ddebb5afb0715b2996f6e262b2c2aceaa7cd84edd4b158" "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" "checksum secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f412dfa83308d893101dd59c10d6fda8283465976c28c287c5c855bf8d216bc" @@ -2720,7 +2735,9 @@ dependencies = [ "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f" "checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" +"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" "checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0ae9a3c8b07c09dbe43022486d55a18c629a0618d2241e49829aaef9b6d862f9" "checksum serde_codegen_internals 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3172bf2940b975c0e4f6ab42a511c0a4407d4f46ccef87a9d3615db5c26fa96" "checksum serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ecc6e0379ca933ece58302d2d3034443f06fbf38fd535857c1dc516195cbc3bf" diff --git a/Cargo.toml b/Cargo.toml index 28af3c1f2..099be68e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,10 @@ [package] description = "Parity Ethereum client" name = "parity" -version = "1.6.0" +version = "1.7.0" license = "GPL-3.0" authors = ["Parity Technologies "] +build = "build.rs" [dependencies] log = "0.3" @@ -11,7 +12,7 @@ env_logger = "0.3" rustc-serialize = "0.3" docopt = "0.6" time = "0.1" -num_cpus = "0.2" +num_cpus = "1.2" number_prefix = "0.2" rpassword = "0.2.1" semver = "0.5" @@ -25,7 +26,7 @@ app_dirs = "1.1.1" fdlimit = "0.1" hyper = { default-features = false, git = "https://github.com/ethcore/hyper" } ctrlc = { git = "https://github.com/ethcore/rust-ctrlc.git" } -jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } +jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" } ethsync = { path = "sync" } ethcore = { path = "ethcore" } ethcore-util = { path = "util" } @@ -52,6 +53,9 @@ ethcore-dapps = { path = "dapps", optional = true } clippy = { version = "0.0.103", optional = true} ethcore-secretstore = { path = "secret_store", optional = true } +[build-dependencies] +rustc_version = "0.2" + [dev-dependencies] ethcore-ipc-tests = { path = "ipc/tests" } diff --git a/db/build.rs b/build.rs similarity index 60% rename from db/build.rs rename to build.rs index f5c943d21..0deeff37e 100644 --- a/db/build.rs +++ b/build.rs @@ -14,25 +14,22 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -extern crate ethcore_ipc_codegen as codegen; +extern crate rustc_version; -use std::env; -use std::path::Path; +const MIN_RUSTC_VERSION: &'static str = "1.15.1"; -pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); +fn main() { + let is = rustc_version::version().unwrap(); + let required = MIN_RUSTC_VERSION.parse().unwrap(); + assert!(is >= required, format!(" - // ipc pass - { - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.intermediate.rs.in"); - codegen::expand(&src, &dst); - } +It looks like you are compiling Parity with an old rustc compiler {}. +Parity requires version {}. Please update your compiler. +If you use rustup, try this: - // binary serialization pass - { - let src = Path::new(&out_dir).join("lib.intermediate.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - codegen::expand(&src, &dst); - } + rustup update stable + +and try building Parity again. + +", is, required)); } diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 508fbc1a0..55becf2c1 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -12,8 +12,8 @@ rand = "0.3" log = "0.3" env_logger = "0.3" futures = "0.1" -jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } -jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" } +jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" } +jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" } hyper = { default-features = false, git = "https://github.com/ethcore/hyper" } unicase = "1.3" url = "1.0" diff --git a/dapps/ui/Cargo.toml b/dapps/ui/Cargo.toml index 2ab128ad5..17fc2d448 100644 --- a/dapps/ui/Cargo.toml +++ b/dapps/ui/Cargo.toml @@ -11,7 +11,8 @@ rustc_version = "0.1" [dependencies] parity-ui-dev = { path = "../../js", optional = true } -parity-ui-precompiled = { git = "https://github.com/ethcore/js-precompiled.git", optional = true } +# This is managed by the js/scripts/release.sh script on CI - keep it in a single line +parity-ui-precompiled = { git = "https://github.com/ethcore/js-precompiled.git", optional = true, branch = "master" } [features] no-precompiled-js = ["parity-ui-dev"] diff --git a/db/Cargo.toml b/db/Cargo.toml deleted file mode 100644 index a3fe0804c..000000000 --- a/db/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -description = "Ethcore Database" -homepage = "http://parity.io" -license = "GPL-3.0" -name = "ethcore-db" -version = "1.7.0" -authors = ["Parity Technologies "] -build = "build.rs" - -[build-dependencies] -ethcore-ipc-codegen = { path = "../ipc/codegen" } - -[dependencies] -clippy = { version = "0.0.103", optional = true} -ethcore-devtools = { path = "../devtools" } -ethcore-ipc = { path = "../ipc/rpc" } -rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" } -semver = "0.5" -ethcore-ipc-nano = { path = "../ipc/nano" } -nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" } -crossbeam = "0.2" -ethcore-util = { path = "../util" } - -[features] -dev = ["clippy"] diff --git a/db/src/database.rs b/db/src/database.rs deleted file mode 100644 index 65683faee..000000000 --- a/db/src/database.rs +++ /dev/null @@ -1,565 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -//! Ethcore rocksdb ipc service - -use traits::*; -use rocksdb::{DB, Writable, WriteBatch, IteratorMode, DBIterator, IndexType, Options, DBCompactionStyle, BlockBasedOptions, Direction}; -use std::sync::{RwLock, Arc}; -use std::convert::From; -use ipc::IpcConfig; -use std::mem; -use ipc::binary::BinaryConvertError; -use std::collections::{VecDeque, HashMap, BTreeMap}; - -enum WriteCacheEntry { - Remove, - Write(Vec), -} - -pub struct WriteCache { - entries: HashMap, WriteCacheEntry>, - preferred_len: usize, -} - -const FLUSH_BATCH_SIZE: usize = 4096; - -impl WriteCache { - fn new(cache_len: usize) -> WriteCache { - WriteCache { - entries: HashMap::new(), - preferred_len: cache_len, - } - } - - fn write(&mut self, key: Vec, val: Vec) { - self.entries.insert(key, WriteCacheEntry::Write(val)); - } - - fn remove(&mut self, key: Vec) { - self.entries.insert(key, WriteCacheEntry::Remove); - } - - fn get(&self, key: &[u8]) -> Option> { - self.entries.get(key).and_then( - |vec_ref| match vec_ref { - &WriteCacheEntry::Write(ref val) => Some(val.clone()), - &WriteCacheEntry::Remove => None - }) - } - - /// WriteCache should be locked for this - fn flush(&mut self, db: &DB, amount: usize) -> Result<(), Error> { - let batch = WriteBatch::new(); - let mut removed_so_far = 0; - while removed_so_far < amount { - if self.entries.len() == 0 { break; } - let removed_key = { - let (key, cache_entry) = self.entries.iter().nth(0) - .expect("if entries.len == 0, we should have break in the loop, still we got here somehow"); - - match *cache_entry { - WriteCacheEntry::Write(ref val) => { - batch.put(&key, val)?; - }, - WriteCacheEntry::Remove => { - batch.delete(&key)?; - }, - } - key.clone() - }; - - self.entries.remove(&removed_key); - - removed_so_far = removed_so_far + 1; - } - if removed_so_far > 0 { - db.write(batch)?; - } - Ok(()) - } - - /// flushes until cache is empty - fn flush_all(&mut self, db: &DB) -> Result<(), Error> { - while !self.is_empty() { self.flush(db, FLUSH_BATCH_SIZE)?; } - Ok(()) - } - - fn is_empty(&self) -> bool { - self.entries.is_empty() - } - - fn try_shrink(&mut self, db: &DB) -> Result<(), Error> { - if self.entries.len() > self.preferred_len { - self.flush(db, FLUSH_BATCH_SIZE)?; - } - Ok(()) - } -} - -pub struct Database { - db: RwLock>, - /// Iterators - dont't use between threads! - iterators: RwLock>, - write_cache: RwLock, -} - -unsafe impl Send for Database {} -unsafe impl Sync for Database {} - -impl Database { - pub fn new() -> Database { - Database { - db: RwLock::new(None), - iterators: RwLock::new(BTreeMap::new()), - write_cache: RwLock::new(WriteCache::new(DEFAULT_CACHE_LEN)), - } - } - - pub fn flush(&self) -> Result<(), Error> { - let mut cache_lock = self.write_cache.write(); - let db_lock = self.db.read(); - if db_lock.is_none() { return Ok(()); } - let db = db_lock.as_ref().unwrap(); - - cache_lock.try_shrink(&db)?; - Ok(()) - } - - pub fn flush_all(&self) -> Result<(), Error> { - let mut cache_lock = self.write_cache.write(); - let db_lock = self.db.read(); - if db_lock.is_none() { return Ok(()); } - let db = db_lock.as_ref().expect("we should have exited with Ok(()) on the previous step"); - - cache_lock.flush_all(&db)?; - Ok(()) - - } -} - -impl Drop for Database { - fn drop(&mut self) { - self.flush().unwrap(); - } -} - -#[ipc] -impl DatabaseService for Database { - fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error> { - let mut db = self.db.write(); - if db.is_some() { return Err(Error::AlreadyOpen); } - - let mut opts = Options::new(); - opts.set_max_open_files(256); - opts.create_if_missing(true); - opts.set_use_fsync(false); - opts.set_compaction_style(DBCompactionStyle::DBUniversalCompaction); - if let Some(size) = config.prefix_size { - let mut block_opts = BlockBasedOptions::new(); - block_opts.set_index_type(IndexType::HashSearch); - opts.set_block_based_table_factory(&block_opts); - opts.set_prefix_extractor_fixed_size(size); - } - *db = Some(DB::open(&opts, &path)?); - - Ok(()) - } - - /// Opens database in the specified path with the default config - fn open_default(&self, path: String) -> Result<(), Error> { - self.open(DatabaseConfig::default(), path) - } - - fn close(&self) -> Result<(), Error> { - self.flush_all()?; - - let mut db = self.db.write(); - if db.is_none() { return Err(Error::IsClosed); } - - *db = None; - Ok(()) - } - - fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error> { - let mut cache_lock = self.write_cache.write(); - cache_lock.write(key.to_vec(), value.to_vec()); - Ok(()) - } - - fn delete(&self, key: &[u8]) -> Result<(), Error> { - let mut cache_lock = self.write_cache.write(); - cache_lock.remove(key.to_vec()); - Ok(()) - } - - fn write(&self, transaction: DBTransaction) -> Result<(), Error> { - let mut cache_lock = self.write_cache.write(); - - let mut writes = transaction.writes.borrow_mut(); - for kv in writes.drain(..) { - cache_lock.write(kv.key, kv.value); - } - - let mut removes = transaction.removes.borrow_mut(); - for k in removes.drain(..) { - cache_lock.remove(k); - } - Ok(()) - } - - fn get(&self, key: &[u8]) -> Result>, Error> { - { - let key_vec = key.to_vec(); - let cache_hit = self.write_cache.read().get(&key_vec); - - if cache_hit.is_some() { - return Ok(Some(cache_hit.expect("cache_hit.is_some() = true, still there is none somehow here"))) - } - } - let db_lock = self.db.read(); - let db = db_lock.as_ref().ok_or(Error::IsClosed)?; - - match db.get(key)? { - Some(db_vec) => { - Ok(Some(db_vec.to_vec())) - }, - None => Ok(None), - } - } - - fn get_by_prefix(&self, prefix: &[u8]) -> Result>, Error> { - let db_lock = self.db.read(); - let db = db_lock.as_ref().ok_or(Error::IsClosed)?; - - let mut iter = db.iterator(IteratorMode::From(prefix, Direction::Forward)); - match iter.next() { - // TODO: use prefix_same_as_start read option (not availabele in C API currently) - Some((k, v)) => if k[0 .. prefix.len()] == prefix[..] { Ok(Some(v.to_vec())) } else { Ok(None) }, - _ => Ok(None) - } - } - - fn is_empty(&self) -> Result { - let db_lock = self.db.read(); - let db = db_lock.as_ref().ok_or(Error::IsClosed)?; - - Ok(db.iterator(IteratorMode::Start).next().is_none()) - } - - fn iter(&self) -> Result { - let db_lock = self.db.read(); - let db = db_lock.as_ref().ok_or(Error::IsClosed)?; - - let mut iterators = self.iterators.write(); - let next_iterator = iterators.keys().last().unwrap_or(&0) + 1; - iterators.insert(next_iterator, db.iterator(IteratorMode::Start)); - Ok(next_iterator) - } - - fn iter_next(&self, handle: IteratorHandle) -> Option { - let mut iterators = self.iterators.write(); - let mut iterator = match iterators.get_mut(&handle) { - Some(some_iterator) => some_iterator, - None => { return None; }, - }; - - iterator.next().and_then(|(some_key, some_val)| { - Some(KeyValue { - key: some_key.to_vec(), - value: some_val.to_vec(), - }) - }) - } - - fn dispose_iter(&self, handle: IteratorHandle) -> Result<(), Error> { - let mut iterators = self.iterators.write(); - iterators.remove(&handle); - Ok(()) - } -} - -// TODO : put proper at compile-time -impl IpcConfig for Database {} - -/// Database iterator -pub struct DatabaseIterator { - client: Arc>, - handle: IteratorHandle, -} - -impl Iterator for DatabaseIterator { - type Item = (Vec, Vec); - - fn next(&mut self) -> Option { - self.client.iter_next(self.handle).and_then(|kv| Some((kv.key, kv.value))) - } -} - -impl Drop for DatabaseIterator { - fn drop(&mut self) { - self.client.dispose_iter(self.handle).unwrap(); - } -} - -#[cfg(test)] -mod test { - - use super::Database; - use traits::*; - use devtools::*; - - #[test] - fn can_be_created() { - let db = Database::new(); - assert!(db.is_empty().is_err()); - } - - #[test] - fn can_be_open_empty() { - let db = Database::new(); - let path = RandomTempPath::create_dir(); - db.open_default(path.as_str().to_owned()).unwrap(); - - assert!(db.is_empty().is_ok()); - } - - #[test] - fn can_store_key() { - let db = Database::new(); - let path = RandomTempPath::create_dir(); - db.open_default(path.as_str().to_owned()).unwrap(); - - db.put("xxx".as_bytes(), "1".as_bytes()).unwrap(); - db.flush_all().unwrap(); - assert!(!db.is_empty().unwrap()); - } - - #[test] - fn can_retrieve() { - let db = Database::new(); - let path = RandomTempPath::create_dir(); - db.open_default(path.as_str().to_owned()).unwrap(); - db.put("xxx".as_bytes(), "1".as_bytes()).unwrap(); - db.close().unwrap(); - - db.open_default(path.as_str().to_owned()).unwrap(); - assert_eq!(db.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec()); - } -} - -#[cfg(test)] -mod write_cache_tests { - use super::Database; - use traits::*; - use devtools::*; - - #[test] - fn cache_write_flush() { - let db = Database::new(); - let path = RandomTempPath::create_dir(); - - db.open_default(path.as_str().to_owned()).unwrap(); - db.put("100500".as_bytes(), "1".as_bytes()).unwrap(); - db.delete("100500".as_bytes()).unwrap(); - db.flush_all().unwrap(); - - let val = db.get("100500".as_bytes()).unwrap(); - assert!(val.is_none()); - } - -} - -#[cfg(test)] -mod client_tests { - use super::{DatabaseClient, Database}; - use traits::*; - use devtools::*; - use nanoipc; - use std::sync::Arc; - use std::sync::atomic::{Ordering, AtomicBool}; - use crossbeam; - use run_worker; - - fn init_worker(addr: &str) -> nanoipc::Worker { - let mut worker = nanoipc::Worker::::new(&Arc::new(Database::new())); - worker.add_duplex(addr).unwrap(); - worker - } - - #[test] - fn can_call_handshake() { - let url = "ipc:///tmp/parity-db-ipc-test-10.ipc"; - let worker_should_exit = Arc::new(AtomicBool::new(false)); - let worker_is_ready = Arc::new(AtomicBool::new(false)); - let c_worker_should_exit = worker_should_exit.clone(); - let c_worker_is_ready = worker_is_ready.clone(); - - ::std::thread::spawn(move || { - let mut worker = init_worker(url); - while !c_worker_should_exit.load(Ordering::Relaxed) { - worker.poll(); - c_worker_is_ready.store(true, Ordering::Relaxed); - } - }); - - while !worker_is_ready.load(Ordering::Relaxed) { } - let client = nanoipc::init_duplex_client::>(url).unwrap(); - - let hs = client.handshake(); - - worker_should_exit.store(true, Ordering::Relaxed); - assert!(hs.is_ok()); - } - - #[test] - fn can_open_db() { - let url = "ipc:///tmp/parity-db-ipc-test-20.ipc"; - let path = RandomTempPath::create_dir(); - - let worker_should_exit = Arc::new(AtomicBool::new(false)); - let worker_is_ready = Arc::new(AtomicBool::new(false)); - let c_worker_should_exit = worker_should_exit.clone(); - let c_worker_is_ready = worker_is_ready.clone(); - - ::std::thread::spawn(move || { - let mut worker = init_worker(url); - while !c_worker_should_exit.load(Ordering::Relaxed) { - worker.poll(); - c_worker_is_ready.store(true, Ordering::Relaxed); - } - }); - - while !worker_is_ready.load(Ordering::Relaxed) { } - let client = nanoipc::init_duplex_client::>(url).unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - assert!(client.is_empty().unwrap()); - worker_should_exit.store(true, Ordering::Relaxed); - } - - #[test] - fn can_put() { - let url = "ipc:///tmp/parity-db-ipc-test-30.ipc"; - let path = RandomTempPath::create_dir(); - - crossbeam::scope(move |scope| { - let stop = Arc::new(AtomicBool::new(false)); - run_worker(scope, stop.clone(), url); - let client = nanoipc::generic_client::>(url).unwrap(); - client.open_default(path.as_str().to_owned()).unwrap(); - client.put("xxx".as_bytes(), "1".as_bytes()).unwrap(); - client.close().unwrap(); - - stop.store(true, Ordering::Relaxed); - }); - } - - #[test] - fn can_put_and_read() { - let url = "ipc:///tmp/parity-db-ipc-test-40.ipc"; - let path = RandomTempPath::create_dir(); - - crossbeam::scope(move |scope| { - let stop = Arc::new(AtomicBool::new(false)); - run_worker(scope, stop.clone(), url); - let client = nanoipc::generic_client::>(url).unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - client.put("xxx".as_bytes(), "1".as_bytes()).unwrap(); - client.close().unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - assert_eq!(client.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec()); - - stop.store(true, Ordering::Relaxed); - }); - } - - #[test] - fn can_read_empty() { - let url = "ipc:///tmp/parity-db-ipc-test-45.ipc"; - let path = RandomTempPath::create_dir(); - - crossbeam::scope(move |scope| { - let stop = Arc::new(AtomicBool::new(false)); - run_worker(scope, stop.clone(), url); - let client = nanoipc::generic_client::>(url).unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - assert!(client.get("xxx".as_bytes()).unwrap().is_none()); - - stop.store(true, Ordering::Relaxed); - }); - } - - - #[test] - fn can_commit_client_transaction() { - let url = "ipc:///tmp/parity-db-ipc-test-60.ipc"; - let path = RandomTempPath::create_dir(); - - crossbeam::scope(move |scope| { - let stop = Arc::new(AtomicBool::new(false)); - run_worker(scope, stop.clone(), url); - let client = nanoipc::generic_client::>(url).unwrap(); - client.open_default(path.as_str().to_owned()).unwrap(); - - let transaction = DBTransaction::new(); - transaction.put("xxx".as_bytes(), "1".as_bytes()); - client.write(transaction).unwrap(); - - client.close().unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - assert_eq!(client.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec()); - - stop.store(true, Ordering::Relaxed); - }); - } - - #[test] - fn key_write_read_ipc() { - let url = "ipc:///tmp/parity-db-ipc-test-70.ipc"; - let path = RandomTempPath::create_dir(); - - crossbeam::scope(|scope| { - let stop = StopGuard::new(); - run_worker(&scope, stop.share(), url); - - let client = nanoipc::generic_client::>(url).unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - let mut batch = Vec::new(); - for _ in 0..100 { - batch.push((random_str(256).as_bytes().to_vec(), random_str(256).as_bytes().to_vec())); - batch.push((random_str(256).as_bytes().to_vec(), random_str(2048).as_bytes().to_vec())); - batch.push((random_str(2048).as_bytes().to_vec(), random_str(2048).as_bytes().to_vec())); - batch.push((random_str(2048).as_bytes().to_vec(), random_str(256).as_bytes().to_vec())); - } - - for &(ref k, ref v) in batch.iter() { - client.put(k, v).unwrap(); - } - client.close().unwrap(); - - client.open_default(path.as_str().to_owned()).unwrap(); - for &(ref k, ref v) in batch.iter() { - assert_eq!(v, &client.get(k).unwrap().unwrap()); - } - }); - } -} diff --git a/db/src/lib.rs.in b/db/src/lib.rs.in deleted file mode 100644 index e2f7245a9..000000000 --- a/db/src/lib.rs.in +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -extern crate ethcore_ipc as ipc; -extern crate rocksdb; -extern crate ethcore_devtools as devtools; -extern crate semver; -extern crate ethcore_ipc_nano as nanoipc; -extern crate nanomsg; -extern crate crossbeam; -extern crate ethcore_util as util; - -pub mod database; -pub mod traits; - -pub use traits::{DatabaseService, DBTransaction, Error}; -pub use database::{Database, DatabaseClient, DatabaseIterator}; - -use std::sync::Arc; -use std::sync::atomic::*; -use std::path::PathBuf; - -pub type DatabaseNanoClient = DatabaseClient<::nanomsg::Socket>; -pub type DatabaseConnection = nanoipc::GuardedSocket; - -#[derive(Debug)] -pub enum ServiceError { - Io(std::io::Error), - Socket(nanoipc::SocketError), -} - -impl std::convert::From for ServiceError { - fn from(io_error: std::io::Error) -> ServiceError { ServiceError::Io(io_error) } -} - -impl std::convert::From for ServiceError { - fn from(socket_error: nanoipc::SocketError) -> ServiceError { ServiceError::Socket(socket_error) } -} - -pub fn blocks_service_url(db_path: &str) -> Result { - let mut path = PathBuf::from(db_path); - ::std::fs::create_dir_all(db_path)?; - path.push("blocks.ipc"); - Ok(format!("ipc://{}", path.to_str().unwrap())) -} - -pub fn extras_service_url(db_path: &str) -> Result { - let mut path = PathBuf::from(db_path); - ::std::fs::create_dir_all(db_path)?; - path.push("extras.ipc"); - Ok(format!("ipc://{}", path.to_str().unwrap())) -} - -pub fn blocks_client(db_path: &str) -> Result { - let url = blocks_service_url(db_path)?; - let client = nanoipc::generic_client::>(&url)?; - Ok(client) -} - -pub fn extras_client(db_path: &str) -> Result { - let url = extras_service_url(db_path)?; - let client = nanoipc::generic_client::>(&url)?; - Ok(client) -} - -// for tests -pub fn run_worker(scope: &crossbeam::Scope, stop: Arc, socket_path: &str) { - let socket_path = socket_path.to_owned(); - scope.spawn(move || { - let mut worker = nanoipc::Worker::new(&Arc::new(Database::new())); - worker.add_reqrep(&socket_path).unwrap(); - while !stop.load(Ordering::Relaxed) { - worker.poll(); - } - }); -} diff --git a/db/src/traits.rs b/db/src/traits.rs deleted file mode 100644 index 2a491db96..000000000 --- a/db/src/traits.rs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -//! Ethcore database trait - -use std::cell::RefCell; - -pub type IteratorHandle = u32; - -pub const DEFAULT_CACHE_LEN: usize = 12288; - -#[derive(Binary)] -pub struct KeyValue { - pub key: Vec, - pub value: Vec, -} - -#[derive(Debug, Binary)] -pub enum Error { - AlreadyOpen, - IsClosed, - RocksDb(String), - TransactionUnknown, - IteratorUnknown, - UncommitedTransactions, -} - -impl From for Error { - fn from(s: String) -> Error { - Error::RocksDb(s) - } -} - -/// Database configuration -#[derive(Binary)] -pub struct DatabaseConfig { - /// Optional prefix size in bytes. Allows lookup by partial key. - pub prefix_size: Option, - /// write cache length - pub cache: usize, -} - -impl Default for DatabaseConfig { - fn default() -> DatabaseConfig { - DatabaseConfig { - prefix_size: None, - cache: DEFAULT_CACHE_LEN, - } - } -} - -impl DatabaseConfig { - fn with_prefix(prefix: usize) -> DatabaseConfig { - DatabaseConfig { - prefix_size: Some(prefix), - cache: DEFAULT_CACHE_LEN, - } - } -} - -pub trait DatabaseService : Sized { - /// Opens database in the specified path - fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error>; - - /// Opens database in the specified path with the default config - fn open_default(&self, path: String) -> Result<(), Error>; - - /// Closes database - fn close(&self) -> Result<(), Error>; - - /// Insert a key-value pair in the transaction. Any existing value value will be overwritten. - fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error>; - - /// Delete value by key. - fn delete(&self, key: &[u8]) -> Result<(), Error>; - - /// Get value by key. - fn get(&self, key: &[u8]) -> Result>, Error>; - - /// Get value by partial key. Prefix size should match configured prefix size. - fn get_by_prefix(&self, prefix: &[u8]) -> Result>, Error>; - - /// Check if there is anything in the database. - fn is_empty(&self) -> Result; - - /// Get handle to iterate through keys - fn iter(&self) -> Result; - - /// Next key-value for the the given iterator - fn iter_next(&self, iterator: IteratorHandle) -> Option; - - /// Dispose iteration that is no longer needed - fn dispose_iter(&self, handle: IteratorHandle) -> Result<(), Error>; - - /// Write client transaction - fn write(&self, transaction: DBTransaction) -> Result<(), Error>; -} - -#[derive(Binary)] -pub struct DBTransaction { - pub writes: RefCell>, - pub removes: RefCell>>, -} - -impl DBTransaction { - pub fn new() -> DBTransaction { - DBTransaction { - writes: RefCell::new(Vec::new()), - removes: RefCell::new(Vec::new()), - } - } - - pub fn put(&self, key: &[u8], value: &[u8]) { - let mut brw = self.writes.borrow_mut(); - brw.push(KeyValue { key: key.to_vec(), value: value.to_vec() }); - } - - pub fn delete(&self, key: &[u8]) { - let mut brw = self.removes.borrow_mut(); - brw.push(key.to_vec()); - } -} diff --git a/docker/hub/README.md b/docker/hub/README.md new file mode 100644 index 000000000..6253f53f0 --- /dev/null +++ b/docker/hub/README.md @@ -0,0 +1,3 @@ +Usage + +```docker build --build-arg BUILD_TAG=branch_or_tag_name --no-cache=true --tag ethcore/parity:branch_or_tag_name .``` diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 64010fadf..39bf20070 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -15,7 +15,7 @@ log = "0.3" env_logger = "0.3" rustc-serialize = "0.3" rust-crypto = "0.2.34" -num_cpus = "0.2" +num_cpus = "1.2" crossbeam = "0.2.9" lazy_static = "0.2" bloomchain = "0.1" diff --git a/ethcore/light/src/net/status.rs b/ethcore/light/src/net/status.rs index 3e32f6609..3a09be3c2 100644 --- a/ethcore/light/src/net/status.rs +++ b/ethcore/light/src/net/status.rs @@ -373,7 +373,7 @@ pub fn write_announcement(announcement: &Announcement) -> Vec { mod tests { use super::*; use super::super::request_credits::FlowParams; - use util::{U256, H256, FixedHash}; + use util::{U256, H256}; use rlp::{RlpStream, Stream ,UntrustedRlp, View}; #[test] diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index 825ca2be2..ece35fc21 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -256,7 +256,7 @@ impl TransactionProof { #[cfg(test)] mod tests { use super::*; - use util::{MemoryDB, Address, H256, FixedHash}; + use util::{MemoryDB, Address, H256}; use util::trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut}; use util::trie::recorder::Recorder; diff --git a/ethcore/res/ethereum/kovan.json b/ethcore/res/ethereum/kovan.json index e9c059aaa..330b00c58 100644 --- a/ethcore/res/ethereum/kovan.json +++ b/ethcore/res/ethereum/kovan.json @@ -30,7 +30,8 @@ "params": { "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", - "networkID" : "0x2A" + "networkID" : "0x2A", + "validateReceipts" : false }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/transition_test.json b/ethcore/res/ethereum/transition_test.json index aebea2b4f..1b502f087 100644 --- a/ethcore/res/ethereum/transition_test.json +++ b/ethcore/res/ethereum/transition_test.json @@ -139,6 +139,7 @@ } }, "params": { + "eip98Transition": "0x7fffffffffffffff", "accountStartNonce": "0x00", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", diff --git a/ethcore/src/account_provider/mod.rs b/ethcore/src/account_provider/mod.rs index 2f6d49e75..f9b7727db 100755 --- a/ethcore/src/account_provider/mod.rs +++ b/ethcore/src/account_provider/mod.rs @@ -23,7 +23,7 @@ use self::stores::{AddressBook, DappsSettingsStore, NewDappsPolicy}; use std::fmt; use std::collections::{HashMap, HashSet}; use std::time::{Instant, Duration}; -use util::{FixedHash, RwLock}; +use util::{RwLock}; use ethstore::{SimpleSecretStore, SecretStore, Error as SSError, EthStore, EthMultiStore, random_string, SecretVaultRef, StoreAccountRef}; use ethstore::dir::MemoryDirectory; @@ -152,7 +152,7 @@ impl AccountProvider { manager.set_key_path(if settings.hardware_wallet_classic_key { KeyPath::EthereumClassic } else { KeyPath::Ethereum }); hardware_store = Some(manager) }, - Err(e) => warn!("Error initializing hardware wallets: {}", e), + Err(e) => debug!("Error initializing hardware wallets: {}", e), } } AccountProvider { diff --git a/ethcore/src/action_params.rs b/ethcore/src/action_params.rs index cba8d7c6a..ef9c00523 100644 --- a/ethcore/src/action_params.rs +++ b/ethcore/src/action_params.rs @@ -16,7 +16,7 @@ //! Evm input params. use util::{Address, Bytes, Uint, U256}; -use util::hash::{H256, FixedHash}; +use util::hash::{H256}; use util::sha3::{Hashable, SHA3_EMPTY}; use ethjson; use types::executed::CallType; diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 3626fdd3a..14f3df799 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use std::collections::HashSet; use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, Decoder, DecoderError, View, Stream}; -use util::{Bytes, Address, Uint, FixedHash, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP}; +use util::{Bytes, Address, Uint, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP}; use util::error::{Mismatch, OutOfBounds}; use basic_types::{LogBloom, Seal}; @@ -553,7 +553,6 @@ pub fn enact( b.set_extra_data(header.extra_data().clone()).unwrap_or_else(|e| warn!("Couldn't set extradata: {}. Ignoring.", e)); b.set_uncles_hash(header.uncles_hash().clone()); b.set_transactions_root(header.transactions_root().clone()); - b.set_receipts_root(header.receipts_root().clone()); push_transactions(&mut b, transactions)?; for u in uncles { @@ -618,7 +617,6 @@ mod tests { use state_db::StateDB; use views::BlockView; use util::Address; - use util::hash::FixedHash; use std::sync::Arc; use transaction::SignedTransaction; diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index 89b9ff2fd..ca3b13181 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -18,7 +18,7 @@ use crypto::sha2::Sha256 as Sha256Digest; use crypto::ripemd160::Ripemd160 as Ripemd160Digest; use crypto::digest::Digest; use std::cmp::min; -use util::{U256, H256, Hashable, FixedHash, BytesRef}; +use util::{U256, H256, Hashable, BytesRef}; use ethkey::{Signature, recover as ec_recover}; use ethjson; diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index d15e9e6aa..6c429ddd7 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -25,7 +25,7 @@ use time::precise_time_ns; // util use util::{Bytes, PerfTimer, Itertools, Mutex, RwLock, MutexGuard, Hashable}; use util::{journaldb, DBValue, TrieFactory, Trie}; -use util::{U256, H256, Address, H2048, Uint, FixedHash}; +use util::{U256, H256, Address, H2048, Uint}; use util::trie::TrieSpec; use util::kvdb::*; @@ -151,8 +151,9 @@ pub struct Client { factories: Factories, history: u64, rng: Mutex, - on_mode_change: Mutex>>, + on_user_defaults_change: Mutex) + 'static + Send>>>, registrar: Mutex>, + exit_handler: Mutex) + 'static + Send>>>, } impl Client { @@ -240,8 +241,9 @@ impl Client { factories: factories, history: history, rng: Mutex::new(OsRng::new().map_err(::util::UtilError::StdIo)?), - on_mode_change: Mutex::new(None), + on_user_defaults_change: Mutex::new(None), registrar: Mutex::new(None), + exit_handler: Mutex::new(None), }); { @@ -276,6 +278,11 @@ impl Client { self.notify.write().push(Arc::downgrade(&target)); } + /// Set a closure to call when we want to restart the client + pub fn set_exit_handler(&self, f: F) where F: Fn(bool, Option) + 'static + Send { + *self.exit_handler.lock() = Some(Box::new(f)); + } + /// Returns engine reference. pub fn engine(&self) -> &Engine { &*self.engine @@ -294,9 +301,9 @@ impl Client { self.registrar.lock() } - /// Register an action to be done if a mode change happens. - pub fn on_mode_change(&self, f: F) where F: 'static + FnMut(&Mode) + Send { - *self.on_mode_change.lock() = Some(Box::new(f)); + /// Register an action to be done if a mode/spec_name change happens. + pub fn on_user_defaults_change(&self, f: F) where F: 'static + FnMut(Option) + Send { + *self.on_user_defaults_change.lock() = Some(Box::new(f)); } /// Flush the block import queue. @@ -386,7 +393,7 @@ impl Client { })?; // Final Verification - if let Err(e) = self.verifier.verify_block_final(header, locked_block.block().header()) { + if let Err(e) = self.verifier.verify_block_final(header, locked_block.block().header(), self.engine().params().validate_receipts) { warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); return Err(()); } @@ -651,7 +658,6 @@ impl Client { self.miner.clone() } - /// Replace io channel. Useful for testing. pub fn set_io_channel(&self, io_channel: IoChannel) { *self.io_channel.lock() = io_channel; @@ -1030,9 +1036,9 @@ impl BlockChainClient for Client { let mut mode = self.mode.lock(); *mode = new_mode.clone().into(); trace!(target: "mode", "Mode now {:?}", &*mode); - if let Some(ref mut f) = *self.on_mode_change.lock() { + if let Some(ref mut f) = *self.on_user_defaults_change.lock() { trace!(target: "mode", "Making callback..."); - f(&*mode) + f(Some((&*mode).clone())) } } match new_mode { @@ -1042,6 +1048,22 @@ impl BlockChainClient for Client { } } + fn spec_name(&self) -> String { + self.config.spec_name.clone() + } + + fn set_spec_name(&self, new_spec_name: String) { + trace!(target: "mode", "Client::set_spec_name({:?})", new_spec_name); + if !self.enabled.load(AtomicOrdering::Relaxed) { + return; + } + if let Some(ref h) = *self.exit_handler.lock() { + (*h)(true, Some(new_spec_name)); + } else { + warn!("Not hypervised; cannot change chain."); + } + } + fn best_block_header(&self) -> encoded::Header { self.chain.read().best_block_header() } diff --git a/ethcore/src/client/config.rs b/ethcore/src/client/config.rs index 11078b17b..5c7cf9471 100644 --- a/ethcore/src/client/config.rs +++ b/ethcore/src/client/config.rs @@ -123,6 +123,8 @@ pub struct ClientConfig { pub db_wal: bool, /// Operating mode pub mode: Mode, + /// The chain spec name + pub spec_name: String, /// Type of block verifier used by client. pub verifier_type: VerifierType, /// State db cache-size. diff --git a/ethcore/src/client/error.rs b/ethcore/src/client/error.rs index 9f22673b7..ff8b6d2ce 100644 --- a/ethcore/src/client/error.rs +++ b/ethcore/src/client/error.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use trace::Error as TraceError; use util::UtilError; use std::fmt::{Display, Formatter, Error as FmtError}; @@ -23,8 +22,6 @@ use util::trie::TrieError; /// Client configuration errors. #[derive(Debug)] pub enum Error { - /// TraceDB configuration error. - Trace(TraceError), /// TrieDB-related error. Trie(TrieError), /// Database error @@ -33,12 +30,6 @@ pub enum Error { Util(UtilError), } -impl From for Error { - fn from(err: TraceError) -> Self { - Error::Trace(err) - } -} - impl From for Error { fn from(err: TrieError) -> Self { Error::Trie(err) @@ -60,7 +51,6 @@ impl From> for Error where Error: From { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> { match *self { - Error::Trace(ref err) => write!(f, "{}", err), Error::Trie(ref err) => write!(f, "{}", err), Error::Util(ref err) => write!(f, "{}", err), Error::Database(ref s) => write!(f, "Database error: {}", s), diff --git a/ethcore/src/client/registry.rs b/ethcore/src/client/registry.rs index c8f750576..fb74ec36b 100644 --- a/ethcore/src/client/registry.rs +++ b/ethcore/src/client/registry.rs @@ -5,7 +5,7 @@ use std::string::String; use std::result::Result; use std::fmt; use {util, ethabi}; -use util::{FixedHash, Uint}; +use util::{Uint}; pub struct Registry { contract: ethabi::Contract, @@ -22,7 +22,7 @@ impl Registry { } } fn as_string(e: T) -> String { format!("{:?}", e) } - + /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_data","type":"address"}],"name":"canReverse","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}` #[allow(dead_code)] pub fn can_reverse(&self, _data: &util::Address) -> Result @@ -45,7 +45,7 @@ impl Registry { vec![ethabi::Token::Address(_new.clone().0)] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } @@ -318,7 +318,7 @@ impl Registry { vec![] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index 32706fd76..16f38203f 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -722,6 +722,10 @@ impl BlockChainClient for TestBlockChainClient { fn set_mode(&self, _: Mode) { unimplemented!(); } + fn spec_name(&self) -> String { "foundation".into() } + + fn set_spec_name(&self, _: String) { unimplemented!(); } + fn disable(&self) { unimplemented!(); } fn pruning_info(&self) -> PruningInfo { diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index 4407b232f..a612d8a77 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -242,6 +242,12 @@ pub trait BlockChainClient : Sync + Send { /// Set the mode. fn set_mode(&self, mode: Mode); + /// Get the chain spec name. + fn spec_name(&self) -> String; + + /// Set the chain via a spec name. + fn set_spec_name(&self, spec_name: String); + /// Disable the client from importing blocks. This cannot be undone in this session and indicates /// that a subsystem has reason to believe this executable incapable of syncing the chain. fn disable(&self); diff --git a/ethcore/src/engines/tendermint/params.rs b/ethcore/src/engines/tendermint/params.rs index e38013188..3dbdf4041 100644 --- a/ethcore/src/engines/tendermint/params.rs +++ b/ethcore/src/engines/tendermint/params.rs @@ -17,7 +17,7 @@ //! Tendermint specific parameters. use ethjson; -use util::{U256, Uint, Address, FixedHash}; +use util::{U256, Uint, Address}; use time::Duration; use super::super::transition::Timeouts; use super::Step; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index 91fbf5fab..adfdd1225 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -92,7 +92,7 @@ mod provider { use std::result::Result; use std::fmt; use {util, ethabi}; - use util::{FixedHash, Uint}; + use util::{Uint}; pub struct Contract { contract: ethabi::Contract, @@ -108,7 +108,7 @@ mod provider { } } fn as_string(e: T) -> String { format!("{:?}", e) } - + /// Auto-generated from: `{"constant":false,"inputs":[{"name":"validator","type":"address"}],"name":"reportMalicious","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] pub fn report_malicious(&self, validator: &util::Address) -> Result<(), String> { @@ -117,7 +117,7 @@ mod provider { vec![ethabi::Token::Address(validator.clone().0)] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } @@ -129,7 +129,7 @@ mod provider { vec![ethabi::Token::Address(validator.clone().0)] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } } @@ -159,7 +159,7 @@ mod tests { assert!(vc.contains(&last_hash, &Address::from_str("7d577a597b2742b498cb5cf0c26cdcd726d39e6e").unwrap())); assert!(vc.contains(&last_hash, &Address::from_str("82a978b3f5962a5b0957d9ee9eef472ee55b42f1").unwrap())); } - + #[test] fn reports_validators() { let tap = Arc::new(AccountProvider::transient_provider()); @@ -173,12 +173,12 @@ mod tests { client.miner().set_engine_signer(v1, "".into()).unwrap(); let mut header = Header::default(); - let seal = vec![encode(&5u8).to_vec(), encode(&(&H520::default() as &[u8])).to_vec()]; + let seal = vec![encode(&5u8).to_vec(), encode(&(&H520::default() as &[u8])).to_vec()]; header.set_seal(seal); header.set_author(v1); header.set_number(2); header.set_parent_hash(client.chain_info().best_block_hash); - + // `reportBenign` when the designated proposer releases block from the future (bad clock). assert!(client.engine().verify_block_family(&header, &header, None).is_err()); // Seal a block. diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index d9f1b7413..924f3353c 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -509,7 +509,7 @@ mod tests { use std::sync::Arc; use ethkey::{Generator, Random}; use super::*; - use util::{H256, U256, U512, Address, Uint, FixedHash, FromHex, FromStr}; + use util::{H256, U256, U512, Address, Uint, FromHex, FromStr}; use util::bytes::BytesRef; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index ea0655508..bcfaf8c5d 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -20,7 +20,7 @@ use std::collections::HashMap; use util::Bytes; -use util::{Address, FixedHash, H256}; +use util::{Address, H256}; use util::kvdb::Database; use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress}; use util::sha3::Hashable; diff --git a/ethcore/src/migrations/v10.rs b/ethcore/src/migrations/v10.rs index a15265778..45fc457bd 100644 --- a/ethcore/src/migrations/v10.rs +++ b/ethcore/src/migrations/v10.rs @@ -24,7 +24,7 @@ use views::HeaderView; use bloom_journal::Bloom; use util::migration::{Error, Migration, Progress, Batch, Config}; use util::journaldb; -use util::{H256, FixedHash, Trie}; +use util::{H256, Trie}; use util::{Database, DBTransaction}; /// Account bloom upgrade routine. If bloom already present, does nothing. diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 99c22f88e..d9df86cef 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -90,6 +90,8 @@ pub struct MinerOptions { pub reseal_on_own_tx: bool, /// Minimum period between transaction-inspired reseals. pub reseal_min_period: Duration, + /// Maximum period between blocks (enables force sealing after that). + pub reseal_max_period: Duration, /// Maximum amount of gas to bother considering for block insertion. pub tx_gas_limit: U256, /// Maximum size of the transaction queue. @@ -123,6 +125,7 @@ impl Default for MinerOptions { tx_queue_strategy: PrioritizationStrategy::GasPriceOnly, pending_set: PendingSet::AlwaysQueue, reseal_min_period: Duration::from_secs(2), + reseal_max_period: Duration::from_secs(120), work_queue_size: 20, enable_resubmission: true, tx_queue_banning: Banning::Disabled, @@ -212,6 +215,7 @@ pub struct Miner { transaction_queue: Arc>, sealing_work: Mutex, next_allowed_reseal: Mutex, + next_mandatory_reseal: RwLock, sealing_block_last_request: Mutex, // for sealing... options: MinerOptions, @@ -268,6 +272,7 @@ impl Miner { Miner { transaction_queue: Arc::new(Mutex::new(txq)), next_allowed_reseal: Mutex::new(Instant::now()), + next_mandatory_reseal: RwLock::new(Instant::now() + options.reseal_max_period), sealing_block_last_request: Mutex::new(0), sealing_work: Mutex::new(SealingWork{ queue: UsingQueue::new(options.work_queue_size), @@ -298,7 +303,9 @@ impl Miner { } fn forced_sealing(&self) -> bool { - self.options.force_sealing || !self.options.new_work_notify.is_empty() + self.options.force_sealing + || !self.options.new_work_notify.is_empty() + || Instant::now() > *self.next_mandatory_reseal.read() } /// Clear all pending block states @@ -482,6 +489,7 @@ impl Miner { // Save proposal for later seal submission and broadcast it. Seal::Proposal(seal) => { trace!(target: "miner", "Received a Proposal seal."); + *self.next_mandatory_reseal.write() = Instant::now() + self.options.reseal_max_period; { let mut sealing_work = self.sealing_work.lock(); sealing_work.queue.push(block.clone()); @@ -497,7 +505,8 @@ impl Miner { }) }, // Directly import a regular sealed block. - Seal::Regular(seal) => + Seal::Regular(seal) => { + *self.next_mandatory_reseal.write() = Instant::now() + self.options.reseal_max_period; block .lock() .seal(&*self.engine, seal) @@ -505,7 +514,8 @@ impl Miner { .unwrap_or_else(|e| { warn!("ERROR: seal failed when given internally generated seal: {}", e); false - }), + }) + }, Seal::None => false, } } else { @@ -1290,6 +1300,7 @@ mod tests { reseal_on_external_tx: false, reseal_on_own_tx: true, reseal_min_period: Duration::from_secs(5), + reseal_max_period: Duration::from_secs(120), tx_gas_limit: !U256::zero(), tx_queue_size: 1024, tx_queue_gas_limit: GasLimit::None, diff --git a/ethcore/src/miner/service_transaction_checker.rs b/ethcore/src/miner/service_transaction_checker.rs index 5a7ab04e9..8a97ed9dc 100644 --- a/ethcore/src/miner/service_transaction_checker.rs +++ b/ethcore/src/miner/service_transaction_checker.rs @@ -62,12 +62,12 @@ mod provider { use std::result::Result; use std::fmt; use {util, ethabi}; - use util::{FixedHash, Uint}; + use util::{Uint}; pub struct Contract { contract: ethabi::Contract, address: util::Address, - + } impl Contract { pub fn new(address: util::Address) -> Self @@ -75,11 +75,11 @@ mod provider { Contract { contract: ethabi::Contract::new(ethabi::Interface::load(b"[{\"constant\":false,\"inputs\":[{\"name\":\"_new\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"certify\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"getAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"delegate\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"getUint\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_new\",\"type\":\"address\"}],\"name\":\"setDelegate\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"certified\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"}]").expect("JSON is autogenerated; qed")), address: address, - + } } fn as_string(e: T) -> String { format!("{:?}", e) } - + /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] pub fn set_owner(&self, do_call: &F, _new: &util::Address) -> Result<(), String> @@ -89,7 +89,7 @@ mod provider { vec![ethabi::Token::Address(_new.clone().0)] ).map_err(Self::as_string)?; call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } @@ -102,7 +102,7 @@ mod provider { vec![ethabi::Token::Address(_who.clone().0)] ).map_err(Self::as_string)?; call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } @@ -128,7 +128,7 @@ mod provider { vec![ethabi::Token::Address(_who.clone().0)] ).map_err(Self::as_string)?; call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } @@ -180,7 +180,7 @@ mod provider { vec![ethabi::Token::Address(_new.clone().0)] ).map_err(Self::as_string)?; call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; - + Ok(()) } diff --git a/ethcore/src/miner/stratum.rs b/ethcore/src/miner/stratum.rs index d887f1afa..e67cbb5e1 100644 --- a/ethcore/src/miner/stratum.rs +++ b/ethcore/src/miner/stratum.rs @@ -25,7 +25,7 @@ use std::sync::{Arc, Weak}; use std::net::{SocketAddr, AddrParseError}; use std::fmt; -use util::{H256, U256, FixedHash, H64, clean_0x}; +use util::{H256, U256, H64, clean_0x}; use ethereum::ethash::Ethash; use ethash::SeedHashCompute; use util::Mutex; diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index d686a3ff5..9a3e6af1a 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -485,7 +485,7 @@ pub struct AccountDetails { } /// Transactions with `gas > (gas_limit + gas_limit * Factor(in percents))` are not imported to the queue. -const GAS_LIMIT_HYSTERESIS: usize = 10; // (100/GAS_LIMIT_HYSTERESIS) % +const GAS_LIMIT_HYSTERESIS: usize = 200; // (100/GAS_LIMIT_HYSTERESIS) % /// Describes the strategy used to prioritize transactions in the queue. #[cfg_attr(feature="dev", allow(enum_variant_names))] @@ -1867,7 +1867,7 @@ pub mod test { // then assert_eq!(unwrap_tx_err(res), TransactionError::GasLimitExceeded { - limit: U256::from(55_000), // Should be 110% of set_gas_limit + limit: U256::from(50_250), // Should be 100.5% of set_gas_limit got: gas, }); let stats = txq.status(); diff --git a/ethcore/src/snapshot/account.rs b/ethcore/src/snapshot/account.rs index c417a79a1..44c8093b7 100644 --- a/ethcore/src/snapshot/account.rs +++ b/ethcore/src/snapshot/account.rs @@ -20,7 +20,7 @@ use account_db::{AccountDB, AccountDBMut}; use basic_account::BasicAccount; use snapshot::Error; -use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP}; +use util::{U256, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP}; use util::trie::{TrieDB, Trie}; use rlp::{RlpStream, Stream, UntrustedRlp, View}; @@ -179,7 +179,7 @@ mod tests { use snapshot::tests::helpers::fill_storage; use util::sha3::{SHA3_EMPTY, SHA3_NULL_RLP}; - use util::{Address, FixedHash, H256, HashDB, DBValue}; + use util::{Address, H256, HashDB, DBValue}; use rlp::{UntrustedRlp, View}; use std::collections::HashSet; diff --git a/ethcore/src/snapshot/block.rs b/ethcore/src/snapshot/block.rs index 03feb9455..048724ec9 100644 --- a/ethcore/src/snapshot/block.rs +++ b/ethcore/src/snapshot/block.rs @@ -134,7 +134,7 @@ mod tests { use super::AbridgedBlock; use types::transaction::{Action, Transaction}; - use util::{Address, H256, FixedHash, U256, Bytes}; + use util::{Address, H256, U256, Bytes}; fn encode_block(b: &Block) -> Bytes { b.rlp_bytes(::basic_types::Seal::With) diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 53aa428b6..e8001e54b 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -32,7 +32,7 @@ use views::BlockView; use util::{Bytes, Hashable, HashDB, DBValue, snappy, U256, Uint}; use util::Mutex; -use util::hash::{FixedHash, H256}; +use util::hash::{H256}; use util::journaldb::{self, Algorithm, JournalDB}; use util::kvdb::Database; use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut}; diff --git a/ethcore/src/snapshot/tests/helpers.rs b/ethcore/src/snapshot/tests/helpers.rs index 02ca268ec..ed356346b 100644 --- a/ethcore/src/snapshot/tests/helpers.rs +++ b/ethcore/src/snapshot/tests/helpers.rs @@ -22,7 +22,7 @@ use account_db::AccountDBMut; use rand::Rng; use util::DBValue; -use util::hash::{FixedHash, H256}; +use util::hash::H256; use util::hashdb::HashDB; use util::trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode}; use util::trie::{TrieDB, TrieDBMut, Trie}; diff --git a/ethcore/src/snapshot/tests/state.rs b/ethcore/src/snapshot/tests/state.rs index 90c9e990f..809e9fe21 100644 --- a/ethcore/src/snapshot/tests/state.rs +++ b/ethcore/src/snapshot/tests/state.rs @@ -96,7 +96,7 @@ fn snap_and_restore() { fn get_code_from_prev_chunk() { use std::collections::HashSet; use rlp::{RlpStream, Stream}; - use util::{HashDB, H256, FixedHash, U256, Hashable}; + use util::{HashDB, H256, U256, Hashable}; use account_db::{AccountDBMut, AccountDB}; diff --git a/ethcore/src/spec/genesis.rs b/ethcore/src/spec/genesis.rs index 072fb3f0f..bf5ec46c1 100644 --- a/ethcore/src/spec/genesis.rs +++ b/ethcore/src/spec/genesis.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{Address, H256, Uint, U256, FixedHash}; +use util::{Address, H256, Uint, U256}; use util::sha3::SHA3_NULL_RLP; use ethjson; use super::seal::Seal; diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index 078908db4..3b7f84acf 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -55,6 +55,8 @@ pub struct CommonParams { pub fork_block: Option<(BlockNumber, H256)>, /// Number of first block where EIP-98 rules begin. pub eip98_transition: BlockNumber, + /// Validate block receipts root. + pub validate_receipts: bool, } impl From for CommonParams { @@ -68,6 +70,7 @@ impl From for CommonParams { min_gas_limit: p.min_gas_limit.into(), fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None }, eip98_transition: p.eip98_transition.map_or(0, Into::into), + validate_receipts: p.validate_receipts.unwrap_or(true), } } } diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index 745fb2980..583cab7c5 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -937,7 +937,7 @@ mod tests { use rustc_serialize::hex::FromHex; use super::*; use ethkey::Secret; - use util::{U256, H256, FixedHash, Address, Hashable}; + use util::{U256, H256, Address, Hashable}; use tests::helpers::*; use devtools::*; use env_info::EnvInfo; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index 85d401099..bfd1068ca 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -454,7 +454,7 @@ impl state::Backend for StateDB { #[cfg(test)] mod tests { - use util::{U256, H256, FixedHash, Address, DBTransaction}; + use util::{U256, H256, Address, DBTransaction}; use tests::helpers::*; use state::{Account, Backend}; use util::log::init_log; diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index c63890ae9..2d13e3260 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -19,7 +19,6 @@ mod bloom; mod config; mod db; -mod error; mod executive_tracer; mod import; mod noop_tracer; @@ -28,7 +27,6 @@ pub use types::trace_types::{filter, flat, localized, trace}; pub use types::trace_types::error::Error as TraceError; pub use self::config::Config; pub use self::db::TraceDB; -pub use self::error::Error; pub use types::trace_types::trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff}; pub use types::trace_types::flat::{FlatTrace, FlatTransactionTraces, FlatBlockTraces}; pub use self::noop_tracer::{NoopTracer, NoopVMTracer}; diff --git a/ethcore/src/types/filter.rs b/ethcore/src/types/filter.rs index 5749c3415..1b6043129 100644 --- a/ethcore/src/types/filter.rs +++ b/ethcore/src/types/filter.rs @@ -113,7 +113,6 @@ impl Filter { #[cfg(test)] mod tests { - use util::FixedHash; use filter::Filter; use client::BlockId; use log_entry::LogEntry; diff --git a/ethcore/src/verification/canon_verifier.rs b/ethcore/src/verification/canon_verifier.rs index 849f7caad..67d7e0e85 100644 --- a/ethcore/src/verification/canon_verifier.rs +++ b/ethcore/src/verification/canon_verifier.rs @@ -31,7 +31,7 @@ impl Verifier for CanonVerifier { verification::verify_block_family(header, bytes, engine, bc) } - fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error> { - verification::verify_block_final(expected, got) + fn verify_block_final(&self, expected: &Header, got: &Header, receipts: bool) -> Result<(), Error> { + verification::verify_block_final(expected, got, receipts) } } diff --git a/ethcore/src/verification/noop_verifier.rs b/ethcore/src/verification/noop_verifier.rs index 2fcd877f5..b60dbed2e 100644 --- a/ethcore/src/verification/noop_verifier.rs +++ b/ethcore/src/verification/noop_verifier.rs @@ -31,7 +31,7 @@ impl Verifier for NoopVerifier { Ok(()) } - fn verify_block_final(&self, _expected: &Header, _got: &Header) -> Result<(), Error> { + fn verify_block_final(&self, _expected: &Header, _got: &Header, _receipts: bool) -> Result<(), Error> { Ok(()) } } diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index 34a4ccbd0..c2c932066 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -178,7 +178,7 @@ pub fn verify_block_family(header: &Header, bytes: &[u8], engine: &Engine, bc: & } /// Phase 4 verification. Check block information against transaction enactment results, -pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error> { +pub fn verify_block_final(expected: &Header, got: &Header, check_receipts: bool) -> Result<(), Error> { if expected.gas_used() != got.gas_used() { return Err(From::from(BlockError::InvalidGasUsed(Mismatch { expected: expected.gas_used().clone(), found: got.gas_used().clone() }))) } @@ -188,7 +188,7 @@ pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error> if expected.state_root() != got.state_root() { return Err(From::from(BlockError::InvalidStateRoot(Mismatch { expected: expected.state_root().clone(), found: got.state_root().clone() }))) } - if expected.receipts_root() != got.receipts_root() { + if check_receipts && expected.receipts_root() != got.receipts_root() { return Err(From::from(BlockError::InvalidReceiptsRoot(Mismatch { expected: expected.receipts_root().clone(), found: got.receipts_root().clone() }))) } Ok(()) diff --git a/ethcore/src/verification/verifier.rs b/ethcore/src/verification/verifier.rs index e5dabd392..9f0173003 100644 --- a/ethcore/src/verification/verifier.rs +++ b/ethcore/src/verification/verifier.rs @@ -26,5 +26,5 @@ pub trait Verifier: Send + Sync { /// Verify a block relative to its parent and uncles. fn verify_block_family(&self, header: &Header, bytes: &[u8], engine: &Engine, bc: &BlockProvider) -> Result<(), Error>; /// Do a final verification check for an enacted header vs its expected counterpart. - fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error>; + fn verify_block_final(&self, expected: &Header, got: &Header, receipts: bool) -> Result<(), Error>; } diff --git a/ethcrypto/src/lib.rs b/ethcrypto/src/lib.rs index 07c821752..a4d426b54 100644 --- a/ethcrypto/src/lib.rs +++ b/ethcrypto/src/lib.rs @@ -195,7 +195,7 @@ pub mod ecies { use rcrypto::sha2::Sha256; use rcrypto::hmac::Hmac; use rcrypto::mac::Mac; - use bigint::hash::{FixedHash, H128}; + use bigint::hash::H128; use ethkey::{Random, Generator, Public, Secret}; use {Error, ecdh, aes, Keccak256}; diff --git a/ethkey/src/error.rs b/ethkey/src/error.rs index bc5dd9fa4..0ac2d221a 100644 --- a/ethkey/src/error.rs +++ b/ethkey/src/error.rs @@ -51,6 +51,12 @@ impl fmt::Display for Error { } } +impl Into for Error { + fn into(self) -> String { + format!("{}", self) + } +} + impl From<::secp256k1::Error> for Error { fn from(e: ::secp256k1::Error) -> Error { match e { diff --git a/ethkey/src/extended.rs b/ethkey/src/extended.rs index c8f057a4b..490014db9 100644 --- a/ethkey/src/extended.rs +++ b/ethkey/src/extended.rs @@ -18,7 +18,7 @@ use secret::Secret; use Public; -use bigint::hash::{H256, FixedHash}; +use bigint::hash::H256; pub use self::derivation::Error as DerivationError; /// Represents label that can be stored as a part of key derivation @@ -212,7 +212,7 @@ mod derivation { use rcrypto::hmac::Hmac; use rcrypto::mac::Mac; use rcrypto::sha2::Sha512; - use bigint::hash::{H512, H256, FixedHash}; + use bigint::hash::{H512, H256}; use bigint::prelude::{U256, U512, Uint}; use secp256k1; use secp256k1::key::{SecretKey, PublicKey}; diff --git a/ethkey/src/math.rs b/ethkey/src/math.rs index 45e5d04e6..536f4ee7d 100644 --- a/ethkey/src/math.rs +++ b/ethkey/src/math.rs @@ -36,6 +36,17 @@ pub fn public_add(public: &mut Public, other: &Public) -> Result<(), Error> { Ok(()) } +/// Inplace sub one public key from another (EC point - EC point) +pub fn public_sub(public: &mut Public, other: &Public) -> Result<(), Error> { + let mut key_neg_other = to_secp256k1_public(other)?; + key_neg_other.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?; + + let mut key_public = to_secp256k1_public(public)?; + key_public.add_assign(&SECP256K1, &key_neg_other)?; + set_public(public, &key_public); + Ok(()) +} + /// Return base point of secp256k1 pub fn generation_point() -> Public { let mut public_sec_raw = [0u8; 65]; @@ -64,3 +75,35 @@ fn set_public(public: &mut Public, key_public: &key::PublicKey) { let key_public_serialized = key_public.serialize_vec(&SECP256K1, false); public.copy_from_slice(&key_public_serialized[1..65]); } + +#[cfg(test)] +mod tests { + use super::super::{Random, Generator}; + use super::{public_add, public_sub}; + + #[test] + fn public_addition_is_commutative() { + let public1 = Random.generate().unwrap().public().clone(); + let public2 = Random.generate().unwrap().public().clone(); + + let mut left = public1.clone(); + public_add(&mut left, &public2).unwrap(); + + let mut right = public2.clone(); + public_add(&mut right, &public1).unwrap(); + + assert_eq!(left, right); + } + + #[test] + fn public_addition_is_reversible_with_subtraction() { + let public1 = Random.generate().unwrap().public().clone(); + let public2 = Random.generate().unwrap().public().clone(); + + let mut sum = public1.clone(); + public_add(&mut sum, &public2).unwrap(); + public_sub(&mut sum, &public2).unwrap(); + + assert_eq!(sum, public1); + } +} diff --git a/ethkey/src/secret.rs b/ethkey/src/secret.rs index d8696ef73..9c9fd05ad 100644 --- a/ethkey/src/secret.rs +++ b/ethkey/src/secret.rs @@ -130,3 +130,54 @@ impl Deref for Secret { &self.inner } } + +#[cfg(test)] +mod tests { + use std::str::FromStr; + use super::super::{Random, Generator}; + use super::Secret; + + #[test] + fn multiplicating_secret_inversion_with_secret_gives_one() { + let secret = Random.generate().unwrap().secret().clone(); + let mut inversion = secret.clone(); + inversion.inv().unwrap(); + inversion.mul(&secret).unwrap(); + assert_eq!(inversion, Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap()); + } + + #[test] + fn secret_inversion_is_reversible_with_inversion() { + let secret = Random.generate().unwrap().secret().clone(); + let mut inversion = secret.clone(); + inversion.inv().unwrap(); + inversion.inv().unwrap(); + assert_eq!(inversion, secret); + } + + #[test] + fn secret_pow() { + let secret = Random.generate().unwrap().secret().clone(); + + let mut pow0 = secret.clone(); + pow0.pow(0).unwrap(); + assert_eq!(pow0, Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap()); + + let mut pow1 = secret.clone(); + pow1.pow(1).unwrap(); + assert_eq!(pow1, secret); + + let mut pow2 = secret.clone(); + pow2.pow(2).unwrap(); + let mut pow2_expected = secret.clone(); + pow2_expected.mul(&secret).unwrap(); + assert_eq!(pow2, pow2_expected); + + let mut pow3 = secret.clone(); + pow3.pow(3).unwrap(); + let mut pow3_expected = secret.clone(); + pow3_expected.mul(&secret).unwrap(); + pow3_expected.mul(&secret).unwrap(); + assert_eq!(pow3, pow3_expected); + } +} diff --git a/ethkey/src/signature.rs b/ethkey/src/signature.rs index 63f6854e2..347222287 100644 --- a/ethkey/src/signature.rs +++ b/ethkey/src/signature.rs @@ -22,7 +22,7 @@ use std::hash::{Hash, Hasher}; use secp256k1::{Message as SecpMessage, RecoverableSignature, RecoveryId, Error as SecpError}; use secp256k1::key::{SecretKey, PublicKey}; use rustc_serialize::hex::{ToHex, FromHex}; -use bigint::hash::{H520, H256, FixedHash}; +use bigint::hash::{H520, H256}; use {Secret, Public, SECP256K1, Error, Message, public_to_address, Address}; #[repr(C)] diff --git a/ethstore/src/dir/memory.rs b/ethstore/src/dir/memory.rs index 87d12794e..955afc5b0 100644 --- a/ethstore/src/dir/memory.rs +++ b/ethstore/src/dir/memory.rs @@ -67,7 +67,7 @@ impl KeyDirectory for MemoryDirectory { fn unique_repr(&self) -> Result { let mut val = 0u64; let accounts = self.accounts.read(); - for acc in accounts.keys() { val = val ^ ::util::FixedHash::low_u64(acc) } + for acc in accounts.keys() { val = val ^ acc.low_u64() } Ok(val) } } diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 98193a5c3..7f671d384 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -5,11 +5,11 @@ version = "0.1.0" authors = ["Parity Technologies "] [lib] -name = "evm" +name = "evmbin" path = "./src/main.rs" [[bin]] -name = "evm" +name = "parity-evm" path = "./src/main.rs" [dependencies] diff --git a/evmbin/src/ext.rs b/evmbin/src/ext.rs index bcce9adc1..a293ccc80 100644 --- a/evmbin/src/ext.rs +++ b/evmbin/src/ext.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use std::collections::HashMap; -use util::{U256, H256, Address, Bytes, FixedHash, trie}; +use util::{U256, H256, Address, Bytes, trie}; use ethcore::client::EnvInfo; use ethcore::evm::{self, Ext, ContractCreateResult, MessageCallResult, Schedule, CallType}; diff --git a/hw/src/ledger.rs b/hw/src/ledger.rs index 255fa8515..fca1d0c3a 100644 --- a/hw/src/ledger.rs +++ b/hw/src/ledger.rs @@ -24,7 +24,7 @@ use std::str::FromStr; use std::time::Duration; use super::WalletInfo; use ethkey::{Address, Signature}; -use ethcore_bigint::hash::{H256, FixedHash}; +use ethcore_bigint::hash::H256; const LEDGER_VID: u16 = 0x2c97; const LEDGER_PIDS: [u16; 2] = [0x0000, 0x0001]; // Nano S and Blue @@ -260,12 +260,12 @@ impl Manager { { let mut chunk = &mut hid_chunk[HID_PREFIX_ZERO..]; &mut chunk[0..5].copy_from_slice(&[0x01, 0x01, APDU_TAG, (chunk_index >> 8) as u8, (chunk_index & 0xff) as u8 ]); - + if chunk_index == 0 { let data_len = data.len() + 5; &mut chunk[5..12].copy_from_slice(&[ (data_len >> 8) as u8, (data_len & 0xff) as u8, APDU_CLA, command, p1, p2, data.len() as u8 ]); } - + &mut chunk[chunk_size..chunk_size + size].copy_from_slice(&data[offset..offset + size]); offset += size; chunk_size += size; diff --git a/ipc-common-types/src/types/version_info.rs b/ipc-common-types/src/types/version_info.rs index e36e40aef..1f0e58452 100644 --- a/ipc-common-types/src/types/version_info.rs +++ b/ipc-common-types/src/types/version_info.rs @@ -19,7 +19,7 @@ use std::fmt; use std::str::FromStr; use semver::{Version}; -use util::{H160, FixedHash}; +use util::H160; use util::misc::raw_package_info; use release_track::ReleaseTrack; diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index b7b84b66b..6ce5518c3 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Parity Technologies "] [dependencies] ethcore = { path = "../ethcore" } ethcore-util = { path = "../util" } -jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" } +jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" } rlp = { path = "../util/rlp" } mime = "0.2" hyper = { default-features = false, git = "https://github.com/ethcore/hyper" } diff --git a/js/assets/images/dapps/close.svg b/js/assets/images/dapps/close.svg new file mode 100644 index 000000000..d46acd872 --- /dev/null +++ b/js/assets/images/dapps/close.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/js/assets/images/dapps/plus.svg b/js/assets/images/dapps/plus.svg new file mode 100644 index 000000000..0fce86130 --- /dev/null +++ b/js/assets/images/dapps/plus.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/js/package.json b/js/package.json index 85d906b88..61cdce158 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "parity.js", - "version": "1.7.3", + "version": "1.7.18", "main": "release/index.js", "jsnext:main": "src/index.js", "author": "Parity Team ", @@ -201,6 +201,7 @@ "scryptsy": "2.0.0", "solc": "ngotchac/solc-js", "store": "1.3.20", + "sw-toolbox": "^3.6.0", "u2f-api": "0.0.9", "u2f-api-polyfill": "0.4.3", "uglify-js": "2.8.2", @@ -210,6 +211,7 @@ "validator": "6.2.0", "web3": "0.17.0-beta", "whatwg-fetch": "2.0.1", + "worker-loader": "^0.8.0", "zxcvbn": "4.4.1" } } diff --git a/js/scripts/release.sh b/js/scripts/release.sh index 80c0fc819..be19e217e 100755 --- a/js/scripts/release.sh +++ b/js/scripts/release.sh @@ -89,11 +89,13 @@ fi echo "*** Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH" git submodule update +sed -i "/^parity-ui-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml cargo update -p parity-ui-precompiled # --precise "$PRECOMPILED_HASH" echo "*** Committing updated files" git add js +git add dapps/ui/Cargo.toml git add Cargo.lock git commit -m "[ci skip] js-precompiled $UTCDATE" git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG diff --git a/js/scripts/test.js b/js/scripts/test.js index f7bfd140f..cadf88a52 100644 --- a/js/scripts/test.js +++ b/js/scripts/test.js @@ -1 +1,2 @@ -// test script 7 +// test script 8 +// trigger rebuild on master 15 Mar 2017, 11:19 diff --git a/js/src/api/contract/contract.js b/js/src/api/contract/contract.js index dd36afead..2156b8af1 100644 --- a/js/src/api/contract/contract.js +++ b/js/src/api/contract/contract.js @@ -107,13 +107,25 @@ export default class Contract { }); } - deploy (options, values, statecb = () => {}) { - statecb(null, { state: 'estimateGas' }); + deploy (options, values, statecb = () => {}, skipGasEstimate = false) { + let gasEstPromise; - return this - .deployEstimateGas(options, values) - .then(([gasEst, gas]) => { - options.gas = gas.toFixed(0); + if (skipGasEstimate) { + gasEstPromise = Promise.resolve(null); + } else { + statecb(null, { state: 'estimateGas' }); + + gasEstPromise = this.deployEstimateGas(options, values) + .then(([gasEst, gas]) => gas); + } + + return gasEstPromise + .then((_gas) => { + if (_gas) { + options.gas = _gas.toFixed(0); + } + + const gas = _gas || options.gas; statecb(null, { state: 'postTransaction', gas }); diff --git a/js/src/api/format/input.js b/js/src/api/format/input.js index 74ddd4e56..34871c911 100644 --- a/js/src/api/format/input.js +++ b/js/src/api/format/input.js @@ -143,8 +143,15 @@ export function inOptions (options) { if (options) { Object.keys(options).forEach((key) => { switch (key) { - case 'from': case 'to': + // Don't encode the `to` option if it's empty + // (eg. contract deployments) + if (options[key]) { + options[key] = inAddress(options[key]); + } + break; + + case 'from': options[key] = inAddress(options[key]); break; diff --git a/js/src/api/format/input.spec.js b/js/src/api/format/input.spec.js index 450ff61cc..4b82bd1ef 100644 --- a/js/src/api/format/input.spec.js +++ b/js/src/api/format/input.spec.js @@ -208,6 +208,13 @@ describe('api/format/input', () => { }); }); + it('does not encode an empty `to` value', () => { + const options = { to: '' }; + const formatted = inOptions(options); + + expect(formatted.to).to.equal(''); + }); + ['gas', 'gasPrice', 'value', 'minBlock', 'nonce'].forEach((input) => { it(`formats ${input} number as hexnumber`, () => { const block = {}; diff --git a/js/src/api/rpc/parity/parity.js b/js/src/api/rpc/parity/parity.js index 31de948dc..dba6e5d30 100644 --- a/js/src/api/rpc/parity/parity.js +++ b/js/src/api/rpc/parity/parity.js @@ -284,9 +284,15 @@ export default class Parity { .execute('parity_mode'); } + // DEPRECATED - use chain instead. netChain () { return this._transport - .execute('parity_netChain'); + .execute('parity_chain'); + } + + chain () { + return this._transport + .execute('parity_chain'); } netPeers () { @@ -454,6 +460,11 @@ export default class Parity { .execute('parity_setMode', mode); } + setChain (specName) { + return this._transport + .execute('parity_setChain', specName); + } + setNewDappsAddresses (addresses) { return this._transport .execute('parity_setNewDappsAddresses', addresses ? inAddresses(addresses) : null); diff --git a/js/src/contracts/code/wallet.js b/js/src/contracts/code/wallet.js index 7b172c3f1..065a853a1 100644 --- a/js/src/contracts/code/wallet.js +++ b/js/src/contracts/code/wallet.js @@ -19,6 +19,8 @@ * @from https://github.com/ethcore/parity/blob/63137b15482344ff9df634c086abaabed452eadc/js/src/contracts/snippets/enhanced-wallet.sol * @date 07-Mar-2017 @ 16h00 UTC */ +export const walletCompiler = 'v0.4.9+commit.364da425'; +export const walletSource = 'https://github.com/ethcore/parity/blob/63137b15482344ff9df634c086abaabed452eadc/js/src/contracts/snippets/enhanced-wallet.sol'; export const wallet = '0x6060604052341561000c57fe5b60405161048538038061048583398101604090815281516020830151918301519201915b604080517f696e697457616c6c657428616464726573735b5d2c75696e743235362c75696e81527f7432353629000000000000000000000000000000000000000000000000000000602080830191909152915190819003602501902084516000829052909173_____________WalletLibrary______________91600281019160049182010290819038829003903960006000600483016000866127105a03f45b505050505050505b61039d806100e86000396000f300606060405236156100725763ffffffff60e060020a6000350416632f54bf6e811461012d5780634123cb6b1461015d578063523750931461017f578063659010e7146101a1578063746c9171146101c3578063c2cf7326146101e5578063c41a360a14610218578063f1736d8614610247575b61012b5b60003411156100c75760408051600160a060020a033316815234602082015281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a1610127565b60003611156101275773_____________WalletLibrary______________600160a060020a0316600036600060405160200152604051808383808284378201915050925050506020604051808303818560325a03f4151561012457fe5b50505b5b5b565b005b341561013557fe5b610149600160a060020a0360043516610269565b604080519115158252519081900360200190f35b341561016557fe5b61016d6102cd565b60408051918252519081900360200190f35b341561018757fe5b61016d6102d3565b60408051918252519081900360200190f35b34156101a957fe5b61016d6102d9565b60408051918252519081900360200190f35b34156101cb57fe5b61016d6102df565b60408051918252519081900360200190f35b34156101ed57fe5b610149600435600160a060020a03602435166102e5565b604080519115158252519081900360200190f35b341561022057fe5b61022b60043561034a565b60408051600160a060020a039092168252519081900360200190f35b341561024f57fe5b61016d61036b565b60408051918252519081900360200190f35b600073_____________WalletLibrary______________600160a060020a0316600036600060405160200152604051808383808284378201915050925050506020604051808303818560325a03f415156102bf57fe5b50506040515190505b919050565b60015481565b60045481565b60035481565b60005481565b600073_____________WalletLibrary______________600160a060020a0316600036600060405160200152604051808383808284378201915050925050506020604051808303818560325a03f4151561033b57fe5b50506040515190505b92915050565b6000600560018301610100811061035d57fe5b0160005b505490505b919050565b600254815600a165627a7a723058204a75c2f5c8009054bd9e9998e8bb6f4bca0b201484709f357b482793957c47130029'; export const walletLibrary = '0x6060604052341561000c57fe5b5b6116d88061001c6000396000f300606060405236156101015763ffffffff60e060020a600035041663173825d981146101575780632f54bf6e146101755780634123cb6b146101a557806352375093146101c75780635c52c2f5146101e9578063659010e7146101fb5780637065cb481461021d578063746c91711461023b578063797af6271461025d5780639da5e0eb14610284578063b20d30a914610299578063b61d27f6146102ae578063b75c7dc6146102ec578063ba51a6df14610301578063c2cf732614610316578063c41a360a14610349578063c57c5f6014610378578063cbf0b0c0146103cf578063e46dcfeb146103ed578063f00d4b5d14610449578063f1736d861461046d575b6101555b60003411156101525760408051600160a060020a033316815234602082015281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a15b5b565b005b341561015f57fe5b610155600160a060020a036004351661048f565b005b341561017d57fe5b610191600160a060020a036004351661057d565b604080519115158252519081900360200190f35b34156101ad57fe5b6101b561059e565b60408051918252519081900360200190f35b34156101cf57fe5b6101b56105a4565b60408051918252519081900360200190f35b34156101f157fe5b6101556105aa565b005b341561020357fe5b6101b56105e1565b60408051918252519081900360200190f35b341561022557fe5b610155600160a060020a03600435166105e7565b005b341561024357fe5b6101b56106d7565b60408051918252519081900360200190f35b341561026557fe5b6101916004356106dd565b604080519115158252519081900360200190f35b341561028c57fe5b610155600435610a2f565b005b34156102a157fe5b610155600435610a43565b005b34156102b657fe5b6101b560048035600160a060020a0316906024803591604435918201910135610a7b565b60408051918252519081900360200190f35b34156102f457fe5b610155600435610d5d565b005b341561030957fe5b610155600435610e08565b005b341561031e57fe5b610191600435600160a060020a0360243516610e8a565b604080519115158252519081900360200190f35b341561035157fe5b61035c600435610edf565b60408051600160a060020a039092168252519081900360200190f35b341561038057fe5b6101556004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496505093359350610f0092505050565b005b34156103d757fe5b610155600160a060020a0360043516610fd4565b005b34156103f557fe5b6101556004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496505084359460200135935061101292505050565b005b341561045157fe5b610155600160a060020a036004358116906024351661102b565b005b341561047557fe5b6101b5611125565b60408051918252519081900360200190f35b60006000366040518083838082843782019150509250505060405180910390206104b88161112b565b1561057657600160a060020a0383166000908152610105602052604090205491508115156104e557610576565b60016001540360005411156104f957610576565b6000600583610100811061050957fe5b0160005b5055600160a060020a03831660009081526101056020526040812055610531611296565b610539611386565b60408051600160a060020a038516815290517f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da9181900360200190a15b5b5b505050565b600160a060020a03811660009081526101056020526040812054115b919050565b60015481565b60045481565b6000366040518083838082843782019150509250505060405180910390206105d18161112b565b156105dc5760006003555b5b5b50565b60035481565b60003660405180838380828437820191505092505050604051809103902061060e8161112b565b156106d15761061c8261057d565b15610626576106d1565b61062e611296565b60015460fa901061064157610641611386565b5b60015460fa9010610652576106d1565b60018054810190819055600160a060020a03831690600590610100811061067557fe5b0160005b5055600154600160a060020a03831660008181526101056020908152604091829020939093558051918252517f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c3929181900390910190a15b5b5b5050565b60005481565b60006000826106eb8161112b565b15610a255760008481526101086020526040902054600160a060020a031615158061072757506000848152610108602052604090206001015415155b80610754575060008481526101086020526040902060029081015461010060018216150260001901160415155b15610a255760008481526101086020526040902054600160a060020a0316151561082c57600084815261010860209081526040918290206001808201546002928301805486516000199482161561010002949094011693909304601f810185900485028301850190955284825261082594909391929183018282801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b50505050506114c2565b91506108e3565b60008481526101086020526040908190208054600180830154935160029384018054600160a060020a0390941695949093919283928592918116156101000260001901160480156108be5780601f10610893576101008083540402835291602001916108be565b820191906000526020600020905b8154815290600101906020018083116108a157829003601f168201915b505091505060006040518083038185876185025a03f19250505015156108e357610000565b5b6000848152610108602090815260409182902060018082015482548551600160a060020a033381811683529682018c90529681018390529086166060820181905295881660a082015260c06080820181815260029586018054958616156101000260001901909516959095049082018190527fe3a3a4111a84df27d76b68dc721e65c7711605ea5eee4afd3a9c58195217365c968b959394909390928a9290919060e0830190859080156109d95780601f106109ae576101008083540402835291602001916109d9565b820191906000526020600020905b8154815290600101906020018083116109bc57829003601f168201915b505097505050505050505060405180910390a16000848152610108602052604081208054600160a060020a03191681556001810182905590610a1e6002830182611557565b5050600192505b5b5b5b5050919050565b6002819055610a3c6114dc565b6004555b50565b600036604051808383808284378201915050925050506040518091039020610a6a8161112b565b156106d15760028290555b5b5b5050565b60006000610a883361057d565b15610d505782158015610a9f5750610a9f856114eb565b5b80610aad57506000546001145b15610bef57600160a060020a0386161515610b0357610afc8585858080601f016020809104026020016040519081016040528093929190818152602001838380828437506114c2945050505050565b9050610b43565b85600160a060020a03168585856040518083838082843782019150509250505060006040518083038185876185025a03f1925050501515610b4357610000565b5b7f9738cd1a8777c86b011f7b01d87d484217dc6ab5154a9d41eda5d14af8caf2923386888787866040518087600160a060020a0316600160a060020a0316815260200186815260200185600160a060020a0316600160a060020a031681526020018060200183600160a060020a0316600160a060020a0316815260200182810382528585828181526020019250808284376040519201829003995090975050505050505050a1610d50565b600036436040518084848082843791909101928352505060408051602092819003830190206000818152610108909352912054909450600160a060020a0316159150508015610c4e575060008281526101086020526040902060010154155b8015610c7b5750600082815261010860205260409020600290810154610100600182161502600019011604155b15610cbf576000828152610108602052604090208054600160a060020a031916600160a060020a03881617815560018101869055610cbd90600201858561159f565b505b610cc8826106dd565b1515610d505760408051838152600160a060020a033381811660208401529282018890528816606082015260a0608082018181529082018690527f1733cbb53659d713b79580f79f3f9ff215f78a7c7aa45890f3b89fc5cddfbf32928592909189918b918a918a9160c082018484808284376040519201829003995090975050505050505050a15b5b5b5b5b50949350505050565b600160a060020a033316600090815261010560205260408120549080821515610d8557610e01565b50506000828152610106602052604081206001810154600284900a929083161115610e015780546001908101825581018054839003905560408051600160a060020a03331681526020810186905281517fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b929181900390910190a15b5b50505050565b600036604051808383808284378201915050925050506040518091039020610e2f8161112b565b156106d157600154821115610e43576106d1565b6000829055610e50611296565b6040805183815290517facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da9181900360200190a15b5b5b5050565b600082815261010660209081526040808320600160a060020a038516845261010590925282205482811515610ec25760009350610ed6565b8160020a9050808360010154166000141593505b50505092915050565b60006005600183016101008110610ef257fe5b0160005b505490505b919050565b815160019081018155600090600160a060020a033316906005905b0160005b505550600160a060020a033316600090815261010560205260408120600190555b8251811015610fc9578281815181101515610f5757fe5b60209081029091010151600160a060020a03166005600283016101008110610f7b57fe5b0160005b50819055508060020161010560008584815181101515610f9b57fe5b90602001906020020151600160a060020a03168152602001908152602001600020819055505b600101610f40565b60008290555b505050565b600036604051808383808284378201915050925050506040518091039020610ffb8161112b565b156106d15781600160a060020a0316ff5b5b5b5050565b61101b81610a2f565b6105768383610f00565b5b505050565b60006000366040518083838082843782019150509250505060405180910390206110548161112b565b15610e01576110628361057d565b1561106c57610e01565b600160a060020a03841660009081526101056020526040902054915081151561109457610e01565b61109c611296565b600160a060020a03831660058361010081106110b457fe5b0160005b5055600160a060020a0380851660008181526101056020908152604080832083905593871680835291849020869055835192835282015281517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c929181900390910190a15b5b5b50505050565b60025481565b600160a060020a0333166000908152610105602052604081205481808215156111535761128c565b600085815261010660205260409020805490925015156111b65760008054835560018084019190915561010780549161118e9190830161161e565b60028301819055610107805487929081106111a557fe5b906000526020600020900160005b50555b8260020a9050808260010154166000141561128c5760408051600160a060020a03331681526020810187905281517fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda929181900390910190a181546001901161127957600085815261010660205260409020600201546101078054909190811061123c57fe5b906000526020600020900160005b50600090819055858152610106602052604081208181556001808201839055600290910191909155935061128c565b8154600019018255600182018054821790555b5b5b505050919050565b6101075460005b81811015611374576101086000610107838154811015156112ba57fe5b906000526020600020900160005b50548152602081019190915260400160009081208054600160a060020a031916815560018101829055906112ff6002830182611557565b505061010780548290811061131057fe5b906000526020600020900160005b50541561136b5761010660006101078381548110151561133a57fe5b906000526020600020900160005b505481526020810191909152604001600090812081815560018101829055600201555b5b60010161129d565b6106d16101076000611648565b5b5050565b60015b6001548110156105dc575b600154811080156113b7575060058161010081106113ae57fe5b0160005b505415155b156113c457600101611394565b5b60016001541180156113eb575060015460059061010081106113e357fe5b0160005b5054155b156113ff57600180546000190190556113c4565b600154811080156114255750600154600590610100811061141c57fe5b0160005b505415155b80156114425750600581610100811061143a57fe5b0160005b5054155b156114b957600154600590610100811061145857fe5b0160005b5054600582610100811061146c57fe5b0160005b5055806101056000600583610100811061148657fe5b0160005b505481526020019081526020016000208190555060006005600154610100811015156114b257fe5b0160005b50555b611389565b5b50565b600081516020830184f09050803b15610000575b92915050565b600062015180425b0490505b90565b60006114f63361057d565b15610599576004546115066114dc565b111561151d5760006003556115196114dc565b6004555b600354828101108015906115375750600254826003540111155b1561154c575060038054820190556001610599565b5060005b5b5b919050565b50805460018160011615610100020316600290046000825580601f1061157d57506105dc565b601f0160209004906000526020600020908101906105dc919061166a565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115e05782800160ff1982351617855561160d565b8280016001018555821561160d579182015b8281111561160d5782358255916020019190600101906115f2565b5b5061161a92915061166a565b5090565b8154818355818115116105765760008381526020902061057691810190830161166a565b5b505050565b50805460008255906000526020600020908101906105dc919061166a565b5b50565b6114e891905b8082111561161a5760008155600101611670565b5090565b90565b6114e891905b8082111561161a5760008155600101611670565b5090565b905600a165627a7a723058206560ca68304798da7e3be68397368a30b63db1453ff138ff8f765e80080025af0029'; export const walletLibraryABI = '[{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"removeOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"m_numOwners","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"m_lastDay","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"resetSpentToday","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"m_spentToday","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"addOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"m_required","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_h","type":"bytes32"}],"name":"confirm","outputs":[{"name":"o_success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_limit","type":"uint256"}],"name":"initDaylimit","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newLimit","type":"uint256"}],"name":"setDailyLimit","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"execute","outputs":[{"name":"o_hash","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_operation","type":"bytes32"}],"name":"revoke","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newRequired","type":"uint256"}],"name":"changeRequirement","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_operation","type":"bytes32"},{"name":"_owner","type":"address"}],"name":"hasConfirmed","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"ownerIndex","type":"uint256"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owners","type":"address[]"},{"name":"_required","type":"uint256"}],"name":"initMultiowned","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"kill","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owners","type":"address[]"},{"name":"_required","type":"uint256"},{"name":"_daylimit","type":"uint256"}],"name":"initWallet","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"}],"name":"changeOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"m_dailyLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"operation","type":"bytes32"}],"name":"Confirmation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"operation","type":"bytes32"}],"name":"Revoke","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldOwner","type":"address"},{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldOwner","type":"address"}],"name":"OwnerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newRequirement","type":"uint256"}],"name":"RequirementChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"data","type":"bytes"},{"indexed":false,"name":"created","type":"address"}],"name":"SingleTransact","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"operation","type":"bytes32"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"data","type":"bytes"},{"indexed":false,"name":"created","type":"address"}],"name":"MultiTransact","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"operation","type":"bytes32"},{"indexed":false,"name":"initiator","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"data","type":"bytes"}],"name":"ConfirmationNeeded","type":"event"}]'; diff --git a/js/src/contracts/registry.js b/js/src/contracts/registry.js index 80f54ea03..cef31785e 100644 --- a/js/src/contracts/registry.js +++ b/js/src/contracts/registry.js @@ -16,7 +16,14 @@ import * as abis from './abi'; +const REGISTRY_V1_HASHES = [ + '0x34f7c51bbb1b1902fbdabfdf04811100f5c9f998f26dd535d2f6f977492c748e', // ropsten + '0x64c3ee34851517a9faecd995c102b339f03e564ad6772dc43a26f993238b20ec' // homestead +]; + export default class Registry { + _registryContract = null; + constructor (api) { this._api = api; @@ -43,11 +50,10 @@ export default class Registry { this._fetching = true; - return this._api.parity - .registryAddress() - .then((address) => { + return this.fetchContract() + .then((contract) => { this._fetching = false; - this._instance = this._api.newContract(abis.registry, address).instance; + this._instance = contract.instance; this._queue.forEach((queued) => { queued.resolve(this._instance); @@ -89,6 +95,47 @@ export default class Registry { .then((contract) => contract.instance); } + fetchContract () { + if (this._registryContract) { + return Promise.resolve(this._registryContract); + } + + return this._api.parity + .registryAddress() + .then((address) => Promise.all([ address, this._api.eth.getCode(address) ])) + .then(([ address, code ]) => { + const codeHash = this._api.util.sha3(code); + const version = REGISTRY_V1_HASHES.includes(codeHash) + ? 1 + : 2; + const abi = version === 1 + ? abis.registry + : abis.registry2; + const contract = this._api.newContract(abi, address); + + // Add support for previous `set` and `get` methods + if (!contract.instance.get && contract.instance.getData) { + contract.instance.get = contract.instance.getData; + } + + if (contract.instance.get && !contract.instance.getData) { + contract.instance.getData = contract.instance.get; + } + + if (!contract.instance.set && contract.instance.setData) { + contract.instance.set = contract.instance.setData; + } + + if (contract.instance.set && !contract.instance.setData) { + contract.instance.setData = contract.instance.set; + } + + console.log(`registry at ${address}, code ${codeHash}, version ${version}`); + this._registryContract = contract; + return this._registryContract; + }); + } + _createGetParams (_name, key) { const name = _name.toLowerCase(); const sha3 = this._api.util.sha3.text(name); diff --git a/js/src/contracts/registry.spec.js b/js/src/contracts/registry.spec.js index 7cec52e94..cf81a2b72 100644 --- a/js/src/contracts/registry.spec.js +++ b/js/src/contracts/registry.spec.js @@ -35,6 +35,9 @@ function create () { } }; api = { + eth: { + getCode: sinon.stub().resolves('0x123456') + }, parity: { registryAddress: sinon.stub().resolves('testRegistryAddress') }, diff --git a/js/src/contracts/snippets/wallet.sol b/js/src/contracts/snippets/wallet.sol index 18de9df68..a8f1ba938 100644 --- a/js/src/contracts/snippets/wallet.sol +++ b/js/src/contracts/snippets/wallet.sol @@ -294,7 +294,7 @@ contract multisig { // TODO: document function execute(address _to, uint _value, bytes _data) external returns (bytes32 o_hash); - function confirm(bytes32 _h) external returns (bool o_success); + function confirm(bytes32 _h) returns (bool o_success); } // usage: diff --git a/js/src/dapps/chaindeploy.js b/js/src/dapps/chaindeploy.js new file mode 100644 index 000000000..c3dd42008 --- /dev/null +++ b/js/src/dapps/chaindeploy.js @@ -0,0 +1,29 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import ReactDOM from 'react-dom'; +import React from 'react'; + +import Application from './chaindeploy/Application'; + +import '../../assets/fonts/Roboto/font.css'; +import '../../assets/fonts/RobotoMono/font.css'; +import './style.css'; + +ReactDOM.render( + , + document.querySelector('#container') +); diff --git a/js/src/dapps/chaindeploy/Application/application.css b/js/src/dapps/chaindeploy/Application/application.css new file mode 100644 index 000000000..f6db5da29 --- /dev/null +++ b/js/src/dapps/chaindeploy/Application/application.css @@ -0,0 +1,78 @@ +/* Copyright 2015-2017 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +.body { + font-size: 0.8em; + + .buttons { + position: fixed; + right: 0.5em; + top: 0.5em; + z-index: 100; + + button { + background: rgb(0, 200, 255); + border: 2px solid rgba(0, 200, 255, 0.5); + border-radius: 0.25em; + color: white; + cursor: pointer; + font-size: 1em; + margin: 0 0 0 0.5em; + outline: none; + padding: 0.75em 1.5em; + white-space: nowrap; + + &:disabled { + background: rgb(230, 230, 230); + border: 2px solid rgba(230, 230, 230, 0.5); + cursor: default; + } + + .icon { + fill: white !important; + margin-right: 0.5em; + } + + .text { + display: inline-block; + line-height: 24px; + vertical-align: top; + } + } + } + + .section { + margin: 0 1em 3em 1em; + + h3 { + background: rgba(0, 0, 0, 0.025); + border-radius: 0.25em; + padding: 0.75em 1em; + margin-bottom: 0.5em; + + small { + vertical-align: middle; + } + } + + .list { + display: flex; + flex-direction: row; + flex-wrap: wrap; + } + } +} diff --git a/js/src/dapps/chaindeploy/Application/application.js b/js/src/dapps/chaindeploy/Application/application.js new file mode 100644 index 000000000..9e6fa588f --- /dev/null +++ b/js/src/dapps/chaindeploy/Application/application.js @@ -0,0 +1,178 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { observer } from 'mobx-react'; +import React, { Component } from 'react'; + +import Contract from '../Contract'; +import Dapp from '../Dapp'; +import Store from '../store'; + +import styles from './application.css'; + +@observer +export default class Application extends Component { + store = new Store(); + + render () { + return ( +
+ { this.renderContracts(false) } + { this.renderContracts(true) } + { this.renderApps() } + { this.renderContracts(false, true) } + { this.renderApps(true) } + { this.renderButtons() } +
+ ); + } + + renderButton (text, clickHandler, disabled) { + const onClick = (event) => { + if (!disabled) { + clickHandler(event); + } + }; + + return ( + + ); + } + + renderButtons () { + const { contractBadgereg, contractDappreg, isBadgeDeploying, isContractDeploying, isDappDeploying, haveAllBadges, haveAllContracts, haveAllDapps, registry } = this.store; + const disableRegistry = registry.address || registry.isDeploying; + const disableContracts = !registry.address || isContractDeploying || haveAllContracts; + const disableDapps = !contractDappreg.address || isDappDeploying || haveAllDapps; + const disableBadges = !registry.address || !contractBadgereg.address || isBadgeDeploying || haveAllBadges; + + return ( +
+ { this.renderButton('registry', this.deployRegistry, disableRegistry) } + { this.renderButton('contracts', this.deployContracts, disableContracts) } + { this.renderButton('badges', this.deployBadges, disableBadges) } + { this.renderButton('apps', this.deployApps, disableDapps) } +
+ ); + } + + renderContracts (isBadges, isExternal) { + const { badges, contracts, contractBadgereg, registry } = this.store; + const regaddress = isBadges + ? contractBadgereg.address + : registry.address; + + return ( +
+

+ { + isExternal + ? 'External ' + : '' + }{ + isBadges + ? 'Badges ' + : 'Contracts ' + }(registry { regaddress || 'unknown' }) +

+
+ { + isExternal || isBadges + ? null + : ( + + ) + } + { + (isBadges ? badges : contracts) + .filter((contract) => contract.isExternal === isExternal) + .map((contract) => { + return ( + + ); + }) + } +
+
+ ); + } + + renderApps (isExternal) { + const { apps, contractDappreg, contractGithubhint } = this.store; + const isDisabled = !contractDappreg.isOnChain || !contractGithubhint.isOnChain; + + return ( +
+

+ { + isExternal + ? 'External ' + : '' + }Applications (registry { + contractDappreg.address + ? contractDappreg.address + : 'unknown' + }) +

+
+ { + apps + .filter((app) => app.isExternal === isExternal) + .map((app) => { + return ( + + ); + }) + } +
+
+ ); + } + + deployApps = () => { + return this.store.deployApps(); + } + + deployBadges = () => { + return this.store.deployBadges(); + } + + deployContracts = () => { + return this.store.deployContracts(); + } + + deployRegistry = () => { + return this.store.deployRegistry(); + } +} diff --git a/js/src/dapps/chaindeploy/Application/index.js b/js/src/dapps/chaindeploy/Application/index.js new file mode 100644 index 000000000..3d8d1ca3b --- /dev/null +++ b/js/src/dapps/chaindeploy/Application/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './application'; diff --git a/js/src/dapps/chaindeploy/Contract/contract.js b/js/src/dapps/chaindeploy/Contract/contract.js new file mode 100644 index 000000000..1f0b158d2 --- /dev/null +++ b/js/src/dapps/chaindeploy/Contract/contract.js @@ -0,0 +1,132 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import ListItem, { Header, Row } from '../ListItem'; + +export default class Contract extends Component { + static propTypes = { + contract: PropTypes.object.isRequired, + disabled: PropTypes.bool + } + + render () { + const { contract, disabled } = this.props; + const location = contract.id === 'registry' + ? 'chain' + : 'registry'; + + return ( + +
+ { contract.id } was { + contract.address + ? 'deployed' + : 'not found' + } +
+ + { + contract.address + ? contract.address + : 'no address' + } + + + { + contract.hasLatestCode + ? 'has latest available code' + : 'does not have latest code' + } + + + { + contract.isOnChain + ? `registered on ${location}` + : `not registered on ${location}` + } + + { this.renderBadgeInfo() } +
+ ); + } + + renderBadgeInfo () { + const { contract } = this.props; + + if (!contract.isBadge) { + return null; + } + + return [ + + { + contract.isBadgeRegistered + ? 'found in badgereg' + : 'not found in badgereg' + } + , + + { + contract.badgeImageHash + ? `badge imageHash ${contract.badgeImageHash}` + : 'has not registered a badge imageHash' + } + , + + { + contract.badgeImageMatch + ? 'has latest badge imageHash' + : 'does not have latest badge imageHash' + } + + ]; + } +} diff --git a/js/src/dapps/dappreg/ButtonBar/index.js b/js/src/dapps/chaindeploy/Contract/index.js similarity index 95% rename from js/src/dapps/dappreg/ButtonBar/index.js rename to js/src/dapps/chaindeploy/Contract/index.js index 3df61a8f4..74c58e942 100644 --- a/js/src/dapps/dappreg/ButtonBar/index.js +++ b/js/src/dapps/chaindeploy/Contract/index.js @@ -14,4 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default from './buttonBar'; +export default from './contract'; diff --git a/js/src/dapps/chaindeploy/Dapp/dapp.js b/js/src/dapps/chaindeploy/Dapp/dapp.js new file mode 100644 index 000000000..5a997c295 --- /dev/null +++ b/js/src/dapps/chaindeploy/Dapp/dapp.js @@ -0,0 +1,98 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import ListItem, { Header, Row } from '../ListItem'; + +export default class Dapp extends Component { + static propTypes = { + dapp: PropTypes.object.isRequired, + disabled: PropTypes.bool + } + + render () { + const { dapp, disabled } = this.props; + + return ( + +
+ { dapp.name } +
+ + { + dapp.isOnChain + ? 'found in dappreg' + : 'not found in dappreg' + } + + { this.renderHash(dapp, 'image') } + { this.renderHash(dapp, 'manifest') } + { this.renderHash(dapp, 'content') } +
+ ); + } + + renderHash (dapp, type) { + if (!dapp.source[`${type}Hash`]) { + return null; + } + + const isMatch = dapp[`${type}Match`]; + const hash = dapp[`${type}Hash`]; + + return [ + + { + hash + ? `${type}Hash ${hash}` + : `has not registered an ${type}Hash` + } + , + + { + isMatch + ? `has latest ${type}Hash` + : `does not have latest ${type}Hash` + } + + ]; + } +} diff --git a/js/src/dapps/dappreg/Dapp/index.js b/js/src/dapps/chaindeploy/Dapp/index.js similarity index 100% rename from js/src/dapps/dappreg/Dapp/index.js rename to js/src/dapps/chaindeploy/Dapp/index.js diff --git a/js/src/dapps/chaindeploy/ListItem/Header/header.js b/js/src/dapps/chaindeploy/ListItem/Header/header.js new file mode 100644 index 000000000..e9be01eea --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/Header/header.js @@ -0,0 +1,45 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import Icon from '../Icon'; + +import styles from '../listItem.css'; + +export default class Header extends Component { + static propTypes = { + children: PropTypes.node.isRequired, + isBusy: PropTypes.bool, + isOk: PropTypes.bool + } + + render () { + const { children, isBusy, isOk } = this.props; + + return ( +
+ +
+ { children } +
+
+ ); + } +} diff --git a/js/src/dapps/dappreg/SelectDapp/index.js b/js/src/dapps/chaindeploy/ListItem/Header/index.js similarity index 95% rename from js/src/dapps/dappreg/SelectDapp/index.js rename to js/src/dapps/chaindeploy/ListItem/Header/index.js index 5aa5f5ff9..aef90266f 100644 --- a/js/src/dapps/dappreg/SelectDapp/index.js +++ b/js/src/dapps/chaindeploy/ListItem/Header/index.js @@ -14,4 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default from './selectDapp'; +export default from './header'; diff --git a/js/src/dapps/chaindeploy/ListItem/Icon/icon.js b/js/src/dapps/chaindeploy/ListItem/Icon/icon.js new file mode 100644 index 000000000..1f32622e5 --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/Icon/icon.js @@ -0,0 +1,53 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import styles from '../listItem.css'; + +export default class Icon extends Component { + static propTypes = { + isBusy: PropTypes.bool, + isOk: PropTypes.bool + } + + render () { + const { isBusy, isOk } = this.props; + + return ( +
+ { + isOk + ? '\u2714' + : ( + isBusy + ? '\u29d6' + : '\u2716' + ) + } +
+ ); + } +} diff --git a/js/src/dapps/chaindeploy/ListItem/Icon/index.js b/js/src/dapps/chaindeploy/ListItem/Icon/index.js new file mode 100644 index 000000000..f43e02c49 --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/Icon/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './icon'; diff --git a/js/src/dapps/chaindeploy/ListItem/Row/index.js b/js/src/dapps/chaindeploy/ListItem/Row/index.js new file mode 100644 index 000000000..5f2c62dee --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/Row/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './row'; diff --git a/js/src/dapps/chaindeploy/ListItem/Row/row.js b/js/src/dapps/chaindeploy/ListItem/Row/row.js new file mode 100644 index 000000000..0982e0321 --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/Row/row.js @@ -0,0 +1,54 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import Icon from '../Icon'; + +import styles from '../listItem.css'; + +export default class Row extends Component { + static propTypes = { + children: PropTypes.node.isRequired, + disabled: PropTypes.bool, + isBusy: PropTypes.bool, + isOk: PropTypes.bool + } + + render () { + const { children, disabled, isBusy, isOk } = this.props; + + return ( +
+ +
+ { children } +
+
+ ); + } +} diff --git a/db/src/lib.rs b/js/src/dapps/chaindeploy/ListItem/index.js similarity index 82% rename from db/src/lib.rs rename to js/src/dapps/chaindeploy/ListItem/index.js index 3519661bd..7c79e3241 100644 --- a/db/src/lib.rs +++ b/js/src/dapps/chaindeploy/ListItem/index.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -//! Database ipc service +export Header from './Header'; +export Row from './Row'; -#![allow(dead_code, unused_assignments, unused_variables)] // codegen issues -include!(concat!(env!("OUT_DIR"), "/lib.rs")); +export default from './listItem'; diff --git a/js/src/dapps/chaindeploy/ListItem/listItem.css b/js/src/dapps/chaindeploy/ListItem/listItem.css new file mode 100644 index 000000000..47d6d481d --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/listItem.css @@ -0,0 +1,94 @@ +/* Copyright 2015-2017 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +.listItem { + box-sizing: border-box; + flex: 0 1 33.33%; + max-width: 33.33%; + padding: 0.5em; + position: relative; + + .body { + background: rgba(0, 0, 0, 0.025); + border-radius: 0.25em; + box-sizing: border-box; + display: flex; + flex-direction: column; + flex-wrap: nowrap; + overflow: hidden; + padding: 0.75em; + } + + .status { + background: #f80; + border-radius: 0.25em; + color: white; + font-size: 0.75em; + line-height: 1em; + opacity: 0.9; + padding: 0.5em; + position: absolute; + right: 1em; + top: 1em; + } +} + +.header, +.details { + display: flex; + line-height: 1.5em; + padding: 0.125em 0; + position: relative; + white-space: nowrap; + + .title { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: top; + } +} + +.details { + margin-left: 2em; +} + +.icon { + border-radius: 0.25em; + display: inline-block; + flex: 0 0 1.5em; + height: 1.5em; + margin-right: 0.5em; + opacity: 0.75; + text-align: center; + vertical-align: middle; + width: 1.5em; + + &.error { + box-shadow: inset 0 0 0 2px rgb(200, 0, 0); + color: rgb(200, 0, 0); + } + + &.ok { + box-shadow: inset 0 0 0 2px rgb(0, 200, 0); + color: rgb(0, 200, 0); + } +} + +.muted { + opacity: 0.25; +} diff --git a/js/src/dapps/chaindeploy/ListItem/listItem.js b/js/src/dapps/chaindeploy/ListItem/listItem.js new file mode 100644 index 000000000..c670123f9 --- /dev/null +++ b/js/src/dapps/chaindeploy/ListItem/listItem.js @@ -0,0 +1,63 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import styles from './listItem.css'; + +export default class ListItem extends Component { + static propTypes = { + children: PropTypes.node.isRequired, + disabled: PropTypes.bool, + status: PropTypes.string + } + + render () { + const { children, disabled } = this.props; + + return ( +
+
+ { children } +
+ { this.renderStatus() } +
+ ); + } + + renderStatus () { + const { status } = this.props; + + if (!status) { + return null; + } + + return ( +
+ { status } +
+ ); + } +} diff --git a/js/src/dapps/chaindeploy/_dapps.js b/js/src/dapps/chaindeploy/_dapps.js new file mode 100644 index 000000000..b2ce1d4be --- /dev/null +++ b/js/src/dapps/chaindeploy/_dapps.js @@ -0,0 +1,43 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtinsJson from '~/views/Dapps/builtin.json'; + +const REGISTER_URLS = { + console: 'https://raw.githubusercontent.com/ethcore/console/3ea0dbfefded359ccdbea37bc4cf350c0aa16948/console.jpeg', + dappreg: 'https://raw.githubusercontent.com/ethcore/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/legos-64x64.png', + githubhint: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/link-64x64.jpg', + localtx: 'https://raw.githubusercontent.com/ethcore/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/stack-64x64.png', + registry: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/register-64x64.jpg', + signaturereg: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/hex-64x64.jpg', + tokendeploy: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/interlock-64x64.png', + tokenreg: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/coins-64x64.jpg', + web: 'https://raw.githubusercontent.com/ethcore/dapp-assets/ec6138115d0e1f45258969cd90b3b274e0ff2258/dapps/earth-64x64.jpg' +}; + +const builtins = builtinsJson + .filter((app) => app.id) + .map((app) => { + app.source = { + imageUrl: REGISTER_URLS[app.id] + }; + + return app; + }); + +export { + builtins +}; diff --git a/js/src/dapps/chaindeploy/contracts/abi/jg-voting.json b/js/src/dapps/chaindeploy/contracts/abi/jg-voting.json new file mode 100644 index 000000000..83a07ef7c --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/abi/jg-voting.json @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"count","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalVotes","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"hasSenderVoted","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_index","type":"uint256"},{"name":"_answer","type":"uint256"}],"name":"newAnswer","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setQuestionFee","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"questionFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"get","outputs":[{"name":"closed","type":"bool"},{"name":"owner","type":"address"},{"name":"question","type":"string"},{"name":"balanceNo","type":"uint256"},{"name":"balanceYes","type":"uint256"},{"name":"balanceMaybe","type":"uint256"},{"name":"votesNo","type":"uint256"},{"name":"votesYes","type":"uint256"},{"name":"votesMaybe","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_question","type":"string"}],"name":"newQuestion","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"totalBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"answerFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_index","type":"uint256"}],"name":"closeQuestion","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setAnswerFee","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"index","type":"uint256"},{"indexed":false,"name":"question","type":"string"}],"name":"NewQuestion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"index","type":"uint256"},{"indexed":true,"name":"answer","type":"uint256"},{"indexed":false,"name":"value","type":"uint256"}],"name":"NewAnswer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] diff --git a/js/src/dapps/chaindeploy/contracts/badgereg.js b/js/src/dapps/chaindeploy/contracts/badgereg.js new file mode 100644 index 000000000..ccd6b28c1 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/badgereg.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/badgereg'; +import { compiler, source as sourceUrl, output as byteCode } from './code/badgereg'; + +const id = 'badgereg'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/code/badgereg.json b/js/src/dapps/chaindeploy/contracts/code/badgereg.json new file mode 100644 index 000000000..e6613ed26 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/badgereg.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/BadgeReg.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600455341561003357fe5b5b610a6f806100436000396000f300606060405236156100bf5763ffffffff60e060020a60003504166313af403581146100c15780631e7a505f146100df5780632c0f5f591461010a5780635b8066451461014557806369fe0e2d146101675780637958533a1461017c5780638da5cb5b146101a45780639890220b146101d0578063a02b161e146101e2578063ac4ce2c6146101f7578063b72e717d14610218578063c0f6faed1461025b578063dd93890b14610299578063ddbcb5cb146102b4578063ddca3f43146102e6575bfe5b34156100c957fe5b6100dd600160a060020a0360043516610308565b005b6100f6600160a060020a036004351660243561037c565b604080519115158252519081900360200190f35b341561011257fe5b61011d600435610392565b60408051938452600160a060020a039283166020850152911682820152519081900360600190f35b341561014d57fe5b6101556103ef565b60408051918252519081900360200190f35b341561016f57fe5b6100dd6004356103f6565b005b341561018457fe5b61015560043560243561041b565b60408051918252519081900360200190f35b34156101ac57fe5b6101b461045a565b60408051600160a060020a039092168252519081900360200190f35b34156101d857fe5b6100dd610469565b005b34156101ea57fe5b6100dd6004356104bc565b005b34156101ff57fe5b6100dd600435600160a060020a03602435166105ee565b005b341561022057fe5b610234600160a060020a0360043516610721565b604080519384526020840192909252600160a060020a031682820152519081900360600190f35b341561026357fe5b61026e600435610789565b60408051600160a060020a039485168152602081019390935292168183015290519081900360600190f35b34156102a157fe5b6100dd6004356024356044356107dc565b005b6100f6600160a060020a036004358116906024359060443516610899565b604080519115158252519081900360200190f35b34156102ee57fe5b6101556109cc565b60408051918252519081900360200190f35b60005433600160a060020a0390811691161461032357610378565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b6000610389838333610899565b90505b92915050565b60008181526002602052604081205460038054600019909201929182918291859081106103bb57fe5b906000526020600020906004020160005b5080546002820154600160a060020a03918216955016925090505b509193909250565b6003545b90565b60005433600160a060020a0390811691161461041157610378565b60048190555b5b50565b600060038381548110151561042c57fe5b906000526020600020906004020160005b506000838152600391909101602052604090205490505b92915050565b600054600160a060020a031681565b60005433600160a060020a03908116911614610484576104b8565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156104b857610000565b5b5b565b60005433600160a060020a039081169116146104d757610378565b806003828154811015156104e757fe5b906000526020600020906004020160005b50600101546040517f844e89a9d524dabb877007aa0e9c395e8938fcfee93ece70c2cd0353db79c8e590600090a36001600060038381548110151561053957fe5b906000526020600020906004020160005b5054600160a060020a03168152602081019190915260400160009081208190556003805460029291908490811061057d57fe5b906000526020600020906004020160005b50600101548152602081019190915260400160009081205560038054829081106105b457fe5b906000526020600020906004020160005b508054600160a060020a03199081168255600060018301556002909101805490911690555b5b50565b60008233600160a060020a031660038281548110151561060a57fe5b906000526020600020906004020160005b5060020154600160a060020a0316146106335761071b565b600160a060020a03831660009081526001602052604090205483901561065857610718565b600380548690811061066657fe5b906000526020600020906004020160005b505460038054600160a060020a03909216945085918790811061069657fe5b906000526020600020906004020160005b508054600160a060020a031916600160a060020a039283161790558381166000908152600160209081526040808320839055928716808352918390208890558251918252915187927fa5d871c0e725767cd5aefc99c53aeca35f09dcc268145cbb13b74a7e2f48f196928290030190a25b5b505b50505050565b600160a060020a038116600090815260016020526040812054600380546000199092019291829182918590811061075457fe5b906000526020600020906004020160005b5060018101546002820154909450600160a060020a0316925090505b509193909250565b60006000600060006003858154811015156107a057fe5b906000526020600020906004020160005b50805460018201546002830154600160a060020a03928316975090955016925090505b509193909250565b8233600160a060020a03166003828154811015156107f657fe5b906000526020600020906004020160005b5060020154600160a060020a03161461081f5761071b565b8160038581548110151561082f57fe5b906000526020600020906004020160005b50600085815260039190910160209081526040918290209290925580518481529051859287927f7991c63a749706fd298fc2387764d640be6e714307b6357b1d3c2ce35cba3b52929081900390910190a35b5b50505050565b60006004543410156108aa576109c5565b600160a060020a0384166000908152600160205260409020548490156108cf576109c3565b6000848152600260205260409020548490156108ea576109c0565b60038054600181016108fc83826109d2565b916000526020600020906004020160005b5060408051606081018252600160a060020a03808b1680835260208084018c9052918a169284018390528454600160a060020a03199081168217865560018087018d905560029687018054909216909417905560035460008281529383528484208190558b8452948252918390208490558251918252915160001993909301935088927febbfb6376bef000063e6e33494e4c543a6197091a04eb6a6f55013d85a1c5386929181900390910190a3600192505b5b505b505b9392505050565b60045481565b8154818355818115116109fe576004028160040283600052602060002091820191016109fe9190610a04565b5b505050565b6103f391905b80821115610a3c578054600160a060020a03199081168255600060018301556002820180549091169055600401610a0a565b5090565b905600a165627a7a72305820526fc95faec325cec5dd3e1bb67c165265282c5fc6db21e96197060b823aaa490029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/dappreg.json b/js/src/dapps/chaindeploy/contracts/code/dappreg.json new file mode 100644 index 000000000..eae53272a --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/dappreg.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/225bf022ddd967af2b9ea188e8f611489ca5d7fe/DappReg.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600355341561003357fe5b5b6106ee806100436000396000f300606060405236156100a95763ffffffff60e060020a6000350416630257c48c81146100ab57806306661abd146100d357806313af4035146100f55780631a0919dc1461011357806369fe0e2d146101285780638da5cb5b1461013d5780638eaa6ac01461016957806391cd242d1461019d5780639890220b146101b8578063c52bd836146101ca578063ddca3f43146101eb578063e0886f901461020d578063e1fa8e8414610241575bfe5b34156100b357fe5b6100c160043560243561024e565b60408051918252519081900360200190f35b34156100db57fe5b6100c1610272565b60408051918252519081900360200190f35b34156100fd57fe5b610111600160a060020a0360043516610279565b005b341561011b57fe5b6101116004356102ed565b005b341561013057fe5b610111600435610388565b005b341561014557fe5b61014d6103ad565b60408051600160a060020a039092168252519081900360200190f35b341561017157fe5b61017c6004356103bc565b60408051928352600160a060020a0390911660208301528051918290030190f35b34156101a557fe5b6101116004356024356044356103e4565b005b34156101c057fe5b61011161046d565b005b34156101d257fe5b610111600435600160a060020a03602435166104c0565b005b34156101f357fe5b6100c161054e565b60408051918252519081900360200190f35b341561021557fe5b61017c600435610554565b60408051928352600160a060020a0390911660208301528051918290030190f35b6101116004356105ab565b005b60008281526001602090815260408083208484526002019091529020545b92915050565b6002545b90565b60005433600160a060020a0390811691161461029457610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b60008181526001602081905260409091200154819033600160a060020a0390811691161480159061032d575060005433600160a060020a03908116911614155b1561033757610000565b60008281526001602081905260408083208381559091018054600160a060020a03191690555183917fe17fec26316aebe957e188549d659a89f359c49766bcc0ae2fb7ded274ffe14691a25b5b5050565b60005433600160a060020a039081169116146103a357610000565b60038190555b5b50565b600054600160a060020a031681565b6000818152600160208190526040909120805491810154600160a060020a0316905b50915091565b60008381526001602081905260409091200154839033600160a060020a0390811691161461041157610000565b600084815260016020908152604080832086845260020182529182902084905581518481529151859287927f4dcd4fb147bb133a0da8fbf4e5fc3ddd64f04d4b3f6cbee584374b889d28c78d92918290030190a35b5b50505050565b60005433600160a060020a0390811691161461048857610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156104bc57610000565b5b5b565b60008281526001602081905260409091200154829033600160a060020a039081169116146104ed57610000565b60008381526001602081905260408083209091018054600160a060020a031916600160a060020a0386169081179091559051909185917fd3d10d874a10020c2bce719499d1fd8756d880b128eb2945dd01b3830854e7169190a35b5b505050565b60035481565b6000600060006001600060028681548110151561056d57fe5b906000526020600020900160005b50548152602081019190915260400160002080546001820154909450600160a060020a0316925090505b50915091565b6003543410156105ba57610000565b6000818152600160205260409020548190156105d557610000565b60028054600181016105e78382610677565b916000526020600020900160005b508390555060408051808201825283815233600160a060020a0390811660208084018281526000888152600192839052868120955186559051949091018054600160a060020a0319169490931693909317909155915184917f7d917fcbc9a29a9705ff9936ffa599500e4fd902e4486bae317414fe967b307c91a35b5b505b50565b815481835581811511610548576000838152602090206105489181019083016106a1565b5b505050565b61027691905b808211156106bb57600081556001016106a7565b5090565b905600a165627a7a7230582011d8a45e381635e9de17e14cc4de97a1e17758cfac1fd25e8a5bc1d5f4d1da9d0029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/gavcoin.json b/js/src/dapps/chaindeploy/contracts/code/gavcoin.json new file mode 100644 index 000000000..dbf53fdeb --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/gavcoin.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/GavCoin.sol", + "output": "0x606060405266038d7ea4c680006002556305f5e100600355341561001f57fe5b5b6108008061002f6000396000f300606060405236156100885763ffffffff60e060020a600035041663095ea7b3811461009f57806318160ddd146100d257806323b872dd146100f457806329cbdc861461012d57806355234ec0146101465780635af36e3e1461016857806370a0823114610192578063a035b1fe146101c0578063a9059cbb146101e2578063dd62ed3e14610215575b61009d5b61009a3360ff60020a610249565b5b565b005b34156100a757fe5b6100be600160a060020a0360043516602435610390565b604080519115158252519081900360200190f35b34156100da57fe5b6100e2610416565b60408051918252519081900360200190f35b34156100fc57fe5b6100be600160a060020a036004358116906024351660443561041c565b604080519115158252519081900360200190f35b61009d600160a060020a036004351660243561052a565b005b341561014e57fe5b6100e2610539565b60408051918252519081900360200190f35b341561017057fe5b6100be60043560243561053f565b604080519115158252519081900360200190f35b341561019a57fe5b6100e2600160a060020a03600435166106d0565b60408051918252519081900360200190f35b34156101c857fe5b6100e26106ef565b60408051918252519081900360200190f35b34156101ea57fe5b6100be600160a060020a03600435166024356106f5565b604080519115158252519081900360200190f35b341561021d57fe5b6100e2600160a060020a03600435811690602435166107a3565b60408051918252519081900360200190f35b34600080805b60008411801561026157508460025411155b1561038757600354600254620f424091025b0492508284116102835783610285565b825b9150600254620f4240830281151561029957fe5b33600160a060020a03166000818152600160208181526040808420805497909604968701865560028054855295830190915280832080548701905584548352808320909101805463ffffffff191662093a80420163ffffffff161790558154850182559254925193945084937f689dcb02b6a65e0e2f1d23ef47c1ec86604ffbed0bcb65f20150cfc7d5e5a9489190a4600380548290039081905593829003931515610382576002805466038d7ea4c6800001908190556305f5e1006003556040517f23c3dae768238f239632b5c4acb89485b440e0fa72481c4aad9f9b4f9b5a0a5f90600090a25b61024f565b5b505050505050565b600082600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a350600160a060020a0333811660009081526001602081815260408084209487168452600290940190529190208054830190555b92915050565b60005481565b600160a060020a038316600090815260016020526040812054849083908190101561044657610521565b600160a060020a0380871660009081526001602090815260408083203394851684526002019091529020548791908690819010156104835761051c565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03808a166000908152600160208181526040808420338616855260028101835281852080548e900390559183905281548c9003909155928b16825291902080548901905595505b5b5050505b50509392505050565b6105348282610249565b5b5050565b60035481565b600160a060020a0333166000908152600160208181526040808420868552909201905281205483908390819010806105a35750600160a060020a03331660009081526001602081815260408084208685528301909152909120015463ffffffff1642105b156105ad576106c8565b33600160a060020a0381166000908152600160205260409020548590819010156105d6576106c4565b60405186908890600160a060020a033316907f73f04af9dcc582a923ec15d3eea990fe34adabfff2879e28d44572e01a54abb690600090a433600160a060020a0316600090815260016020818152604080842080548b9003815584548b0185558b855290920190529020805487900390819055151561068457600160a060020a03331660009081526001602081815260408084208b85528301909152822091825501805463ffffffff191690555b600160a060020a0333166108fc620f4240888a025b604051919004801590920291906000818181858888f1935050505015156106bf57610000565b600194505b5b50505b505092915050565b600160a060020a0381166000908152600160205260409020545b919050565b60025481565b33600160a060020a038116600090815260016020526040812054909190839081901015610721576106c8565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600160a060020a03338116600090815260016020526040808220805488900390559187168152208054850190555b5b505092915050565b600160a060020a03808316600090815260016020908152604080832093851683526002909301905220545b929150505600a165627a7a72305820ca533a37c92e41888bda66ae0e66415d21a61c60027b269bca633d85b727875c0029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/githubhint.json b/js/src/dapps/chaindeploy/contracts/code/githubhint.json new file mode 100644 index 000000000..1dedacfe8 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/githubhint.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/GithubHint.sol", + "output": "0x6060604052341561000c57fe5b5b6105868061001c6000396000f300606060405263ffffffff60e060020a60003504166302f2008d81146100425780632196ae0d1461009b578063267b6922146101055780637c8c6643146101c9575bfe5b341561004a57fe5b60408051602060046024803582810135601f810185900485028601850190965285855261009995833595939460449493929092019181908401838280828437509496506101de95505050505050565b005b34156100a357fe5b60408051602060046024803582810135601f81018590048502860185019096528585526100999583359593946044949392909201918190840183828082843750949650505092356bffffffffffffffffffffffff191692506102be915050565b005b341561010d57fe5b6101186004356103b1565b604080516bffffffffffffffffffffffff1984166020820152600160a060020a03831691810191909152606080825284546002600019610100600184161502019091160490820181905281906080820190869080156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b505094505050505060405180910390f35b34156101d157fe5b6100996004356103de565b005b6000828152602081905260409020600201548290600160a060020a031615801590610227575060008181526020819052604090206002015433600160a060020a03908116911614155b15610231576102b8565b6040805160608101825283815260006020808301829052600160a060020a0333168385015286825281815292902081518051929391926102749284920190610472565b506020820151600182018054606060020a909204600160a060020a031992831617905560409092015160029091018054600160a060020a0392909216919092161790555b5b505050565b6000838152602081905260409020600201548390600160a060020a031615801590610307575060008181526020819052604090206002015433600160a060020a03908116911614155b15610311576103aa565b604080516060810182528481526bffffffffffffffffffffffff198416602080830191909152600160a060020a0333168284015260008781528082529290922081518051929391926103669284920190610472565b506020820151600182018054606060020a909204600160a060020a031992831617905560409092015160029091018054600160a060020a0392909216919092161790555b5b50505050565b600060208190529081526040902060018101546002820154606060020a90910290600160a060020a031683565b6000818152602081905260409020600201548190600160a060020a031615801590610427575060008181526020819052604090206002015433600160a060020a03908116911614155b156104315761046d565b60008281526020819052604081209061044a82826104f1565b50600181018054600160a060020a03199081169091556002909101805490911690555b5b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b357805160ff19168380011785556104e0565b828001600101855582156104e0579182015b828111156104e05782518255916020019190600101906104c5565b5b506104ed929150610539565b5090565b50805460018160011615610100020316600290046000825580601f106105175750610535565b601f0160209004906000526020600020908101906105359190610539565b5b50565b61055791905b808211156104ed576000815560010161053f565b5090565b905600a165627a7a72305820a83571409e7b0cc4fe48edd09087f315930ab4e017c62b6d100462285a8f4ae70029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/jg-voting.json b/js/src/dapps/chaindeploy/contracts/code/jg-voting.json new file mode 100644 index 000000000..08ec4d0ed --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/jg-voting.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/jacogr/dapp-voting/blob/9b20754b13b9a387704c0955d88b51d2e0e1896d/src/solidity/Voting.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600281905560038190556004556611c37937e0800060055534156200004057fe5b5b60408051808201909152600781527f48756e6772793f0000000000000000000000000000000000000000000000000060208201526200008e906401000000006200090a6200009682021704565b505b620003af565b60008054819033600160a060020a03908116911614801590620000ba575060055434105b15620000c65762000000565b82600481511080620000d9575060a08151115b15620000e55762000000565b60018054925082810190620000fb908262000244565b50336001838154811015156200010d57fe5b906000526020600020906005020160005b508054600160a060020a03929092166101000261010060a860020a031990921691909117905560018054859190849081106200015657fe5b906000526020600020906005020160005b5060010190805190602001906200018092919062000279565b508133600160a060020a03167f7793f929911ad07e07894a20378f1eccce0fb493486c569d74045731fb583b8e866040518080602001828103825283818151815260200191508051906020019080838360008314620001fc575b805182526020831115620001fc57601f199092019160209182019101620001da565b505050905090810190601f168015620002295780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600192505b5b505b50919050565b8154818355818115116200027357600502816005028360005260206000209182019101620002739190620002ff565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002bc57805160ff1916838001178555620002ec565b82800160010185558215620002ec579182015b82811115620002ec578251825591602001919060010190620002cf565b5b50620002fb9291506200033f565b5090565b6200033c91905b80821115620002fb578054600160a860020a031916815560006200032e600183018262000363565b5060050162000306565b5090565b90565b6200033c91905b80821115620002fb576000815560010162000346565b5090565b90565b50805460018160011615610100020316600290046000825580601f106200038b5750620003ab565b601f016020900490600052602060002090810190620003ab91906200033f565b5b50565b610d2f80620003bf6000396000f300606060405236156100bf5763ffffffff60e060020a60003504166306661abd81146100c15780630d15fd77146100e357806313af40351461010557806331d3164714610123578063476c494c1461014a5780634df6ca2a1461016c5780638a55b54d146101935780638da5cb5b146101b55780639507d39a146101e15780639890220b146102c7578063a3f66b46146102eb578063ad7a672f1461034d578063bd12b4b51461036f578063c09f32e814610391578063f41c1c93146103b8575bfe5b34156100c957fe5b6100d16103df565b60408051918252519081900360200190f35b34156100eb57fe5b6100d16103e6565b60408051918252519081900360200190f35b341561010d57fe5b610121600160a060020a03600435166103ec565b005b341561012b57fe5b61013660043561046d565b604080519115158252519081900360200190f35b6101366004356024356104b8565b604080519115158252519081900360200190f35b341561017457fe5b6101366004356106c3565b604080519115158252519081900360200190f35b341561019b57fe5b6100d16106ee565b60408051918252519081900360200190f35b34156101bd57fe5b6101c56106f4565b60408051600160a060020a039092168252519081900360200190f35b34156101e957fe5b6101f4600435610703565b604051808a15151515815260200189600160a060020a0316600160a060020a0316815260200180602001888152602001878152602001868152602001858152602001848152602001838152602001828103825289818151815260200191508051906020019080838360008314610285575b80518252602083111561028557601f199092019160209182019101610265565b505050905090810190601f1680156102b15780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34156102cf57fe5b6101366108b2565b604080519115158252519081900360200190f35b610136600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061090a95505050505050565b604080519115158252519081900360200190f35b341561035557fe5b6100d1610ab5565b60408051918252519081900360200190f35b341561037757fe5b6100d1610abb565b60408051918252519081900360200190f35b341561039957fe5b610136600435610ac1565b604080519115158252519081900360200190f35b34156103c057fe5b610136600435610b63565b604080519115158252519081900360200190f35b6001545b90565b60035481565b60005433600160a060020a0390811691161461040757610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600060018281548110151561047e57fe5b906000526020600020906005020160005b50600160a060020a0333166000908152600491909101602052604090205460ff1690505b919050565b6000805433600160a060020a039081169116148015906104d9575060045434105b156104e357610000565b600154839081106104f357610000565b8360018181548110151561050357fe5b906000526020600020906005020160005b505460ff1615156001141561052857610000565b8460018181548110151561053857fe5b906000526020600020906005020160005b50600160a060020a0333166000908152600491909101602052604090205460ff1615156001141561057957610000565b84600281111561058857610000565b60038054600190810190915560028054600160a060020a0333163101905580548190899081106105b457fe5b906000526020600020906005020160005b5033600160a060020a031660008181526004929092016020526040909120805460ff191692151592909217909155600180549131918990811061060457fe5b906000526020600020906005020160005b50600088815260029190910160205260409020805490910190556001805481908990811061063f57fe5b906000526020600020906005020160005b506000888152600391909101602090815260409182902080549093019092558051600160a060020a033316318152905188928a927f8b8ed2ef61b90da02f78bd8647287f46833d5b11467db4451e5c4b165485bf46929081900390910190a3600194505b5b505b505b505b505b92915050565b6000805433600160a060020a039081169116146106df57610000565b50600581905560015b5b919050565b60055481565b600054600160a060020a031681565b6000600061070f610b8e565b600060006000600060006000600060018b81548110151561072c57fe5b906000526020600020906005020160005b5090508060000160009054906101000a900460ff1699508060000160019054906101000a9004600160a060020a03169850806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108065780601f106107db57610100808354040283529160200191610806565b820191906000526020600020905b8154815290600101906020018083116107e957829003601f168201915b505050505097508060020160006000815260200190815260200160002054965080600201600060018152602001908152602001600020549550806002016000600281526020019081526020016000205494508060030160006000815260200190815260200160002054935080600301600060018152602001908152602001600020549250806003016000600281526020019081526020016000205491505b509193959799909294969850565b6000805433600160a060020a039081169116146108ce57610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f19350505050151561090257610000565b5060015b5b90565b60008054819033600160a060020a0390811691161480159061092d575060055434105b1561093757610000565b82600481511080610949575060a08151115b1561095357610000565b600180549250828101906109679082610ba0565b503360018381548110151561097857fe5b906000526020600020906005020160005b508054600160a060020a03929092166101000274ffffffffffffffffffffffffffffffffffffffff001990921691909117905560018054859190849081106109cd57fe5b906000526020600020906005020160005b5060010190805190602001906109f5929190610bd2565b508133600160a060020a03167f7793f929911ad07e07894a20378f1eccce0fb493486c569d74045731fb583b8e866040518080602001828103825283818151815260200191508051906020019080838360008314610a6e575b805182526020831115610a6e57601f199092019160209182019101610a4e565b505050905090810190601f168015610a9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600192505b5b505b50919050565b60025481565b60045481565b60008133600160a060020a0316600182815481101515610add57fe5b906000526020600020906005020160005b50546101009004600160a060020a031614801590610b1b575060005433600160a060020a03908116911614155b15610b2557610000565b6001600184815481101515610b3657fe5b906000526020600020906005020160005b50805460ff1916911515919091179055600191505b5b50919050565b6000805433600160a060020a03908116911614610b7f57610000565b50600481905560015b5b919050565b60408051602081019091526000815290565b815481835581811511610bcc57600502816005028360005260206000209182019101610bcc9190610c51565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c1357805160ff1916838001178555610c40565b82800160010185558215610c40579182015b82811115610c40578251825591602001919060010190610c25565b5b50610c4d929150610c9a565b5090565b6103e391905b80821115610c4d57805474ffffffffffffffffffffffffffffffffffffffffff191681556000610c8a6001830182610cbb565b50600501610c57565b5090565b90565b6103e391905b80821115610c4d5760008155600101610ca0565b5090565b90565b50805460018160011615610100020316600290046000825580601f10610ce15750610469565b601f0160209004906000526020600020908101906104699190610c9a565b5b505600a165627a7a72305820b084dcce4e3d78f8a86c925f6c3f2ed689e3674655482541076a1a22f6cdedad0029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/registry.json b/js/src/dapps/chaindeploy/contracts/code/registry.json new file mode 100644 index 000000000..6976dee58 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/registry.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/b1e0348144793e4ce6f7d6d2c4c7d0bb4ae9765e/SimpleRegistry.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600355341561003357fe5b5b611b2f806100436000396000f300606060405236156101225763ffffffff60e060020a60003504166306b2ff47811461012457806313af40351461015457806319362a28146101725780633f3935d1146101df578063432ced04146102495780634f39ca59146102685780636795dbcd1461028f57806369fe0e2d1461030257806379ce9fac146103295780638da5cb5b1461035c57806390b97fc11461038857806392698814146103f15780639890220b14610418578063ac4e73f91461043c578063ac72c120146104b1578063c3a3582514610388578063ddca3f4314610541578063deb931a214610563578063df57b74214610592578063e30bd740146105c1578063eadf976014610172578063ef5454d6146106ca578063f25eb5c11461073f578063f6d339e414610751575bfe5b341561012c57fe5b610140600160a060020a03600435166107c7565b604080519115158252519081900360200190f35b341561015c57fe5b610170600160a060020a03600435166107fa565b005b341561017a57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526101409583359593946044949392909201918190840183828082843750949650509335935061086e92505050565b604080519115158252519081900360200190f35b34156101e757fe5b610140600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610a1495505050505050565b604080519115158252519081900360200190f35b610140600435610b6e565b604080519115158252519081900360200190f35b341561027057fe5b610140600435610c03565b604080519115158252519081900360200190f35b341561029757fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102e69583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051600160a060020a039092168252519081900360200190f35b341561030a57fe5b610140600435610d40565b604080519115158252519081900360200190f35b341561033157fe5b610140600435600160a060020a0360243516610d9e565b604080519115158252519081900360200190f35b341561036457fe5b6102e6610e2e565b60408051600160a060020a039092168252519081900360200190f35b341561039057fe5b60408051602060046024803582810135601f81018590048502860185019096528585526103df9583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051918252519081900360200190f35b34156103f957fe5b610140600435610eb9565b604080519115158252519081900360200190f35b341561042057fe5b610140610ed9565b604080519115158252519081900360200190f35b341561044457fe5b610140600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965050509235600160a060020a03169250610f6e915050565b604080519115158252519081900360200190f35b34156104b957fe5b6101406004356112ac565b604080519115158252519081900360200190f35b341561039057fe5b60408051602060046024803582810135601f81018590048502860185019096528585526103df9583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051918252519081900360200190f35b341561054957fe5b6103df61134c565b60408051918252519081900360200190f35b341561056b57fe5b6102e6600435611352565b60408051600160a060020a039092168252519081900360200190f35b341561059a57fe5b6102e6600435611370565b60408051600160a060020a039092168252519081900360200190f35b34156105c957fe5b6105dd600160a060020a0360043516611392565b604080516020808252835181830152835191928392908301918501908083838215610623575b80518252602083111561062357601f199092019160209182019101610603565b505050905090810190601f16801561064f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017a57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526101409583359593946044949392909201918190840183828082843750949650509335935061086e92505050565b604080519115158252519081900360200190f35b34156106d257fe5b610140600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965050509235600160a060020a031692506115e8915050565b604080519115158252519081900360200190f35b341561074757fe5b6101706116c6565b005b341561075957fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610140958335959394604494939290920191819084018382808284375094965050509235600160a060020a0316925061185a915050565b604080519115158252519081900360200190f35b600160a060020a03811660009081526002602081905260409091205460001961010060018316150201160415155b919050565b60005433600160a060020a039081169116146108155761086a565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b600083815260016020526040812054849033600160a060020a0390811691161461089757610a0b565b6000858152600160209081526040918290209151865186936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b60008133600160a060020a031660016000836040518082805190602001908083835b60208310610a555780518252601f199092019160209182019101610a36565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002060010154600160a060020a0316939093149250610aab91505057610b67565b600160a060020a03331660009081526002602090815260409091208451610ad492860190611a09565b5033600160a060020a0316836040518082805190602001908083835b60208310610b0f5780518252601f199092019160209182019101610af0565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f098ae8581bb8bd9af1beaf7f2e9f51f31a8e5a8bfada4e303a645d71d9c9192092506000919050a3600191505b5b50919050565b6000818152600160205260408120548290600160a060020a031615610b9257610b67565b600354341015610ba157610b67565b6000838152600160205260408082208054600160a060020a03191633600160a060020a03169081179091559051909185917f4963513eca575aba66fdcd25f267aae85958fe6fb97e75fa25d783f1a091a2219190a3600191505b5b5b50919050565b600081815260016020526040812054829033600160a060020a03908116911614610c2c57610b67565b600083815260016020818152604080842090920154600160a060020a03168352600290528120610c5b91611a88565b60008381526001602081905260408083208054600160a060020a03199081168255920180549092169091555133600160a060020a03169185917fef1961b4d2909dc23643b309bfe5c3e5646842d98c3a58517037ef3871185af39190a3600191505b5b50919050565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b6000805433600160a060020a03908116911614610d5c576107f5565b60038290556040805183815290517f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c39181900360200190a15060015b5b919050565b600082815260016020526040812054839033600160a060020a03908116911614610dc757610e26565b6000848152600160205260408082208054600160a060020a031916600160a060020a0387811691821790925591519192339091169187917f7b97c62130aa09acbbcbf7482630e756592496f1759eaf702f469cf64dfb779491a4600191505b5b5092915050565b600054600160a060020a031681565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b600081815260016020526040902054600160a060020a031615155b919050565b6000805433600160a060020a03908116911614610ef557610f6a565b60408051600160a060020a03301631815290517fdef931299fe61d176f949118058530c1f3f539dcb6950b4e372c9b835c33ca079181900360200190a1604051600160a060020a0333811691309091163180156108fc02916000818181858888f193505050501515610f6657610000565b5060015b5b90565b60006000836040518082805190602001908083835b60208310610fa25780518252601f199092019160209182019101610f83565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912060008181526001909252929020549193505033600160a060020a039081169116149050610ff6576112a3565b846040518082805190602001908083835b602083106110265780518252601f199092019160209182019101611007565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600081815260019283905293909320015491955050600160a060020a03161580159250905061111257506000828152600160208181526040808420830154600160a060020a031684526002918290529283902092518354869493919283928592908116156101000260001901160480156110ff5780601f106110dd5761010080835404028352918201916110ff565b820191906000526020600020905b8154815290600101906020018083116110eb575b5050915050604051809103902060001916145b156111eb57600082815260016020818152604080842090920154600160a060020a0316835260029052812061114691611a88565b6000828152600160208181526040928390209091015491518751600160a060020a039093169288928291908401908083835b602083106111975780518252601f199092019160209182019101611178565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f12491ad95fd945e444d88a894ffad3c21959880a4dcd8af99d4ae4ffc71d4abd92506000919050a35b6000828152600160208181526040928390209091018054600160a060020a031916600160a060020a0388169081179091559151875188928291908401908083835b6020831061124b5780518252601f19909201916020918201910161122c565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f728435a0031f6a04538fcdd24922a7e06bc7bc945db03e83d22122d1bc5f28df92506000919050a3600192505b5b505092915050565b60008181526001602081905260409091200154600160a060020a031615155b919050565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60035481565b600081815260016020526040902054600160a060020a03165b919050565b60008181526001602081905260409091200154600160a060020a03165b919050565b61139a611ad0565b600160a060020a038216600090815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383529192908301828280156114355780601f1061140a57610100808354040283529160200191611435565b820191906000526020600020905b81548152906001019060200180831161141857829003601f168201915b505050505090505b919050565b600083815260016020526040812054849033600160a060020a0390811691161461089757610a0b565b6000858152600160209081526040918290209151865186936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b6000805433600160a060020a0390811691161461160457610d3a565b600160a060020a0382166000908152600260209081526040909120845161162d92860190611a09565b5081600160a060020a0316836040518082805190602001908083835b602083106116685780518252601f199092019160209182019101611649565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f098ae8581bb8bd9af1beaf7f2e9f51f31a8e5a8bfada4e303a645d71d9c9192092506000919050a35060015b5b92915050565b33600160a060020a03166002600033600160a060020a0316600160a060020a0316815260200190815260200160002060405180828054600181600116156101000203166002900480156117505780601f1061172e576101008083540402835291820191611750565b820191906000526020600020905b81548152906001019060200180831161173c575b505060405190819003812092507f12491ad95fd945e444d88a894ffad3c21959880a4dcd8af99d4ae4ffc71d4abd9150600090a3600160006002600033600160a060020a0316600160a060020a0316815260200190815260200160002060405180828054600181600116156101000203166002900480156118085780601f106117e6576101008083540402835291820191611808565b820191906000526020600020905b8154815290600101906020018083116117f4575b50506040805191829003909120845260208085019590955292830160009081206001018054600160a060020a031916905533600160a060020a0316815260029094525050812061185791611a88565b5b565b600083815260016020526040812054849033600160a060020a0390811691161461188357610a0b565b60008581526001602090815260409182902091518651600160a060020a038716936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a4a57805160ff1916838001178555611a77565b82800160010185558215611a77579182015b82811115611a77578251825591602001919060010190611a5c565b5b50611a84929150611ae2565b5090565b50805460018160011615610100020316600290046000825580601f10611aae575061086a565b601f01602090049060005260206000209081019061086a9190611ae2565b5b50565b60408051602081019091526000815290565b610f6a91905b80821115611a845760008155600101611ae8565b5090565b905600a165627a7a723058202a8f09bd2a20f43dfe4c6adb69bf4bfa211cda23787d972cd6e33eee989cafc50029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/signaturereg.json b/js/src/dapps/chaindeploy/contracts/code/signaturereg.json new file mode 100644 index 000000000..c3caf9276 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/signaturereg.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/SignatureReg.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600255341561002a57fe5b5b60408051808201909152601081527f726567697374657228737472696e67290000000000000000000000000000000060208201526100759064010000000061036661007c82021704565b505b61031c565b60006100f7826040518082805190602001908083835b602083106100b15780518252601f199092019160209182019101610092565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836100ff640100000000026103d6176401000000009004565b90505b919050565b7fffffffff000000000000000000000000000000000000000000000000000000008216600090815260016020819052604082205484916002908216156101000260001901909116041561015157610274565b7fffffffff000000000000000000000000000000000000000000000000000000008416600090815260016020908152604090912084516101939286019061027c565b5060028054600101905560408051602080825285518183015285517fffffffff00000000000000000000000000000000000000000000000000000000881693600160a060020a033316937f50e01e16719d6c699e516c57f4c514e77f6bc21a978d33f23980acdddbcbd0b293899391928392908301918501908083838215610236575b80518252602083111561023657601f199092019160209182019101610216565b505050905090810190601f1680156102625780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102bd57805160ff19168380011785556102ea565b828001600101855582156102ea579182015b828111156102ea5782518255916020019190600101906102cf565b5b506102f79291506102fb565b5090565b61031991905b808211156102f75760008155600101610301565b5090565b90565b6105d78061032b6000396000f3006060604052361561005c5763ffffffff60e060020a60003504166313af4035811461005e5780633015a5211461007c5780638da5cb5b1461009e5780639890220b146100ca578063b46bcdaa146100dc578063f2c298be14610179575bfe5b341561006657fe5b61007a600160a060020a03600435166101e3565b005b341561008457fe5b61008c610264565b60408051918252519081900360200190f35b34156100a657fe5b6100ae61026a565b60408051600160a060020a039092168252519081900360200190f35b34156100d257fe5b61007a610279565b005b34156100e457fe5b6100f9600160e060020a0319600435166102cc565b60408051602080825283518183015283519192839290830191850190808383821561013f575b80518252602083111561013f57601f19909201916020918201910161011f565b505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018157fe5b6101cf600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061036695505050505050565b604080519115158252519081900360200190f35b60005433600160a060020a039081169116146101fe57610260565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60025481565b600054600160a060020a031681565b60005433600160a060020a03908116911614610294576102c8565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156102c857610000565b5b5b565b60016020818152600092835260409283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835291929083018282801561035e5780601f106103335761010080835404028352916020019161035e565b820191906000526020600020905b81548152906001019060200180831161034157829003601f168201915b505050505081565b60006103ce826040518082805190602001908083835b6020831061039b5780518252601f19909201916020918201910161037c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836103d6565b90505b919050565b600160e060020a03198216600090815260016020819052604082205484916002908216156101000260001901909116041561041057610503565b600160e060020a031984166000908152600160209081526040909120845161043a9286019061050b565b506002805460010190556040805160208082528551818301528551600160e060020a0319881693600160a060020a033316937f50e01e16719d6c699e516c57f4c514e77f6bc21a978d33f23980acdddbcbd0b2938993919283929083019185019080838382156104c5575b8051825260208311156104c557601f1990920191602091820191016104a5565b505050905090810190601f1680156104f15780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061054c57805160ff1916838001178555610579565b82800160010185558215610579579182015b8281111561057957825182559160200191906001019061055e565b5b5061058692915061058a565b5090565b6105a891905b808211156105865760008155600101610590565b5090565b905600a165627a7a723058206830357dde798fafa19dd78a4460c047f76cc132713db13442c5da7485fc0ff40029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/tokendeploy.json b/js/src/dapps/chaindeploy/contracts/code/tokendeploy.json new file mode 100644 index 000000000..b04fdb38b --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/tokendeploy.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/0ca02d60066202432305c8e9b1cbf33267478ab3/BasicCoin.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055341561002757fe5b5b610f43806100376000396000f3006060604052361561007d5763ffffffff60e060020a600035041663061ea8cc811461007f57806306661abd146100ad57806313af4035146100cf5780635001f3b5146100ed5780638da5cb5b1461010f5780639507d39a1461013b5780639890220b14610179578063acfdfd1c1461018b578063c00ca38314610236575bfe5b341561008757fe5b61009b600160a060020a0360043516610280565b60408051918252519081900360200190f35b34156100b557fe5b61009b61029f565b60408051918252519081900360200190f35b34156100d757fe5b6100eb600160a060020a03600435166102a6565b005b34156100f557fe5b61009b610327565b60408051918252519081900360200190f35b341561011757fe5b61011f61032e565b60408051600160a060020a039092168252519081900360200190f35b341561014357fe5b61014e60043561033d565b60408051600160a060020a039485168152928416602084015292168183015290519081900360600190f35b341561018157fe5b6100eb610392565b005b60408051602060046024803582810135601f8101859004850286018501909652858552610222958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375094965050509235600160a060020a031692506103e5915050565b604080519115158252519081900360200190f35b341561023e57fe5b61014e600160a060020a036004351660243561079b565b60408051600160a060020a039485168152928416602084015292168183015290519081900360600190f35b600160a060020a0381166000908152600260205260409020545b919050565b6001545b90565b60005433600160a060020a039081169116146102c157610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b620f424081565b600054600160a060020a031681565b600060006000600060018581548110151561035457fe5b906000526020600020906003020160005b50805460018201546002830154600160a060020a039283169750908216955016925090505b509193909250565b60005433600160a060020a039081169116146103ad57610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156103e157610000565b5b5b565b60008181808088336103f56107eb565b918252600160a060020a03166020820152604080519182900301906000f080151561041c57fe5b925061042733610280565b915083600160a060020a031663ddca3f436000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561046f57fe5b60325a03f1151561047c57fe5b50506040805151600160a060020a03331660009081526002602052919091209092506001840191506104ae90826107fb565b50600154600160a060020a03331660009081526002602052604090208054849081106104d657fe5b906000526020600020900160005b5055600180548082016104f78382610825565b916000526020600020906003020160005b60606040519081016040528087600160a060020a0316815260200133600160a060020a0316815260200188600160a060020a0316815250909190915060008201518160000160006101000a815481600160a060020a030219169083600160a060020a0316021790555060208201518160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555060408201518160020160006101000a815481600160a060020a030219169083600160a060020a0316021790555050505083600160a060020a0316637b1a547c82858b620f42408c336000604051602001526040518763ffffffff1660e060020a0281526004018086600160a060020a0316600160a060020a03168152602001806020018581526020018060200184600160a060020a0316600160a060020a03168152602001838103835287818151815260200191508051906020019080838360008314610686575b80518252602083111561068657601f199092019160209182019101610666565b505050905090810190601f1680156106b25780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156106f1575b8051825260208311156106f157601f1990920191602091820191016106d1565b505050905090810190601f16801561071d5780820380516001836020036101000a031916815260200191505b509750505050505050506020604051808303818588803b151561073c57fe5b61235a5a03f1151561074a57fe5b5050604051600160a060020a03808716935087811692503316907f454b0172f64812df0cd504c2bd7df7aab8ff328a54d946b4bd0fa7c527adf9cc90600090a4600194505b50505050949350505050565b600160a060020a03821660009081526002602052604081208054829182916107dd9190869081106107c857fe5b906000526020600020900160005b505461033d565b9250925092505b9250925092565b604051610650806108c883390190565b81548183558181151161081f5760008381526020902061081f918101908301610857565b5b505050565b81548183558181151161081f5760030281600302836000526020600020918201910161081f9190610878565b5b505050565b6102a391905b80821115610871576000815560010161085d565b5090565b90565b6102a391905b8082111561087157805473ffffffffffffffffffffffffffffffffffffffff19908116825560018201805482169055600282018054909116905560030161087e565b5090565b905600606060405260008054600160a060020a03191633600160a060020a0316179055341561002757fe5b6040516040806106508339810160405280516020909101515b600034111561004e57610000565b8180151561005b57610000565b600183905560008054600160a060020a031916600160a060020a038416908117825581526002602052604090208390555b5b505b50505b6105af806100a16000396000f3006060604052361561007d5763ffffffff60e060020a600035041663095ea7b3811461009257806313af4035146100c557806318160ddd146100e357806323b872dd146101055780635001f3b51461013e57806370a08231146101605780638da5cb5b1461018e578063a9059cbb146101ba578063dd62ed3e146101ed575b341561008557fe5b6100905b610000565b565b005b341561009a57fe5b6100b1600160a060020a0360043516602435610221565b604080519115158252519081900360200190f35b34156100cd57fe5b610090600160a060020a03600435166102b6565b005b34156100eb57fe5b6100f3610337565b60408051918252519081900360200190f35b341561010d57fe5b6100b1600160a060020a036004358116906024351660443561033d565b604080519115158252519081900360200190f35b341561014657fe5b6100f361045d565b60408051918252519081900360200190f35b341561016857fe5b6100f3600160a060020a0360043516610464565b60408051918252519081900360200190f35b341561019657fe5b61019e610483565b60408051600160a060020a039092168252519081900360200190f35b34156101c257fe5b6100b1600160a060020a0360043516602435610492565b604080519115158252519081900360200190f35b34156101f557fe5b6100f3600160a060020a0360043581169060243516610552565b60408051918252519081900360200190f35b6000600034111561023157610000565b82600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a350600160a060020a0333811660009081526002602090815260408083209386168352600193840190915290208054830190555b5b92915050565b60005433600160a060020a039081169116146102d157610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60015481565b6000600034111561034d57610000565b600160a060020a038416600090815260026020526040902054849083908190101561037757610000565b600160a060020a0380871660009081526002602090815260408083203394851684526001019091529020548791908690819010156103b457610000565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03808a16600090815260026020818152604080842033861685526001808201845282862080548f900390559390925281548c9003909155928b16825291902080548901905595505b5b5050505b50505b9392505050565b620f424081565b600160a060020a0381166000908152600260205260409020545b919050565b600054600160a060020a031681565b600060003411156104a257610000565b33600160a060020a0381166000908152600260205260409020548390819010156104cb57610000565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600160a060020a0333811660009081526002602052604080822080548890039055918716815220805485019055600192505b5b50505b92915050565b600160a060020a03808316600090815260026020908152604080832093851683526001909301905220545b929150505600a165627a7a72305820b5bf89a0a85c15df1e9717e49be06fe1a4f9dcc1e0cebf5483dd1c0bcd14a0910029a165627a7a723058207f96b7ad40c02cfaeaf29e65c79456dd3fd9828c9d3fbaf801fb60010456c3880029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/tokenreg.json b/js/src/dapps/chaindeploy/contracts/code/tokenreg.json new file mode 100644 index 000000000..bd96f16b1 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/tokenreg.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/TokenReg.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600455341561003357fe5b5b611473806100436000396000f300606060405236156100b45763ffffffff60e060020a600035041663044215c681146100b657806313af4035146101df57806366b42dcb146101fd57806369fe0e2d146102ab5780637958533a146102c05780637b1a547c146102e8578063891de9ed146103a15780638da5cb5b146104bc5780639890220b146104e85780639f181b5e146104fa578063a02b161e1461051c578063b72e717d14610531578063dd93890b1461066a578063ddca3f4314610685575bfe5b34156100be57fe5b6100c96004356106a7565b60408051600160a060020a038088168252918101859052908216608082015260a060208083018281528751928401929092528651606084019160c0850191908901908083838215610135575b80518252602083111561013557601f199092019160209182019101610115565b505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101a0575b8051825260208311156101a057601f199092019160209182019101610180565b505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34156101e757fe5b6101fb600160a060020a036004351661083a565b005b60408051602060046024803582810135601f8101859004850286018501909652858552610297958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a8a359a9099940197509195509182019350915081908401838280828437509496506108ae95505050505050565b604080519115158252519081900360200190f35b34156102b357fe5b6101fb6004356108c8565b005b34156102c857fe5b6102d66004356024356108ed565b60408051918252519081900360200190f35b60408051602060046024803582810135601f8101859004850286018501909652858552610297958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a8a359a90999401975091955091820193509150819084018382808284375094965050509235600160a060020a0316925061092c915050565b604080519115158252519081900360200190f35b34156103a957fe5b6103f7600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610c6695505050505050565b6040518086815260200185600160a060020a0316600160a060020a031681526020018481526020018060200183600160a060020a0316600160a060020a0316815260200182810382528481815181526020019150805190602001908083836000831461047e575b80518252602083111561047e57601f19909201916020918201910161045e565b505050905090810190601f1680156104aa5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34156104c457fe5b6104cc610dca565b60408051600160a060020a039092168252519081900360200190f35b34156104f057fe5b6101fb610dd9565b005b341561050257fe5b6102d6610e2c565b60408051918252519081900360200190f35b341561052457fe5b6101fb600435610e33565b005b341561053957fe5b61054d600160a060020a0360043516611047565b60405180868152602001806020018581526020018060200184600160a060020a0316600160a060020a03168152602001838103835287818151815260200191508051906020019080838360008314610135575b80518252602083111561013557601f199092019160209182019101610115565b505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101a0575b8051825260208311156101a057601f199092019160209182019101610180565b505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b341561067257fe5b6101fb6004356024356044356111f3565b005b341561068d57fe5b6102d66112b0565b60408051918252519081900360200190f35b60006106b16112b6565b60006106bb6112b6565b600060006003878154811015156106ce57fe5b906000526020600020906006020160005b50805460018083018054604080516020601f600260001997861615610100029790970190941695909504928301859004850281018501909152818152600160a060020a039094169a5093945091929083018282801561077f5780601f106107545761010080835404028352916020019161077f565b820191906000526020600020905b81548152906001019060200180831161076257829003601f168201915b505050600280850154600386018054604080516020601f6000196101006001871615020190941696909604928301869004860281018601909152818152969b50919950935091508301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b60005433600160a060020a03908116911614610855576108aa565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b60006108bd858585853361092c565b90505b949350505050565b60005433600160a060020a039081169116146108e3576108aa565b60048190555b5b50565b60006003838154811015156108fe57fe5b906000526020600020906006020160005b506000838152600591909101602052604090205490505b92915050565b600060045434101561093d57610c5d565b600160a060020a03861660009081526001602052604090205486901561096257610c5b565b8551869060031461097257610c59565b866002816040518082805190602001908083835b602083106109a55780518252601f199092019160209182019101610986565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220541591506109df905057610c56565b60038054600181016109f183826112c8565b916000526020600020906006020160005b506040805160a081018252600160a060020a03808e1680835260208084018f90529383018d9052606083018c9052908a1660808301528354600160a060020a0319161783558b51909291610a5d9160018401918e01906112fa565b506040820151600282015560608201518051610a839160038401916020909101906112fa565b506080919091015160049091018054600160a060020a031916600160a060020a03928316179055600354908b1660009081526001602090815260409182902083905590518b519293506002928c928291908401908083835b60208310610afa5780518252601f199092019160209182019101610adb565b51815160001960209485036101000a81019182169119929092161790915293909101958652604051958690038101862096909655506003548d519101948d9493508392508401908083835b60208310610b645780518252601f199092019160209182019101610b45565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f25074d730da65a10e171fe5589d2182313ef00da38d23a9ae3b78923568bdf2d8b896040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360008314610c17575b805182526020831115610c1757601f199092019160209182019101610bf7565b505050905090810190601f168015610c435780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600193505b5b505b505b505b95945050505050565b600060006000610c746112b6565b6000600060016002886040518082805190602001908083835b60208310610cac5780518252601f199092019160209182019101610c8d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054039550600386815481101515610cf257fe5b906000526020600020906006020160005b5080546002808301546003840180546040805160206101006001851615026000190190931695909504601f8101839004830286018301909152808552600160a060020a039095169a50919850939450909291908301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b600054600160a060020a031681565b60005433600160a060020a03908116911614610df457610e28565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f193505050501515610e2857610000565b5b5b565b6003545b90565b60005433600160a060020a03908116911614610e4e576108aa565b80600382815481101515610e5e57fe5b906000526020600020906006020160005b506001016040518082805460018160011615610100020316600290048015610ece5780601f10610eac576101008083540402835291820191610ece565b820191906000526020600020905b815481529060010190602001808311610eba575b505060405190819003812092507f96e76fa77fea85d8abeb7533fdb8288c214bb1dcf1f867c8f36a95f1f509c1759150600090a360016000600383815481101515610f1557fe5b906000526020600020906006020160005b5054600160a060020a031681526020810191909152604001600090812055600380546002919083908110610f5657fe5b906000526020600020906006020160005b506001016040518082805460018160011615610100020316600290048015610fc65780601f10610fa4576101008083540402835291820191610fc6565b820191906000526020600020905b815481529060010190602001808311610fb2575b50509283525050604051908190036020019020600090556003805482908110610feb57fe5b906000526020600020906006020160005b8154600160a060020a0319168255611018600183016000611379565b60028201600090556003820160006110309190611379565b506004018054600160a060020a03191690555b5b50565b60006110516112b6565b600061105b6112b6565b600160a060020a03851660009081526001602052604081205460038054600019909201965082918790811061108c57fe5b906000526020600020906006020160005b509050806001018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561077f5780601f106107545761010080835404028352916020019161077f565b820191906000526020600020905b81548152906001019060200180831161076257829003601f168201915b505050600280850154600386018054604080516020601f6000196101006001871615020190941696909604928301869004860281018601909152818152969b50919950935091508301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b8233600160a060020a031660038281548110151561120d57fe5b906000526020600020906006020160005b5060040154600160a060020a031614611236576112a9565b8160038581548110151561124657fe5b906000526020600020906006020160005b50600085815260059190910160209081526040918290209290925580518481529051859287927f7991c63a749706fd298fc2387764d640be6e714307b6357b1d3c2ce35cba3b52929081900390910190a35b5b50505050565b60045481565b60408051602081019091526000815290565b8154818355818115116112f4576006028160060283600052602060002091820191016112f491906113c1565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061133b57805160ff1916838001178555611368565b82800160010185558215611368579182015b8281111561136857825182559160200191906001019061134d565b5b50611375929150611426565b5090565b50805460018160011615610100020316600290046000825580601f1061139f57506108aa565b601f0160209004906000526020600020908101906108aa9190611426565b5b50565b610e3091905b80821115611375578054600160a060020a031916815560006113ec6001830182611379565b60028201600090556003820160006114049190611379565b50600481018054600160a060020a03191690556006016113c7565b5090565b90565b610e3091905b80821115611375576000815560010161142c565b5090565b905600a165627a7a72305820ab1d1a18270ba278cc2f74cd1b7b547cdcd6308a9df1dec1120fa9f6199b1f480029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/verifyEmail.json b/js/src/dapps/chaindeploy/contracts/code/verifyEmail.json new file mode 100644 index 000000000..fff3fb07d --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/verifyEmail.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/e5afdacc716ca743ceddf80978d4e6b2b465dbe9/ProofOfEmail.sol", + "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600355341561002a57fe5b5b6108a48061003a6000396000f300606060405236156100ca5763ffffffff60e060020a60003504166306b2ff4781146100cc57806313af4035146100fc5780632650b9881461011a5780634b59e8801461018c57806359c87d70146101b05780636795dbcd146101bd57806369fe0e2d1461023057806370c4d5f214610245578063797af627146103255780638da5cb5b1461034c5780639890220b14610378578063ac72c1201461038a578063cc1d4c02146103b1578063ddca3f43146103e1578063df57b74214610403578063e30bd74014610432575bfe5b34156100d457fe5b6100e8600160a060020a03600435166104ce565b604080519115158252519081900360200190f35b341561010457fe5b610118600160a060020a03600435166104d6565b005b341561012257fe5b60408051602060046024803582810135601f810185900485028601850190965285855261017a958335600160a060020a0316959394604494939290920191819084018382808284375094965061055795505050505050565b60408051918252519081900360200190f35b341561019457fe5b610118600160a060020a0360043516602435604435610577565b005b6101186004356105eb565b005b34156101c557fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610214958335959394604494939290920191819084018382808284375094965061063595505050505050565b60408051600160a060020a039092168252519081900360200190f35b341561023857fe5b610118600435610654565b005b341561024d57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102a5958335600160a060020a0316959394604494939290920191819084018382808284375094965061067995505050505050565b6040805160208082528351818301528351919283929083019185019080838382156102eb575b8051825260208311156102eb57601f1990920191602091820191016102cb565b505050905090810190601f1680156103175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032d57fe5b6100e8600435610688565b604080519115158252519081900360200190f35b341561035457fe5b610214610791565b60408051600160a060020a039092168252519081900360200190f35b341561038057fe5b6101186107a0565b005b341561039257fe5b6100e86004356107f3565b604080519115158252519081900360200190f35b34156103b957fe5b6100e8600160a060020a0360043516610813565b604080519115158252519081900360200190f35b34156103e957fe5b61017a610834565b60408051918252519081900360200190f35b341561040b57fe5b61021460043561083a565b60408051600160a060020a039092168252519081900360200190f35b341561043a57fe5b6102a5600160a060020a0360043516610858565b6040805160208082528351818301528351919283929083019185019080838382156102eb575b8051825260208311156102eb57601f1990920191602091820191016102cb565b505050905090810190601f1680156103175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005b919050565b60005433600160a060020a039081169116146104f157610553565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600260205260409020545b92915050565b60005433600160a060020a03908116911614610592576105e5565b600082815260046020908152604091829020839055815184815291518392600160a060020a038716927f76babef7e9f1065118be3f9d7094016a1cc06dd12811501c7712deb22144f37b92918290030190a35b5b505050565b6003543410156105fa57610553565b6040518190600160a060020a033316907f070669e6be82aa9b077a096b0f9617893a4dc5cb05897e27fd7a6112c8e6629e90600090a35b5b50565b600082815260016020526040902054600160a060020a03165b92915050565b60005433600160a060020a0390811691161461066f57610553565b60038190555b5b50565b610571610866565b5b92915050565b6040805182815281516020918190038201902060009081526004909152908120548015156106b55761078b565b6040805184815281516020918190038201902060009081526004825282812081905583815260019091522054600160a060020a031615158061070e5750600160a060020a03331660009081526002602052604090205415155b156107185761078b565b6000818152600160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031690811790915580845260029092528083208490555190917fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f91a2600191505b50919050565b600054600160a060020a031681565b60005433600160a060020a039081169116146107bb576107ef565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156107ef57610000565b5b5b565b600081815260016020526040902054600160a060020a031615155b919050565b600160a060020a03811660009081526002602052604090205415155b919050565b60035481565b600081815260016020526040902054600160a060020a03165b919050565b6104d1610866565b5b919050565b604080516020810190915260008152905600a165627a7a7230582081d03388dd06c78ee4098c4f1e23cd3c25e38d249d5da59962c6b28ec6e20ea70029" +} diff --git a/js/src/dapps/chaindeploy/contracts/code/verifySms.json b/js/src/dapps/chaindeploy/contracts/code/verifySms.json new file mode 100644 index 000000000..79b9c0459 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/code/verifySms.json @@ -0,0 +1,5 @@ +{ + "compiler": "v0.4.9+commit.364da425", + "source": "https://github.com/ethcore/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/SMSVerification.sol", + "output": "0x606060405260008054600160a060020a033316600160a060020a03199182168117909255600280549091169091179055666a94d74f430000600455341561004257fe5b5b6109a0806100526000396000f300606060405236156100ca5763ffffffff60e060020a60003504166313af403581146100cc57806314253887146100ea578063338cdca1146101085780633da5c3ce146101125780635283f3391461013357806369fe0e2d146101af57806374a8f103146101c4578063797af627146101e25780638da5cb5b146102095780639890220b14610235578063c89e436114610247578063ca4cbf6714610273578063ca5eb5e1146102e5578063cc1d4c0214610303578063ddca3f4314610333578063fc2525ab14610273575bfe5b34156100d457fe5b6100e8600160a060020a03600435166103c7565b005b34156100f257fe5b6100e8600160a060020a0360043516610448565b005b6100e86104b4565b005b341561011a57fe5b6100e8600160a060020a0360043516602435610521565b005b341561013b57fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610193958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051600160a060020a039092168252519081900360200190f35b34156101b757fe5b6100e8600435610623565b005b34156101cc57fe5b6100e8600160a060020a0360043516610648565b005b34156101ea57fe5b6101f56004356106d9565b604080519115158252519081900360200190f35b341561021157fe5b610193610771565b60408051600160a060020a039092168252519081900360200190f35b341561023d57fe5b6100e8610780565b005b341561024f57fe5b6101936107d3565b60408051600160a060020a039092168252519081900360200190f35b341561027b57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102d3958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051918252519081900360200190f35b34156102ed57fe5b6100e8600160a060020a0360043516610873565b005b341561030b57fe5b6101f5600160a060020a03600435166108bb565b604080519115158252519081900360200190f35b341561033b57fe5b6102d36108dd565b60408051918252519081900360200190f35b341561027b57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102d3958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051918252519081900360200190f35b60005433600160a060020a039081169116146103e257610444565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60025433600160a060020a0390811691161461046357610444565b600160a060020a0381166000818152600160208190526040808320805460ff1916909217909155517fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f9190a25b5b50565b6004543410156104c35761051e565b600160a060020a03331660009081526001602052604090205460ff16156104e95761051e565b604051600160a060020a033316907f039f711c9c18dd815b225b1424855e6118e746c6b5d688907f10c4dd29ebe92a90600090a25b5b565b60025433600160a060020a0390811691161461053c5761058d565b600160a060020a038216600081815260036020908152604091829020849055815184815291517fa9a343b39eac85ffb326e93ecd46785b814e72dc9f2b33bb0b4a315ba2859f439281900390910190a25b5b5050565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60005433600160a060020a0390811691161461063e57610444565b60048190555b5b50565b60025433600160a060020a0390811691161461066357610444565b600160a060020a038116600090815260016020526040902054819060ff16151561068c5761058d565b600160a060020a038216600081815260016020526040808220805460ff19169055517fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e749190a25b5b505b50565b6040805182815281516020918190038201902033600160a060020a031660009081526003909252918120549091146107105761076c565b600160a060020a0333166000818152600360209081526040808320839055600191829052808320805460ff1916909217909155517fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f9190a25060015b919050565b600054600160a060020a031681565b60005433600160a060020a0390811691161461079b5761051e565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f19350505050151561051e57610000565b5b5b565b600254600160a060020a031681565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60005433600160a060020a0390811691161461088e57610444565b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a03811660009081526001602052604090205460ff165b919050565b60045481565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b929150505600a165627a7a72305820f6beb9c0ae3b45609ad6fc26c1b74600cbaa5f0088ca07be3e9c392a12b2c6150029" +} diff --git a/js/src/dapps/chaindeploy/contracts/dappreg.js b/js/src/dapps/chaindeploy/contracts/dappreg.js new file mode 100644 index 000000000..71379bf8b --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/dappreg.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/dappreg'; +import { compiler, source as sourceUrl, output as byteCode } from './code/dappreg'; + +const id = 'dappreg'; // 7bbc4f1a27628781b96213e781a1b8eec6982c1db8fac739af6e4c5a55862c03 +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/gavcoin.js b/js/src/dapps/chaindeploy/contracts/gavcoin.js new file mode 100644 index 000000000..f7518ef53 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/gavcoin.js @@ -0,0 +1,32 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/gavcoin'; +import { compiler, source as sourceUrl, output as byteCode } from './code/gavcoin'; + +const isExternal = true; +const id = 'gavcoin'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + isExternal, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/githubhint.js b/js/src/dapps/chaindeploy/contracts/githubhint.js new file mode 100644 index 000000000..5198e38b5 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/githubhint.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/githubhint'; +import { compiler, source as sourceUrl, output as byteCode } from './code/githubhint'; + +const id = 'githubhint'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/index.js b/js/src/dapps/chaindeploy/contracts/index.js new file mode 100644 index 000000000..5e066f758 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/index.js @@ -0,0 +1,52 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import * as badgereg from './badgereg'; +import * as dappreg from './dappreg'; +import * as gavcoin from './gavcoin'; +import * as githubhint from './githubhint'; +import * as jgvoting from './jg-voting'; +import * as registry from './registry'; +import * as signaturereg from './signaturereg'; +import * as tokendeployMgr from './tokendeployMgr'; +import * as tokendeployReg from './tokendeployReg'; +import * as tokenreg from './tokenreg'; +import * as verifyEmail from './verifyEmail'; +import * as verifySms from './verifySms'; +import * as wallet from './wallet'; + +const contracts = [ + // builtin + githubhint, + badgereg, + dappreg, + signaturereg, + tokenreg, + tokendeployReg, + tokendeployMgr, + verifyEmail, + verifySms, + wallet, + + // external + gavcoin, + jgvoting +]; + +export { + contracts, + registry +}; diff --git a/js/src/dapps/chaindeploy/contracts/jg-voting.js b/js/src/dapps/chaindeploy/contracts/jg-voting.js new file mode 100644 index 000000000..8ffbed3c5 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/jg-voting.js @@ -0,0 +1,32 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from './abi/jg-voting'; +import { compiler, source as sourceUrl, output as byteCode } from './code/jg-voting'; + +const isExternal = true; +const id = 'jg-voting'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + isExternal, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/registry.js b/js/src/dapps/chaindeploy/contracts/registry.js new file mode 100644 index 000000000..1b44f4245 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/registry.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/registry2'; +import { compiler, source as sourceUrl, output as byteCode } from './code/registry'; + +const id = 'registry'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/signaturereg.js b/js/src/dapps/chaindeploy/contracts/signaturereg.js new file mode 100644 index 000000000..6d9f9bf60 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/signaturereg.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/signaturereg'; +import { compiler, source as sourceUrl, output as byteCode } from './code/signaturereg'; + +const id = 'signaturereg'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/tokendeployMgr.js b/js/src/dapps/chaindeploy/contracts/tokendeployMgr.js new file mode 100644 index 000000000..d07435fdd --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/tokendeployMgr.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/basiccoinmanager'; +import { compiler, source as sourceUrl, output as byteCode } from './code/tokendeploy'; + +const id = 'basiccoinmgr'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/tokendeployReg.js b/js/src/dapps/chaindeploy/contracts/tokendeployReg.js new file mode 100644 index 000000000..1db07e91a --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/tokendeployReg.js @@ -0,0 +1,28 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { abi, sourceUrl, deployParams, compiler, byteCode } from './tokenreg'; + +const id = 'basiccoinreg'; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/tokenreg.js b/js/src/dapps/chaindeploy/contracts/tokenreg.js new file mode 100644 index 000000000..11ee29fa1 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/tokenreg.js @@ -0,0 +1,30 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/tokenreg'; +import { compiler, source as sourceUrl, output as byteCode } from './code/tokenreg'; + +const id = 'tokenreg'; +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/verifyEmail.js b/js/src/dapps/chaindeploy/contracts/verifyEmail.js new file mode 100644 index 000000000..d011f4c51 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/verifyEmail.js @@ -0,0 +1,37 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/email-verification'; +import { compiler, source as sourceUrl, output as byteCode } from './code/verifyEmail'; + +const isBadge = true; +const id = 'emailverification'; +const deployParams = []; +const badgeSource = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/c4721a87cb95375da91f8699438d8d7907b3f5e9/certifications/email-verification.svg', + imageHash: '0x5617a14da2a0c210939da6eafb734e60906f64a504c3e107812668860a752dc6' +}; + +export { + abi, + badgeSource, + byteCode, + compiler, + deployParams, + id, + isBadge, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/verifySms.js b/js/src/dapps/chaindeploy/contracts/verifySms.js new file mode 100644 index 000000000..59bf1ba36 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/verifySms.js @@ -0,0 +1,37 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import abi from '~/contracts/abi/sms-verification'; +import { compiler, source as sourceUrl, output as byteCode } from './code/verifySms'; + +const isBadge = true; +const id = 'smsverification'; +const deployParams = []; +const badgeSource = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/1b1beb57ab1f4d3a93a12711b233b5cded791a2f/certifications/sms-verification.svg', + imageHash: '0x49fa653c35c0a9ce128579883babd673ad4cfc94bf9f1cfe96a2bbc30a7552c6' +}; + +export { + abi, + badgeSource, + byteCode, + compiler, + deployParams, + id, + isBadge, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/contracts/wallet.js b/js/src/dapps/chaindeploy/contracts/wallet.js new file mode 100644 index 000000000..6639cba80 --- /dev/null +++ b/js/src/dapps/chaindeploy/contracts/wallet.js @@ -0,0 +1,29 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { walletCompiler as compiler, walletLibrary as byteCode, walletLibraryABI as abiJson, walletLibraryRegKey as id, walletSource as sourceUrl } from '~/contracts/code/wallet'; + +const abi = JSON.parse(abiJson); +const deployParams = []; + +export { + abi, + byteCode, + compiler, + deployParams, + id, + sourceUrl +}; diff --git a/js/src/dapps/chaindeploy/dapps/console.js b/js/src/dapps/chaindeploy/dapps/console.js new file mode 100644 index 000000000..f67165502 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/console.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'console'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/console/3ea0dbfefded359ccdbea37bc4cf350c0aa16948/console.jpeg', + imageHash: '0xc3962e2eab7afaeb9cd11522381723afbafdc41dc7ba31bee472e187c4459e81' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/dappreg.js b/js/src/dapps/chaindeploy/dapps/dappreg.js new file mode 100644 index 000000000..a9baae82a --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/dappreg.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'dappreg'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/legos-64x64.png', + imageHash: '0xa8feea35c761cc6c2fe862fe336419f11ca5421f578757720a899b89fc1df154' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/gavcoin.js b/js/src/dapps/chaindeploy/dapps/gavcoin.js new file mode 100644 index 000000000..6fd8b1d86 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/gavcoin.js @@ -0,0 +1,41 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { api } from '../parity'; + +const isExternal = true; +const id = 'gavcoin'; +const hashId = api.util.sha3(id); +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/9e135f76fe9ba61e2d8ccbd72ed144c26c450780/tokens/gavcoin-64x64.png', + imageHash: '0xd40679a3a234d8421c678d64f4df3308859e8ad07ac95ce4a228aceb96955287', + manifestUrl: 'https://raw.githubusercontent.com/gavofyork/gavcoin/eb2f8dc4d3ad4dd5f4562690525b7cfedc9681ba/manifest.json', + manifestHash: '0xd582c572fbef8015837f2c1a8798f2c3149a1d9d655b4020edb1bbece725371d', + contentUrl: { + repo: 'gavofyork/gavcoin', + commit: '0xeb2f8dc4d3ad4dd5f4562690525b7cfedc9681ba' + }, + contentHash: '0x0b6c7b3fc8dad3edb39fd1465904ce9a11938ef18f08f8115f275047ba249530' +}; +const name = 'GavCoin'; + +export { + hashId, + id, + isExternal, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/githubhint.js b/js/src/dapps/chaindeploy/dapps/githubhint.js new file mode 100644 index 000000000..d723cb61c --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/githubhint.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'githubhint'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/link-64x64.jpg', + imageHash: '0x6568901e711886e2c61eef1bbc7e2d8d37a27b9eb3e9e270eda8548f2ec796e8' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/ethcore/src/trace/error.rs b/js/src/dapps/chaindeploy/dapps/index.js similarity index 50% rename from ethcore/src/trace/error.rs rename to js/src/dapps/chaindeploy/dapps/index.js index 081045d85..e95bf5648 100644 --- a/ethcore/src/trace/error.rs +++ b/js/src/dapps/chaindeploy/dapps/index.js @@ -14,28 +14,37 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -//! `TraceDB` errors. +import * as consolejs from './console'; +import * as dappreg from './dappreg'; +import * as gavcoin from './gavcoin'; +import * as githubhint from './githubhint'; +import * as jgvoting from './jg-voting'; +import * as jgwhenblock from './jg-whenblock'; +import * as localtx from './localtx'; +import * as registry from './registry'; +import * as signaturereg from './signaturereg'; +import * as tokendeploy from './tokendeploy'; +import * as tokenreg from './tokenreg'; +import * as web from './web'; -use std::fmt::{Display, Formatter, Error as FmtError}; +const apps = [ + // builtin + consolejs, + dappreg, + githubhint, + localtx, + registry, + signaturereg, + tokendeploy, + tokenreg, + web, -const RESYNC_ERR: &'static str = -"Your current parity installation has synced without transaction tracing. -To use Parity with transaction tracing, you'll need to resync with tracing. -To do this, remove or move away your current database and restart parity. e.g.: + // external + gavcoin, + jgvoting, + jgwhenblock +]; -> mv ~/.parity/906a34e69aec8c0d /tmp -> parity"; - -/// `TraceDB` errors. -#[derive(Debug)] -pub enum Error { - /// Returned when tracing is enabled, - /// but database does not contain traces of old transactions. - ResyncRequired, -} - -impl Display for Error { - fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> { - write!(f, "{}", RESYNC_ERR) - } -} +export { + apps +}; diff --git a/js/src/dapps/chaindeploy/dapps/jg-voting.js b/js/src/dapps/chaindeploy/dapps/jg-voting.js new file mode 100644 index 000000000..899e95894 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/jg-voting.js @@ -0,0 +1,41 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { api } from '../parity'; + +const isExternal = true; +const id = 'jg-voting'; +const hashId = api.util.sha3(id); +const source = { + imageUrl: 'https://raw.githubusercontent.com/jacogr/dapp-voting/038ff4074544f2babc7aed9c4ac3dc070b85b804/assets/images/vote.jpg', + imageHash: '0x3620828e1a745d2714e9f37dc2d47cdab5ef9982190a845b5e7665b7a7767661', + manifestUrl: 'https://raw.githubusercontent.com/jacogr/dapp-voting/682f0fe4b86508a1a2487de6c7c61f7b100ba5b2/manifest.json', + manifestHash: '0x9b83e01f87d225e7bfdd305c51319504ff9b4cf8d517ca4b64f606762e72f59e', + contentUrl: { + repo: 'jacogr/dapp-voting', + commit: '0x7d941597e862a600a60b9d6ecd3a6f606d96cd7b' + }, + contentHash: '0x9fcc0910f6a8c4e45715d41aea2d287da31bf1d7321003fc66df6a012ce2d753' +}; +const name = 'Yes, No, Maybe'; + +export { + hashId, + id, + isExternal, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/jg-whenblock.js b/js/src/dapps/chaindeploy/dapps/jg-whenblock.js new file mode 100644 index 000000000..0005ca454 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/jg-whenblock.js @@ -0,0 +1,39 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +const isExternal = true; +const id = 'whenarewethere'; +const hashId = '0xfef3bfded03695e38a9ff476a0999e1fa421e72d1fb3b55a87d6c2bdb6fc18ef'; +const source = { + imageUrl: 'https://raw.githubusercontent.com/jacogr/dapp-when-are-we-there/167aa4d904c5aa6246d0d6d6f41c4ed8a56889cd/assets/images/clock.jpg', + imageHash: '0x2534b44f685b6399bf63f86679128216c43e9a58be1dfb58533923f0bcffeba7', + manifestUrl: 'https://raw.githubusercontent.com/jacogr/dapp-when-are-we-there/bf72dc3033711a3ab41bec3c1249638f70bae768/manifest.json', + manifestHash: '0xfe26f6a19ea9393d69bc5d8c73c5072ccf126f51c10c135b42d6bf162d774fd9', + contentUrl: { + repo: 'jacogr/dapp-when-are-we-there', + commit: '0xbf72dc3033711a3ab41bec3c1249638f70bae768' + }, + contentHash: '0x3505cbbef5c2243eedba07d340d4abccfaa3cfb799f51827e33c9721a5254d13' +}; +const name = 'When are we there'; + +export { + hashId, + id, + isExternal, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/localtx.js b/js/src/dapps/chaindeploy/dapps/localtx.js new file mode 100644 index 000000000..e6dd59fbe --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/localtx.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'localtx'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/stack-64x64.png', + imageHash: '0x22b924801e1971659a51956dcdfc5a2d592d8bdd03780dd72d5bc4c84b595b4c' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/registry.js b/js/src/dapps/chaindeploy/dapps/registry.js new file mode 100644 index 000000000..d6addaaac --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/registry.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'registry'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/register-64x64.jpg', + imageHash: '0xf7100024052cd78b5e043287c05392b5db0bfce5caedd6d39555d40283ef0a1c' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/signaturereg.js b/js/src/dapps/chaindeploy/dapps/signaturereg.js new file mode 100644 index 000000000..3ce1442c3 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/signaturereg.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'signaturereg'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/hex-64x64.jpg', + imageHash: '0x26f7f2415cd5cbbffa58e8119fdbdd7181cac79119dd7f6ba6ee99d7f4445640' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/tokendeploy.js b/js/src/dapps/chaindeploy/dapps/tokendeploy.js new file mode 100644 index 000000000..5f15bd903 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/tokendeploy.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'tokendeploy'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/interlock-64x64.png', + imageHash: '0xde104baf02aec783e0bffc624514ee267dbcb455382375e3ffa715790c1c939f' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/tokenreg.js b/js/src/dapps/chaindeploy/dapps/tokenreg.js new file mode 100644 index 000000000..0e59f004e --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/tokenreg.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'tokenreg'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/coins-64x64.jpg', + imageHash: '0xe23d429d15de98c7878d92bc90b79c7afabe1b04c2ad5e3e2c89adc8f439edc9' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/dapps/web.js b/js/src/dapps/chaindeploy/dapps/web.js new file mode 100644 index 000000000..c8d45cb32 --- /dev/null +++ b/js/src/dapps/chaindeploy/dapps/web.js @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import builtins from '~/views/Dapps/builtin.json'; + +const id = 'web'; +const app = builtins.find((app) => app.url === id); +const hashId = app.id; +const source = { + imageUrl: 'https://raw.githubusercontent.com/ethcore/dapp-assets/ec6138115d0e1f45258969cd90b3b274e0ff2258/dapps/earth-64x64.jpg', + imageHash: '0x0b9b62a9262f75461191d4e8bf686c56528cbc0fe885c1f5878052ca8b2f65bf' +}; +const name = app.name; + +export { + hashId, + id, + name, + source +}; diff --git a/js/src/dapps/chaindeploy/parity.js b/js/src/dapps/chaindeploy/parity.js new file mode 100644 index 000000000..1dea0d696 --- /dev/null +++ b/js/src/dapps/chaindeploy/parity.js @@ -0,0 +1,21 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +const api = window.parity.api; + +export { + api +}; diff --git a/js/src/dapps/chaindeploy/store.js b/js/src/dapps/chaindeploy/store.js new file mode 100644 index 000000000..07b693135 --- /dev/null +++ b/js/src/dapps/chaindeploy/store.js @@ -0,0 +1,714 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { action, computed, observable } from 'mobx'; + +import { contracts as contractsInfo, registry as registryInfo } from './contracts'; +import { apps } from './dapps'; +import { api } from './parity'; +import { executeContract, isValidNumber, validateCode } from './utils'; + +export default class ContractsStore { + @observable apps = null; + @observable badges = null; + @observable contracts = null; + @observable error = null; + @observable registry = null; + + constructor () { + this.apps = apps; + this.badges = contractsInfo.filter((contract) => contract.isBadge); + this.contracts = contractsInfo.filter((contract) => !contract.isBadge); + this.registry = registryInfo; + + api.subscribe('eth_blockNumber', this.onNewBlockNumber); + } + + @computed get contractBadgereg () { + return this.contracts.find((contract) => contract.id === 'badgereg'); + } + + @computed get contractDappreg () { + return this.contracts.find((contract) => contract.id === 'dappreg'); + } + + @computed get contractGithubhint () { + return this.contracts.find((contract) => contract.id === 'githubhint'); + } + + @computed get contractTokenreg () { + return this.contracts.find((contract) => contract.id === 'tokenreg'); + } + + @computed get isBadgeDeploying () { + return this.badges + .filter((contract) => contract.isDeploying) + .length !== 0; + } + + @computed get isContractDeploying () { + return this.contracts + .filter((contract) => contract.isDeploying) + .length !== 0; + } + + @computed get isDappDeploying () { + return this.apps + .filter((app) => app.isDeploying) + .length !== 0; + } + + @computed get haveAllBadges () { + return this.badges + .filter((contract) => !contract.instance || !contract.hasLatestCode || !contract.badgeImageHash || !contract.badgeImageMatch || !contract.isBadgeRegistered) + .length === 0; + } + + @computed get haveAllContracts () { + return this.contracts + .filter((contract) => !contract.instance || !contract.hasLatestCode) + .length === 0; + } + + @computed get haveAllDapps () { + return this.apps + .filter((app) => { + return !app.isOnChain || + !app.imageHash || !app.imageMatch || + (app.source.contentHash && !app.contentMatch) || + (app.source.manifestHash && !app.manifestMatch); + }) + .length === 0; + } + + @action refreshApps = () => { + this.apps = [].concat(this.apps.peek()); + } + + @action refreshContracts = () => { + this.badges = [].concat(this.badges.peek()); + this.contracts = [].concat(this.contracts.peek()); + } + + @action setError = (error) => { + console.error(error); + + this.error = error.message + ? error.message + : error; + } + + @action setRegistryAddress = (address, isOnChain = false) => { + if (this.registry.address !== address || !this.registry.instance) { + console.log(`registry found at ${address}`); + + this.registry = Object.assign({}, this.registry, { + address, + instance: api.newContract(this.registry.abi, address).instance, + isOnChain + }); + } + } + + @action setRegistryCode (byteCode) { + this.registry.hasLatestCode = validateCode(this.registry.byteCode, byteCode); + } + + @action setRegistryDeploying = (isDeploying = false) => { + this.registry = Object.assign({}, this.registry, { + isDeploying, + status: isDeploying + ? 'Deploying contract' + : null + }); + } + + @action setBadgeId = (badge, badgeId) => { + badge.badgeId = badgeId; + badge.isBadgeRegistered = true; + + this.refreshContracts(); + } + + @action setBadgeImageHash = (badge, imageHash) => { + badge.badgeImageHash = imageHash; + badge.badgeImageMatch = badge.badgeSource.imageHash === imageHash; + + this.refreshContracts(); + } + + @action setContractAddress = (contract, address, isOnChain = false) => { + if (contract.address !== address || !contract.instance || contract.isOnChain !== isOnChain) { + console.log(`${contract.id} found at ${address}`); + + contract.address = address; + contract.instance = api.newContract(contract.abi, address).instance; + contract.isOnChain = isOnChain; + + this.refreshContracts(); + } + } + + @action setContractCode (contract, byteCode) { + contract.hasLatestCode = validateCode(contract.byteCode, byteCode); + + this.refreshContracts(); + } + + @action setContractDeploying = (contract, isDeploying = false) => { + contract.isDeploying = isDeploying; + contract.status = isDeploying + ? 'Deploying contract' + : null; + + this.refreshContracts(); + } + + @action setContractStatus = (contract, status) => { + contract.status = status; + + this.refreshContracts(); + } + + @action setAppDeploying = (app, isDeploying = false) => { + app.isDeploying = isDeploying; + app.status = isDeploying + ? 'Registering app' + : null; + + this.refreshApps(); + } + + @action setAppFound = (app, isOnChain = false) => { + if (app.isOnChain !== isOnChain) { + console.log(`${app.name} found on dappreg`); + + app.isOnChain = isOnChain; + + this.refreshApps(); + } + } + + @action setAppContentHash = (app, contentHash) => { + if (app.contentHash !== contentHash) { + console.log(`${app.name} has contentHash ${contentHash}`); + + app.contentHash = contentHash; + app.contentMatch = contentHash === app.source.contentHash; + + this.refreshApps(); + } + } + + @action setAppImageHash = (app, imageHash) => { + if (app.imageHash !== imageHash) { + console.log(`${app.name} has imageHash ${imageHash}`); + + app.imageHash = imageHash; + app.imageMatch = imageHash === app.source.imageHash; + + this.refreshApps(); + } + } + + @action setAppManifestHash = (app, manifestHash) => { + if (app.manifestHash !== manifestHash) { + console.log(`${app.name} has manifestHash ${manifestHash}`); + + app.manifestHash = manifestHash; + app.manifestMatch = manifestHash === app.source.manifestHash; + + this.refreshApps(); + } + } + + @action setAppStatus = (app, status) => { + console.log(app.id, status); + + app.status = status; + + this.refreshApps(); + } + + deployApp = (app) => { + console.log(`Registering application ${app.id}`); + + this.setAppDeploying(app, true); + + const options = {}; + const values = [app.hashId]; + + return api.parity + .defaultAccount() + .then((defaultAccount) => { + options.from = defaultAccount; + + if (app.isOnChain) { + return true; + } + + return this.contractDappreg.instance + .fee.call({}, []) + .then((fee) => { + options.value = fee; + + return executeContract(app.id, this.contractDappreg, 'register', options, values); + }); + }) + .then(() => { + if (app.imageHash && app.imageMatch) { + return true; + } + + this.setAppStatus(app, 'Registering image url'); + + return this + .registerHash(app.source.imageHash, app.source.imageUrl, options.from) + .then(() => this.setAppMeta(app, 'IMG', app.source.imageHash, options.from)); + }) + .then(() => { + if (!app.source.manifestHash || app.manifestMatch) { + return true; + } + + this.setAppStatus(app, 'Registering manifest url'); + + return this + .registerHash(app.source.manifestHash, app.source.manifestUrl, options.from) + .then(() => this.setAppMeta(app, 'MANIFEST', app.source.manifestHash, options.from)); + }) + .then(() => { + if (!app.source.contentHash || app.contentMatch) { + return true; + } + + this.setAppStatus(app, 'Registering content url'); + + return this + .registerRepo(app.source.contentHash, app.source.contentUrl, options.from) + .then(() => this.setAppMeta(app, 'CONTENT', app.source.contentHash, options.from)); + }) + .catch(() => { + return null; + }) + .then(() => { + this.setAppDeploying(app, false); + }); + } + + deployApps = () => { + this.apps + .filter((app) => { + return !app.isDeploying && + ( + !app.isOnChain || + (!app.imageHash || !app.imageMatch) || + (app.source.contentHash && !app.contentMatch) || + (app.source.manifestHash && !app.manifestMatch) + ); + }) + .forEach(this.deployApp); + } + + _deployContract = (contract) => { + console.log(`Deploying contract ${contract.id}`); + + const options = { + data: contract.byteCode + }; + + return api.parity + .defaultAccount() + .then((defaultAccount) => { + options.from = defaultAccount; + + return api + .newContract(contract.abi) + .deploy(options, contract.deployParams, (error, data) => { + if (error) { + console.error(contract.id, error); + } else { + console.log(contract.id, data); + } + }) + .then((contractAddress) => { + return [contractAddress, defaultAccount]; + }); + }); + } + + deployContract = (contract) => { + if (contract.hasLatestCode) { + return Promise.resolve(false); + } + + let defaultAccount = '0x0'; + + this.setContractDeploying(contract, true); + + return this + ._deployContract(contract) + .then(([address, _defaultAccount]) => { + const isOnChain = contract.isOnChain; + + defaultAccount = _defaultAccount; + + this.setContractAddress(contract, address); + + return isOnChain + ? true + : this.reserveAddress(contract, defaultAccount); + }) + .then(() => { + return this.registerAddress(contract, defaultAccount); + }) + .catch(() => { + return null; + }) + .then(() => { + this.setContractDeploying(contract, false); + }); + } + + deployBadge = (badge) => { + let defaultAccount; + + return this + .deployContract(badge) + .then(() => { + this.setContractDeploying(badge, true); + + return api.parity.defaultAccount(); + }) + .then((_defaultAccount) => { + defaultAccount = _defaultAccount; + + if (badge.isBadgeRegistered) { + return true; + } + + this.setContractStatus(badge, 'Registering with badgereg'); + + return this.registerBadge(badge, defaultAccount); + }) + .then(() => { + if (badge.badgeImageMatch) { + return true; + } + + this.setContractStatus(badge, 'Registering image url'); + + return this + .registerHash(badge.badgeSource.imageHash, badge.badgeSource.imageUrl, defaultAccount) + .then(() => this.registerBadgeImage(badge, badge.badgeSource.imageHash, defaultAccount)); + }) + .then(() => { + this.setContractDeploying(badge, false); + }); + } + + deployContracts = () => { + this.contracts + .filter((contract) => !contract.isDeploying && (!contract.instance || !contract.hasLatestCode)) + .forEach(this.deployContract); + } + + deployBadges = () => { + this.badges + .filter((contract) => !contract.isDeploying && (!contract.instance || !contract.hasLatestCode || !contract.badgeImageHash || !contract.badgeImageMatch || !contract.isBadgeRegistered)) + .forEach(this.deployBadge); + } + + deployRegistry = () => { + this.setRegistryDeploying(true); + + return this + ._deployContract(this.registry) + .then(([address]) => { + this.setRegistryDeploying(false); + this.setRegistryAddress(address); + }); + } + + registerBadge = (badge, fromAddress) => { + const options = { + from: fromAddress + }; + const values = [badge.address, api.util.sha3.text(badge.id.toLowerCase())]; + + return this.contractBadgereg.instance + .fee.call({}, []) + .then((fee) => { + options.value = fee; + + return executeContract(badge.id, this.contractBadgereg, 'register', options, values); + }); + } + + registerBadgeImage = (badge, hash, fromAddress) => { + const options = { + from: fromAddress + }; + const values = [badge.badgeId, 'IMG', hash]; + + this.setContractStatus(badge, 'Setting meta IMG'); + + return executeContract(badge.id, this.contractBadgereg, 'setMeta', options, values); + } + + setAppMeta = (app, key, meta, fromAddress) => { + const options = { + from: fromAddress + }; + const values = [app.hashId, key, meta]; + + this.setAppStatus(app, `Setting meta ${key}`); + + return executeContract(app.id, this.contractDappreg, 'setMeta', options, values); + } + + reserveAddress = (contract, fromAddress) => { + const options = { from: fromAddress }; + const values = [api.util.sha3.text(contract.id.toLowerCase())]; + + this.setContractStatus(contract, 'Reserving name'); + + return this.registry.instance + .fee.call({}, []) + .then((value) => { + options.value = value; + + return executeContract(contract.id, this.registry, 'reserve', options, values); + }); + } + + registerAddress = (contract, fromAddress) => { + const options = { from: fromAddress }; + const values = [api.util.sha3.text(contract.id.toLowerCase()), 'A', contract.address]; + + this.setContractStatus(contract, 'Setting lookup address'); + + return executeContract(contract.id, this.registry, 'setAddress', options, values); + } + + registerRepo = (hash, content, fromAddress) => { + const options = { + from: fromAddress + }; + const values = [hash, content.repo || content, content.commit || 0]; + + return this.contractGithubhint.instance + .entries.call({}, [hash]) + .then(([imageUrl, commit, owner]) => { + if (isValidNumber(owner)) { + return true; + } + + return executeContract(hash, this.contractGithubhint, 'hint', options, values); + }) + .catch(() => false); + } + + registerHash = (hash, url, fromAddress) => { + const options = { + from: fromAddress + }; + const values = [hash, url]; + + return this.contractGithubhint.instance + .entries.call({}, [hash]) + .then(([imageUrl, commit, owner]) => { + if (isValidNumber(owner)) { + return true; + } + + return executeContract(hash, this.contractGithubhint, 'hintURL', options, values); + }) + .catch(() => false); + } + + findRegistry = () => { + if (this.registry.address && this.registry.hasLatestCode) { + return Promise.resolve(this.registry); + } + + return api.parity + .registryAddress() + .then((address) => { + if (isValidNumber(address)) { + this.setRegistryAddress(address, true); + } + + return api.eth.getCode(address); + }) + .then((byteCode) => { + this.setRegistryCode(byteCode); + }); + } + + findApps = () => { + if (!this.contractDappreg.instance) { + return Promise.resolve(false); + } + + return Promise + .all( + this.apps.map((app) => { + return app.isOnChain + ? Promise.resolve([[0]]) + : this.contractDappreg.instance.get.call({}, [app.hashId]); + }) + ) + .then((apps) => { + apps.forEach(([_id, owner], index) => { + const id = api.util.bytesToHex(_id); + + if (isValidNumber(id)) { + this.setAppFound(this.apps[index], true); + } + }); + + return Promise.all( + this.apps.map((app) => { + return !app.isOnChain || (app.imageHash && app.imageMatch) + ? Promise.resolve([[0], [0], [0]]) + : Promise.all([ + this.contractDappreg.instance.meta.call({}, [app.hashId, 'CONTENT']), + this.contractDappreg.instance.meta.call({}, [app.hashId, 'IMG']), + this.contractDappreg.instance.meta.call({}, [app.hashId, 'MANIFEST']) + ]); + }) + ); + }) + .then((hashes) => { + hashes.forEach(([content, image, manifest], index) => { + const contentHash = api.util.bytesToHex(content); + const imageHash = api.util.bytesToHex(image); + const manifestHash = api.util.bytesToHex(manifest); + + if (isValidNumber(contentHash)) { + this.setAppContentHash(this.apps[index], contentHash); + } + + if (isValidNumber(imageHash)) { + this.setAppImageHash(this.apps[index], imageHash); + } + + if (isValidNumber(manifestHash)) { + this.setAppManifestHash(this.apps[index], manifestHash); + } + }); + }); + } + + findBadges = () => { + if (!this.contractBadgereg.instance) { + return Promise.resolve(false); + } + + return this + .findContracts(this.badges) + .then(() => { + return Promise.all( + this.badges.map((badge) => { + return badge.isBadgeRegistered + ? Promise.resolve([0, 0, 0]) + : this.contractBadgereg.instance.fromAddress.call({}, [badge.address]); + }) + ); + }) + .then((badgeInfos) => { + badgeInfos.forEach(([id, name, owner], index) => { + if (isValidNumber(owner)) { + this.setBadgeId(this.badges[index], id); + } + }); + + return Promise + .all( + this.badges.map((badge) => { + return !badge.isBadgeRegistered + ? Promise.resolve([0]) + : this.contractBadgereg.instance.meta.call({}, [badge.badgeId, 'IMG']); + }) + ); + }) + .then((images) => { + images.forEach((imageBytes, index) => { + const imageHash = api.util.bytesToHex(imageBytes); + + if (isValidNumber(imageHash)) { + this.setBadgeImageHash(this.badges[index], imageHash); + } + }); + }); + } + + findContracts = (contracts = this.contracts) => { + if (!this.registry.instance) { + return Promise.resolve(false); + } + + return Promise + .all( + contracts.map((contract) => { + const hashId = api.util.sha3.text(contract.id.toLowerCase()); + + return contract.isOnChain + ? Promise.resolve([0, 0]) + : Promise.all([ + this.registry.instance.getAddress.call({}, [hashId, 'A']), + this.registry.instance.getOwner.call({}, [hashId]) + ]); + }) + ) + .then((addresses) => { + addresses.forEach(([address, owner], index) => { + if (isValidNumber(owner) && isValidNumber(address)) { + this.setContractAddress(contracts[index], address, true); + } + }); + + return Promise.all( + contracts.map((contract) => { + return !contract.address || contract.hasLatestCode + ? Promise.resolve(null) + : api.eth.getCode(contract.address); + }) + ); + }) + .then((codes) => { + codes.forEach((byteCode, index) => { + if (byteCode) { + this.setContractCode(contracts[index], byteCode); + } + }); + }); + } + + onNewBlockNumber = (error, blockNumber) => { + if (error) { + return; + } + + return this + .findRegistry() + .then(this.findContracts) + .then(this.findApps) + .then(this.findBadges) + .catch(this.setError); + } +} diff --git a/js/src/dapps/chaindeploy/utils.js b/js/src/dapps/chaindeploy/utils.js new file mode 100644 index 000000000..87e7279e3 --- /dev/null +++ b/js/src/dapps/chaindeploy/utils.js @@ -0,0 +1,82 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import BigNumber from 'bignumber.js'; + +import { api } from './parity'; + +export function validateCode (source, retrieved) { + const original = source.substr(12); + const bytecode = retrieved.substr(12); + + const knownHash = api.util.sha3(original.slice(-1 * bytecode.length)); + const codeHash = api.util.sha3(bytecode); + + return knownHash === codeHash; +} + +export function isValidNumber (number) { + return number && !(new BigNumber(number)).isZero(); +} + +export function executeContract (logId, contract, funcName, options, values) { + const func = contract.instance[funcName]; + + return func + .estimateGas(options, values) + .then((gasEst) => { + options.gas = gasEst.mul(1.2); + + return trackRequest( + func.postTransaction(options, values), + (error, data) => { + if (error) { + console.error(logId, error); + } else { + console.log(logId, data); + } + } + ); + }); +} + +export function trackRequest (promise, callback) { + return promise + .then((requestId) => { + callback(null, { state: 'checkRequest', requestId }); + + return api.pollMethod('parity_checkRequest', requestId); + }) + .then((txHash) => { + callback(null, { state: 'getTransactionReceipt', txHash }); + + return api.pollMethod('eth_getTransactionReceipt', txHash, (receipt) => { + if (!receipt || !receipt.blockNumber || receipt.blockNumber.eq(0)) { + return false; + } + + return true; + }); + }) + .then((receipt) => { + callback(null, { state: 'hasReceipt', receipt }); + }) + .catch((error) => { + callback(error); + + throw error; + }); +} diff --git a/js/src/dapps/dappreg.js b/js/src/dapps/dappreg.js index 1c6c397f7..68d2ab30a 100644 --- a/js/src/dapps/dappreg.js +++ b/js/src/dapps/dappreg.js @@ -17,6 +17,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import injectTapEventPlugin from 'react-tap-event-plugin'; +import { AppContainer } from 'react-hot-loader'; injectTapEventPlugin(); @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - , + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./dappreg/Application/index.js', () => { + require('./dappreg/Application/index.js'); + + ReactDOM.render( + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/dappreg/Application/application.css b/js/src/dapps/dappreg/Application/application.css index b8c2354ab..c6057e8cc 100644 --- a/js/src/dapps/dappreg/Application/application.css +++ b/js/src/dapps/dappreg/Application/application.css @@ -15,15 +15,17 @@ /* along with Parity. If not, see . */ +@import '../_colors.css'; + .body { - color: #333; - background: #eee; - padding: 4.5em 0; + color: $text-color; + background: $background-color; + padding: 3em 0 6em; text-align: center; } .apps { - background: #fff; + background: white; border-radius: 0.5em; margin: 0 auto; max-width: 980px; @@ -39,9 +41,8 @@ } .header { - background: #44e; - border-radius: 0 0 0.25em 0.25em; - color: #fff; + background: $blue; + color: white; left: 0; padding: 1em; position: fixed; @@ -54,5 +55,5 @@ text-align: center; padding-top: 5em; font-size: 2em; - color: #999; + color: $loading-color; } diff --git a/js/src/dapps/dappreg/Application/application.js b/js/src/dapps/dappreg/Application/application.js index e92e8a7eb..4c3a567c2 100644 --- a/js/src/dapps/dappreg/Application/application.js +++ b/js/src/dapps/dappreg/Application/application.js @@ -19,18 +19,14 @@ import { observer } from 'mobx-react'; import DappsStore from '../dappsStore'; -import ButtonBar from '../ButtonBar'; -import Dapp from '../Dapp'; -import ModalDelete from '../ModalDelete'; -import ModalRegister from '../ModalRegister'; -import ModalUpdate from '../ModalUpdate'; -import SelectDapp from '../SelectDapp'; +import Dapps from '../Dapps'; +import Transactions from '../Transactions'; import Warning from '../Warning'; import styles from './application.css'; @observer export default class Application extends Component { - dappsStore = DappsStore.instance(); + dappsStore = DappsStore.get(); render () { if (this.dappsStore.isLoading) { @@ -41,23 +37,32 @@ export default class Application extends Component { ); } + const { ownDapps, otherDapps } = this.dappsStore; + return (
DAPP REGISTRY, a global view of distributed applications available on the network. Putting the puzzle together.
-
- - - + +
+ +
+
{ this.dappsStore.count } applications registered, { this.dappsStore.ownedCount } owned by user
+ + - - -
); } diff --git a/js/src/dapps/dappreg/Button/button.css b/js/src/dapps/dappreg/Button/button.css index 1ec1aeb90..be2028c7a 100644 --- a/js/src/dapps/dappreg/Button/button.css +++ b/js/src/dapps/dappreg/Button/button.css @@ -15,11 +15,16 @@ /* along with Parity. If not, see . */ +@import '../_colors.css'; +@import '../_utils.css'; + .button { - background: #44e; + composes: bezier-transform; + + background: $blue; border: none; border-radius: 0.25em; - color: #fff; + color: white; cursor: pointer; font-size: 1em; margin: 1em 0.375em; @@ -29,10 +34,14 @@ &[disabled] { opacity: 0.5; cursor: default; - background: #aaa; + background: $disabled-bg; } &[data-warning="true"] { - background: #e44; + background: $warning-bg; + } + + &:focus { + transform: scale(1.05); } } diff --git a/js/src/dapps/dappreg/Button/button.js b/js/src/dapps/dappreg/Button/button.js index 439af6119..40d84b542 100644 --- a/js/src/dapps/dappreg/Button/button.js +++ b/js/src/dapps/dappreg/Button/button.js @@ -24,27 +24,29 @@ export default class Button extends Component { disabled: PropTypes.bool, label: PropTypes.string.isRequired, warning: PropTypes.bool, - onClick: PropTypes.func.isRequired + onClick: PropTypes.func } render () { const { className, disabled, label, warning } = this.props; - const classes = `${styles.button} ${className}`; + const classes = [ styles.button, className ]; return ( ); } - onClick = (event) => { + handleClick = (event) => { if (this.props.disabled) { + event.preventDefault(); + event.stopPropagation(); return; } diff --git a/js/src/dapps/dappreg/ButtonBar/buttonBar.js b/js/src/dapps/dappreg/ButtonBar/buttonBar.js deleted file mode 100644 index cce4bb7aa..000000000 --- a/js/src/dapps/dappreg/ButtonBar/buttonBar.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component } from 'react'; -import { observer } from 'mobx-react'; - -import DappsStore from '../dappsStore'; -import ModalStore from '../modalStore'; - -import Button from '../Button'; -import styles from './buttonBar.css'; - -@observer -export default class ButtonBar extends Component { - dappsStore = DappsStore.instance(); - modalStore = ModalStore.instance(); - - render () { - let buttons = []; - - if (this.dappsStore.isEditing || this.dappsStore.isNew) { - buttons = [ -
+ ); + } + + const { isEditing } = dapp; + const { updating } = this.state; + + if (updating) { + return ( +
+
+ ); + } + + if (isEditing) { + return ( +
+
+ ); + } + + return ( +
+
+ ); + } + + renderHeader (dapp) { + const { id, image } = dapp; + const manifest = dapp.manifest.content || {}; + + const infos = []; + + if (manifest.version) { + infos.push(`v${manifest.version}`); + } + + if (manifest.author) { + infos.push(`by ${manifest.author}`); + } + + return ( +
+
+ +
+
+
+ { manifest.name || 'Unnamed' } +
+
+ { id } +
+
+ { infos.length > 0 ? infos.join(', ') : null } +
+
+
+ ); + } + + renderInputs (dapp) { + return [ + this.renderOwner(dapp), + this.renderHashInput(dapp, 'image', 'Image URL', true), + this.renderHashInput(dapp, 'manifest', 'Manifest URL'), + this.renderHashInput(dapp, 'content', 'Content URL') + ]; + } + + renderOwner (dapp) { + const { isEditing } = dapp; + + if (isEditing) { + return this.renderOwnerSelect(dapp); + } + + return this.renderOwnerStatic(dapp); + } + + renderOwnerSelect (dapp) { + const overlayImage = ( + + ); + + return ( + + + + ); + } + + renderOwnerStatic (dapp) { + const overlayImage = ( + + ); + + return ( + + + + ); + } + + renderHashInput (dapp, type, label, isImage = false) { + const handleChange = (event) => { + return this.handleChangeHash(event, type); + }; + + const { isEditing, wip } = dapp; + + const changed = wip && wip[type].changed; + const error = wip && wip[type].error; + + const hash = dapp[type].hash; + const url = dapp[type].url; + + const overlayImage = (isImage && hash) + ? ( + + ) + : null; + + const wipUrl = isEditing && wip && wip[type].url; + + const hint = error || (!changed && hash) || '...'; + const value = typeof wipUrl !== 'string' + ? url || '' + : wipUrl; + + return ( + + + + ); + } + + handleClose = () => { + this.handleCancel(); + this.props.onClose(); + } + + handleSelectOwner = (event) => { + const { value } = event.target; + + const changed = (this.props.dapp.owner.address !== value); + + this.props.dapp.handleChange({ + owner: { + address: value, + changed + } + }); + } + + handleChangeHash = (event, type) => { + if (!this.props.dapp.isEditing) { + return; + } + + const url = event.target.value; + const changed = (this.props.dapp[type].url !== url); + + this.props.dapp.handleChange({ + [ type ]: { + error: null, + changed, + url + } + }); + } + + handleFetchRegistry = () => { + this.dappsStore.fetchRegistryData(this.props.dapp); + } + + handleCancel = () => { + this.props.dapp.setEditing(false); + } + + handleEdit = () => { + this.props.dapp.setEditing(true); + } + + handleDelete = () => { + this.setState({ showDelete: true }); + } + + handleDeleteClose = () => { + this.setState({ showDelete: false }); + } + + handleDeleteConfirm = () => { + this.dappsStore.delete(this.props.dapp); + this.handleDeleteClose(); + this.handleClose(); + } + + handleSave = () => { + const updates = this.props.dapp.handleSave(); + + this.setState({ showUpdate: true, updates }); + } + + handleUpdateClose = () => { + this.setState({ showUpdate: false, updates: null }); + } + + handleUpdateConfirm = () => { + const { id, owner } = this.props.dapp; + const { updates } = this.state; + + this.handleUpdateClose(); + this.handleCancel(); + this.setState({ updating: true }); + + return this.dappsStore.update(id, owner.address, updates) + .then(() => { + this.setState({ updating: false }); + }) + .catch((error) => { + this.setState({ updating: false }); + throw error; + }); + } +} diff --git a/js/src/dapps/dappreg/DappModal/index.js b/js/src/dapps/dappreg/DappModal/index.js new file mode 100644 index 000000000..4d14ecd27 --- /dev/null +++ b/js/src/dapps/dappreg/DappModal/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './dappModal'; diff --git a/js/src/dapps/dappreg/Dapps/dapps.css b/js/src/dapps/dappreg/Dapps/dapps.css new file mode 100644 index 000000000..77ab087c0 --- /dev/null +++ b/js/src/dapps/dappreg/Dapps/dapps.css @@ -0,0 +1,38 @@ +/* Copyright 2015-2017 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +.dapps { + background-color: rgba(255, 255, 255, 0.9); + margin: 1rem; + padding: 1rem; + text-align: left; +} + +.container { + display: flex; + flex-direction: row; + flex-wrap: wrap; + + > * { + flex: 0 0 auto; + display: flex; + } +} + +.title { + margin: 0 0 0.5rem; +} diff --git a/js/src/dapps/dappreg/Dapps/dapps.js b/js/src/dapps/dappreg/Dapps/dapps.js new file mode 100644 index 000000000..da9675bcb --- /dev/null +++ b/js/src/dapps/dappreg/Dapps/dapps.js @@ -0,0 +1,73 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component, PropTypes } from 'react'; + +import CreateDappCard from '../CreateDappCard'; +import DappCard from '../DappCard'; + +import styles from './dapps.css'; + +export default class Dapps extends Component { + static propTypes = { + dapps: PropTypes.array.isRequired, + title: PropTypes.string.isRequired, + own: PropTypes.bool + }; + + static defaultProps = { + own: false + }; + + render () { + const { dapps, title } = this.props; + + return ( +
+

{ title }

+
+ { this.renderAddDapp() } + { this.renderDapps(dapps) } +
+
+ ); + } + + renderAddDapp () { + const { own } = this.props; + + if (!own) { + return null; + } + + return ( + + ); + } + + renderDapps (dapps) { + return dapps.map((dapp) => { + const { id } = dapp; + + return ( + + ); + }); + } +} diff --git a/js/src/dapps/dappreg/Dapps/index.js b/js/src/dapps/dappreg/Dapps/index.js new file mode 100644 index 000000000..9e6dddb63 --- /dev/null +++ b/js/src/dapps/dappreg/Dapps/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './dapps'; diff --git a/js/src/dapps/dappreg/Input/input.css b/js/src/dapps/dappreg/Input/input.css index 7d7f74b21..c553387a6 100644 --- a/js/src/dapps/dappreg/Input/input.css +++ b/js/src/dapps/dappreg/Input/input.css @@ -30,6 +30,10 @@ width: 100%; } + &.withOverlay input { + padding-right: 3em; + } + input { padding-bottom: 1.5em; diff --git a/js/src/dapps/dappreg/Input/input.js b/js/src/dapps/dappreg/Input/input.js index c72789d12..27084c3ed 100644 --- a/js/src/dapps/dappreg/Input/input.js +++ b/js/src/dapps/dappreg/Input/input.js @@ -29,8 +29,14 @@ export default class Input extends Component { render () { const { children, hint, label, overlay } = this.props; + const inputClasses = [ styles.input ]; + + if (overlay) { + inputClasses.push(styles.withOverlay); + } + return ( -
+
diff --git a/js/src/dapps/dappreg/Modal/modal.css b/js/src/dapps/dappreg/Modal/modal.css index 4421b6f13..73bffc9e7 100644 --- a/js/src/dapps/dappreg/Modal/modal.css +++ b/js/src/dapps/dappreg/Modal/modal.css @@ -15,95 +15,120 @@ /* along with Parity. If not, see . */ +@import '../_colors.css'; +@import '../_utils.css'; + .modal { - .body { - bottom: 0; - left: 0; - position: fixed; - right: 0; - top: 0; - text-align: center; - z-index: 50; + align-items: center; + background-color: $modal-bg; + bottom: 0; + display: flex; + justify-content: center; + left: 0; + position: fixed; + right: 0; + top: 0; + z-index: 150; + + &.secondary { + align-items: flex-start; + z-index: 200; + + .content { + line-height: 1.5rem; + padding: 2rem; + text-align: center; + } .dialog { - background: #fff; - border-radius: 0 0 0.25em 0.25em; - margin: 0 auto; max-width: 840px; - text-align: left; + width: 85vw; + } + } +} - .content { - line-height: 1.5em; - padding: 2em; - text-align: center; +.close { + composes: bezier-transform; - .section { - margin: 0; - padding: 0; + color: white; + display: inline-block; + font-family: 'Roboto Mono', monospace; + font-size: 4rem; + opacity: 0.75; + padding: 0; + position: fixed; + right: 1rem; + top: 0.25rem; - &.error { - color: #f44; - } - } + &:hover { + cursor: pointer; + opacity: 1; - .section+.section { - margin-top: 1em; - } - } + .closeIcon { + transform: rotate(135deg); + } + } +} - .footer { - padding: 0.5em 1.625em; - text-align: right; - } +.closeIcon { + composes: bezier-transform; - .header { - background: #44e; - color: #fff; - opacity: 0.85; - padding: 1em; + height: 3rem; + width: 3rem; + transform: rotate(45deg); +} - &.error { - background: #e44; - } - } +.dialog { + background-color: rgba(255, 255, 255, 0.95); + display: flex; + flex-direction: column; + max-height: 90vh; + overflow: hidden; + position: relative; + max-width: 740px; + width: 75vw; + + > * { + padding: 0.5rem 1rem; + } +} + +.content { + flex: 1 1 auto; + overflow: auto; + + .section { + margin: 0; + padding: 0; + + * { + overflow-x: hidden; + text-overflow: ellipsis; } } - .overlay { - background: rgba(204, 204, 204, 0.7); - bottom: 0; - left: 0; - position: fixed; - right: 0; - top: 0; - z-index: 49; + .section + .section { + margin-top: 1em; } } -.account { - div { - display: inline-block; - vertical-align: top; - } - - img { - border-radius: 50%; - margin-right: 0.5em; - } +.footer { + padding: 0.5em 1.625em; + text-align: right; } -.hint { - display: block !important; - color: #888; - font-size: 0.75em; - margin-top: -0.5em; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} +.header { + background-color: $blue; + color: white; + min-height: 3rem; -.center { - text-align: center; + &, + & > * { + align-items: center; + display: flex; + flex: 0 0 auto; + flex-direction: row; + } } .heading { diff --git a/js/src/dapps/dappreg/Modal/modal.js b/js/src/dapps/dappreg/Modal/modal.js index d8c8c166b..d70ac1090 100644 --- a/js/src/dapps/dappreg/Modal/modal.js +++ b/js/src/dapps/dappreg/Modal/modal.js @@ -14,53 +14,147 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import keycode from 'keycode'; import React, { Component, PropTypes } from 'react'; +import ReactDOM from 'react-dom'; + +import Button from '../Button'; import styles from './modal.css'; +import CloseImage from '~/../assets/images/dapps/close.svg'; export default class Modal extends Component { static propTypes = { - buttons: PropTypes.node, + actions: PropTypes.array, children: PropTypes.node, - error: PropTypes.object, - header: PropTypes.string - } + header: PropTypes.node, + secondary: PropTypes.bool, + onClose: PropTypes.func.isRequired, + onConfirm: PropTypes.func + }; + + static defaultProps = { + actions: null, + secondary: false + }; render () { - const { children, buttons, error, header } = this.props; + const { children, actions, header, secondary } = this.props; + + const modalClasses = [ styles.modal ]; + + if (secondary) { + modalClasses.push(styles.secondary); + } return ( -
-
-
-
-
- { header } -
-
- { error ? this.renderError() : children } -
-
- { buttons } +
+
+
+ { header } +
+
+ +
+ { children } +
+ + { actions ? this.renderActions(actions) : null }
); } - renderError () { - const { error } = this.props; - + renderActions (actions) { return ( -
-
- Your operation failed to complete sucessfully. The following error was returned: -
-
- { error.toString() } -
+
+ { actions.map((action) => { + let onClick = () => {}; + + switch (action.type) { + case 'confirm': + onClick = this.handleConfirm; + break; + + case 'close': + onClick = this.handleClose; + break; + } + + return ( +
); } + + stopEvent = (event) => { + event.stopPropagation(); + event.preventDefault(); + + return false; + } + + handleKeyPress = (event) => { + const codeName = keycode(event); + + if (codeName === 'esc') { + return this.handleClose(); + } + + return event; + } + + handleCloseKeyPress = (event) => { + const codeName = keycode(event); + + if (codeName === 'enter') { + return this.handleClose(); + } + + return event; + } + + handleSetRef = (containerRef) => { + // Focus after the modal is open + setTimeout(() => { + const element = ReactDOM.findDOMNode(containerRef); + + element && element.focus(); + }, 100); + } + + handleConfirm = () => { + this.props.onConfirm && this.props.onConfirm(); + } + + handleClose = () => { + this.props.onClose(); + } } diff --git a/js/src/dapps/dappreg/ModalDelete/modalDelete.js b/js/src/dapps/dappreg/ModalDelete/modalDelete.js index 11f9b33ac..e64c315fa 100644 --- a/js/src/dapps/dappreg/ModalDelete/modalDelete.js +++ b/js/src/dapps/dappreg/ModalDelete/modalDelete.js @@ -14,150 +14,48 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import React, { Component } from 'react'; -import { observer } from 'mobx-react'; +import React, { Component, PropTypes } from 'react'; -import { api } from '../parity'; -import DappsStore from '../dappsStore'; -import ModalStore from '../modalStore'; - -import Button from '../Button'; import Modal from '../Modal'; import styles from '../Modal/modal.css'; -const HEADERS = [ - 'Error During Deletion', - 'Confirm Application Deletion', - 'Waiting for Signer Confirmation', - 'Waiting for Transaction Receipt', - 'Deletion Completed' -]; -const STEP_ERROR = 0; -const STEP_CONFIRM = 1; -const STEP_SIGNER = 2; -const STEP_TXRECEIPT = 3; -const STEP_DONE = 4; - -@observer export default class ModalDelete extends Component { - dappsStore = DappsStore.instance(); - modalStore = ModalStore.instance(); + static propTypes = { + dappId: PropTypes.string.isRequired, + onClose: PropTypes.func.isRequired, + onDelete: PropTypes.func.isRequired + }; render () { - if (!this.modalStore.showingDelete) { - return null; - } + const { dappId, onClose, onDelete } = this.props; + const actions = [ + { type: 'close', label: 'No, Cancel' }, + { type: 'confirm', label: 'Yes, Delete', warning: true } + ]; return ( - { this.renderStep() } - - ); - } - - renderButtons () { - switch (this.modalStore.stepDelete) { - case STEP_ERROR: - case STEP_DONE: - return [ - ); return ( @@ -308,7 +320,8 @@ export class LocalTransaction extends BaseTransaction { { this.renderGasPrice(transaction) } -
+ + { this.renderGas(transaction) } @@ -345,9 +358,9 @@ export class LocalTransaction extends BaseTransaction { return ( - + { this.renderHash(transaction.hash) } @@ -357,20 +370,24 @@ export class LocalTransaction extends BaseTransaction { + shannon + + + MGas - + ); diff --git a/js/src/dapps/registry/Lookup/actions.js b/js/src/dapps/registry/Lookup/actions.js index 6f80fac0d..514039272 100644 --- a/js/src/dapps/registry/Lookup/actions.js +++ b/js/src/dapps/registry/Lookup/actions.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { sha3 } from '../parity.js'; +import { api, sha3 } from '../parity.js'; import { getOwner } from '../util/registry'; export const clear = () => ({ type: 'lookup clear' }); @@ -34,14 +34,21 @@ export const lookup = (name, key) => (dispatch, getState) => { return; } - const getAddress = contract.functions - .find((f) => f.name === 'getAddress'); + const method = key === 'A' + ? contract.instance.getAddress + : contract.instance.getData; name = name.toLowerCase(); dispatch(lookupStart(name, key)); - getAddress.call({}, [ sha3.text(name), key ]) - .then((address) => dispatch(success('lookup', address))) + method.call({}, [ sha3.text(name), key ]) + .then((result) => { + if (key !== 'A') { + result = api.util.bytesToHex(result); + } + + dispatch(success('lookup', result)); + }) .catch((err) => { console.error(`could not lookup ${key} for ${name}`); if (err) { diff --git a/js/src/dapps/registry/Records/actions.js b/js/src/dapps/registry/Records/actions.js index 11c2ec405..9f0d1beff 100644 --- a/js/src/dapps/registry/Records/actions.js +++ b/js/src/dapps/registry/Records/actions.js @@ -46,8 +46,9 @@ export const update = (name, key, value) => (dispatch, getState) => { throw new Error(`you are not the owner of "${name}"`); } - const fnName = key === 'A' ? 'setAddress' : 'set'; - const method = contract.instance[fnName]; + const method = key === 'A' + ? contract.instance.setAddress + : contract.instance.setData || contract.instance.set; const options = { from: account.address diff --git a/js/src/dapps/registry/actions.js b/js/src/dapps/registry/actions.js index 00d851a37..8c7774397 100644 --- a/js/src/dapps/registry/actions.js +++ b/js/src/dapps/registry/actions.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { registry as registryAbi, registry2 as registryAbi2 } from '~/contracts/abi'; +import Contracts from '~/contracts'; import { api } from './parity.js'; import * as addresses from './addresses/actions.js'; @@ -27,11 +27,6 @@ import * as reverse from './Reverse/actions.js'; export { addresses, accounts, lookup, events, names, records, reverse }; -const REGISTRY_V1_HASHES = [ - '0x34f7c51bbb1b1902fbdabfdf04811100f5c9f998f26dd535d2f6f977492c748e', // ropsten - '0x64c3ee34851517a9faecd995c102b339f03e564ad6772dc43a26f993238b20ec' // homestead -]; - export const setNetVersion = (netVersion) => ({ type: 'set netVersion', netVersion }); export const fetchIsTestnet = () => (dispatch) => @@ -48,36 +43,18 @@ export const fetchIsTestnet = () => (dispatch) => export const setContract = (contract) => ({ type: 'set contract', contract }); -export const fetchContract = () => (dispatch) => - api.parity - .registryAddress() - .then((address) => { - return api.eth - .getCode(address) - .then((code) => { - const codeHash = api.util.sha3(code); - const isVersion1 = REGISTRY_V1_HASHES.includes(codeHash); - - console.log(`registry at ${address}, code ${codeHash}, version ${isVersion1 ? 1 : 2}`); - - const contract = api.newContract( - isVersion1 - ? registryAbi - : registryAbi2, - address - ); - - dispatch(setContract(contract)); - dispatch(fetchFee()); - dispatch(fetchOwner()); - }); +export const fetchContract = () => (dispatch) => { + return Contracts.create(api).registry + .fetchContract() + .then((contract) => { + dispatch(setContract(contract)); + dispatch(fetchFee()); + dispatch(fetchOwner()); }) - .catch((err) => { - console.error('could not fetch contract'); - if (err) { - console.error(err.stack); - } + .catch((error) => { + console.error('could not fetch contract', error); }); +}; export const setFee = (fee) => ({ type: 'set fee', fee }); diff --git a/js/src/dapps/registry/ui/image.js b/js/src/dapps/registry/ui/image.js index 1aee21457..3f0a90abe 100644 --- a/js/src/dapps/registry/ui/image.js +++ b/js/src/dapps/registry/ui/image.js @@ -34,7 +34,7 @@ export default (address) => { return ( { diff --git a/js/src/dapps/signaturereg.js b/js/src/dapps/signaturereg.js index c20e45170..61b67aab0 100644 --- a/js/src/dapps/signaturereg.js +++ b/js/src/dapps/signaturereg.js @@ -16,6 +16,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - , + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./signaturereg/Application/index.js', () => { + require('./signaturereg/Application/index.js'); + + ReactDOM.render( + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/tokendeploy.js b/js/src/dapps/tokendeploy.js index a1808199e..b6de05d05 100644 --- a/js/src/dapps/tokendeploy.js +++ b/js/src/dapps/tokendeploy.js @@ -17,6 +17,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { Redirect, Router, Route, hashHistory } from 'react-router'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -31,13 +32,37 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - - - - - - - - , + + + + + + + + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./tokendeploy/Application/index.js', () => { + require('./tokendeploy/Application/index.js'); + require('./tokendeploy/Overview/index.js'); + require('./tokendeploy/Transfer/index.js'); + + ReactDOM.render( + + + + + + + + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js b/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js index 0872c992f..51dcd2f5b 100644 --- a/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js +++ b/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js @@ -253,23 +253,28 @@ export default class Deployment extends Component { onDeploy = () => { const { managerInstance, registryInstance, tokenregInstance } = this.context; - const { base, deployBusy, globalReg, globalFee, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state; + const { base, deployBusy, globalReg, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state; const hasError = !!(nameError || tlaError || totalSupplyError); if (hasError || deployBusy) { return; } - const tokenreg = (globalReg ? tokenregInstance : registryInstance).address; + const registry = globalReg ? tokenregInstance : registryInstance; + const tokenreg = registry.address; + const values = [base.mul(totalSupply), tla, name, tokenreg]; - const options = { - value: globalReg ? globalFee : 0 - }; + const options = {}; this.setState({ deployBusy: true, deployState: 'Estimating gas for the transaction' }); - return api.parity - .defaultAccount() + return registry.fee.call({}, []) + .then((fee) => { + console.log('deploying with fee of', fee.toFixed()); + options.value = fee; + + return api.parity.defaultAccount(); + }) .then((defaultAddress) => { options.from = defaultAddress; diff --git a/js/src/dapps/tokendeploy/services.js b/js/src/dapps/tokendeploy/services.js index 9ca4c4f56..6cfeff05f 100644 --- a/js/src/dapps/tokendeploy/services.js +++ b/js/src/dapps/tokendeploy/services.js @@ -119,7 +119,7 @@ export function attachInstances () { .all([ api.parity.registryAddress(), api.parity.netChain(), - api.partiy.netVersion() + api.net.version() ]) .then(([registryAddress, netChain, _netVersion]) => { const registry = api.newContract(abis.registry, registryAddress).instance; diff --git a/js/src/dapps/tokenreg.js b/js/src/dapps/tokenreg.js index 5c6bb4bd1..3e8dc9b19 100644 --- a/js/src/dapps/tokenreg.js +++ b/js/src/dapps/tokenreg.js @@ -17,6 +17,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { Provider } from 'react-redux'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -29,10 +30,25 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - ( + - ), + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./tokenreg/Container.js', () => { + require('./tokenreg/Container.js'); + + ReactDOM.render( + + + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/tokenreg/Tokens/Token/add-meta.js b/js/src/dapps/tokenreg/Tokens/Token/add-meta.js index 89da76701..0f73179d9 100644 --- a/js/src/dapps/tokenreg/Tokens/Token/add-meta.js +++ b/js/src/dapps/tokenreg/Tokens/Token/add-meta.js @@ -19,7 +19,7 @@ import { Dialog, RaisedButton, FlatButton, SelectField, MenuItem } from 'materia import AddIcon from 'material-ui/svg-icons/content/add'; import InputText from '../../Inputs/Text'; -import { ADDRESS_TYPE } from '../../Inputs/validation'; +import { ADDRESS_TYPE, URL_TYPE } from '../../Inputs/validation'; import styles from './token.css'; @@ -128,6 +128,22 @@ export default class AddMeta extends Component { renderForm () { const selectedMeta = metaDataKeys[this.state.metaKeyIndex]; + const metaLabel = selectedMeta.label.toLowerCase(); + let metaType; + + switch (selectedMeta.validation) { + case ADDRESS_TYPE: + metaType = 'Address'; + break; + + case URL_TYPE: + metaType = 'URL'; + break; + + default: + metaType = 'URL Hint'; + break; + } return (
@@ -145,7 +161,7 @@ export default class AddMeta extends Component { { const { index } = this.props; + const { form, metaKeyIndex } = this.state; + + const selectedMeta = metaDataKeys[metaKeyIndex]; const keyIndex = this.state.metaKeyIndex; const key = metaDataKeys[keyIndex].value; + const value = form.value; + const validationType = selectedMeta.validation; this.props.handleAddMeta( index, key, - this.state.form.value + value, + validationType ); this.setState({ complete: true }); diff --git a/js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js b/js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js index 2de03fe9e..dc15f68d9 100644 --- a/js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js +++ b/js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js @@ -61,8 +61,8 @@ const mapDispatchToProps = (dispatch) => { dispatch(unregisterToken(index)); }, - handleAddMeta: (index, key, value) => { - dispatch(addTokenMeta(index, key, value)); + handleAddMeta: (index, key, value, validationType) => { + dispatch(addTokenMeta(index, key, value, validationType)); } }; }; diff --git a/js/src/dapps/tokenreg/Tokens/actions.js b/js/src/dapps/tokenreg/Tokens/actions.js index b32b86905..6b7983b0d 100644 --- a/js/src/dapps/tokenreg/Tokens/actions.js +++ b/js/src/dapps/tokenreg/Tokens/actions.js @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { getTokenTotalSupply } from '../utils'; +import { URL_TYPE } from '../Inputs/validation'; +import { getTokenTotalSupply, urlToHash } from '../utils'; const { bytesToHex } = window.parity.api.util; @@ -178,40 +179,63 @@ export const queryTokenMeta = (index, query) => (dispatch, getState) => { }); }; -export const addTokenMeta = (index, key, value) => (dispatch, getState) => { +export const addTokenMeta = (index, key, value, validationType) => (dispatch, getState) => { const state = getState(); + const contractInstance = state.status.contract.instance; + const ghhInstance = state.status.githubhint.instance; + const token = state.tokens.tokens.find(t => t.index === index); const options = { from: token.owner }; - const values = [ index, key, value ]; + let valuesPromise; - contractInstance - .setMeta - .estimateGas(options, values) - .then((gasEstimate) => { - options.gas = gasEstimate.mul(1.2).toFixed(0); - return contractInstance.setMeta.postTransaction(options, values); + // Get the right values (could be a hashed URL from GHH) + if (validationType === URL_TYPE) { + valuesPromise = addGithubhintURL(ghhInstance, options, value) + .then((hash) => [ index, key, hash ]); + } else { + valuesPromise = Promise.resolve([ index, key, value ]); + } + + return valuesPromise + .then((values) => { + return contractInstance + .setMeta + .estimateGas(options, values) + .then((gasEstimate) => { + options.gas = gasEstimate.mul(1.2).toFixed(0); + return contractInstance.setMeta.postTransaction(options, values); + }); }) .catch((e) => { console.error(`addTokenMeta: #${index} error`, e); }); }; -export const addGithubhintURL = (from, key, url) => (dispatch, getState) => { - const state = getState(); - const contractInstance = state.status.githubhint.instance; - const options = { from }; - const values = [ key, url ]; +export const addGithubhintURL = (ghhInstance, _options, url) => { + return urlToHash(ghhInstance, url) + .then((result) => { + const { hash, registered } = result; - contractInstance - .hintURL - .estimateGas(options, values) - .then((gasEstimate) => { - options.gas = gasEstimate.mul(1.2).toFixed(0); - return contractInstance.hintURL.postTransaction(options, values); - }) - .catch((e) => { - console.error('addGithubhintURL error', e); + if (registered) { + return hash; + } + + const options = { from: _options.from }; + const values = [ hash, url ]; + + ghhInstance + .hintURL + .estimateGas(options, values) + .then((gasEstimate) => { + options.gas = gasEstimate.mul(1.2).toFixed(0); + return ghhInstance.hintURL.postTransaction(options, values); + }) + .catch((error) => { + console.error(`registering "${url}" to GHH`, error); + }); + + return hash; }); }; diff --git a/js/src/dapps/tokenreg/constants.js b/js/src/dapps/tokenreg/constants.js index 3d56545bd..a4d2e3938 100644 --- a/js/src/dapps/tokenreg/constants.js +++ b/js/src/dapps/tokenreg/constants.js @@ -14,13 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { HEX_TYPE, ADDRESS_TYPE } from './Inputs/validation'; +import { URL_TYPE, ADDRESS_TYPE } from './Inputs/validation'; export const metaDataKeys = [ { label: 'Image', value: 'IMG', - validation: HEX_TYPE + validation: URL_TYPE }, { label: 'Address', diff --git a/js/src/dapps/tokenreg/parity.js b/js/src/dapps/tokenreg/parity.js index 6c861780a..7118ce087 100644 --- a/js/src/dapps/tokenreg/parity.js +++ b/js/src/dapps/tokenreg/parity.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const { api } = window.parity; +const api = window.parent.secureApi; export { api diff --git a/js/src/dapps/tokenreg/utils.js b/js/src/dapps/tokenreg/utils.js index 1dbd67687..82d71a6d0 100644 --- a/js/src/dapps/tokenreg/utils.js +++ b/js/src/dapps/tokenreg/utils.js @@ -18,6 +18,45 @@ import { api } from './parity'; import { eip20 as eip20Abi } from '~/contracts/abi'; +export const INVALID_URL_HASH = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; +export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; + +/** + * Convert the given URL to a content hash, + * and checks if it is already registered in GHH + */ +export const urlToHash = (ghhInstance, url) => { + if (!url || !url.length) { + return Promise.resolve(null); + } + + return api.parity + .hashContent(url) + .catch((error) => { + const message = error.text || error.message || error.toString(); + + throw new Error(`${message} (${url})`); + }) + .then((contentHash) => { + console.log('lookupHash', url, contentHash); + + if (contentHash === INVALID_URL_HASH) { + throw new Error(`"${url}" is not a valid URL`); + } + + return ghhInstance.entries + .call({}, [contentHash]) + .then(([accountSlashRepo, commit, contentHashOwner]) => { + const registered = (contentHashOwner !== ZERO_ADDRESS); + + return { + hash: contentHash, + registered + }; + }); + }); +}; + export const getTokenTotalSupply = (tokenAddress) => { return api .eth diff --git a/js/src/i18n/_default/settings.js b/js/src/i18n/_default/settings.js index 7825660d2..5a656ca6a 100644 --- a/js/src/i18n/_default/settings.js +++ b/js/src/i18n/_default/settings.js @@ -57,17 +57,17 @@ export default { label: `Addressbook` }, apps: { - description: `Distributed applications that interact with the underlying network. Add applications, manage you application portfolio and interact with application from around the network.`, + description: `Distributed applications that interact with the underlying network. Add applications, manage you application portfolio and interact with applications from around the network.`, label: `Applications` }, contracts: { description: `Watch and interact with specific contracts that have been deployed on the network. This is a more technically-focused environment, specifically for advanced users that understand the inner working of certain contracts.`, label: `Contracts` }, - overview_0: `Manage the available application views, using only the parts of the application that is applicable to you.`, - overview_1: `Are you an end-user? The defaults are setups for both beginner and advanced users alike.`, - overview_2: `Are you a developer? Add some features to manage contracts are interact with application deployments.`, - overview_3: `Are you a miner or run a large-scale node? Add the features to give you all the information needed to watch the node operation.`, + overview_0: `Manage the available application views, using only the parts of the application applicable to you.`, + overview_1: `Are you an end-user? The defaults are setup for both beginner and advanced users alike.`, + overview_2: `Are you a developer? Add some features to manage contracts and interact with application deployments.`, + overview_3: `Are you a miner or do you run a large-scale node? Add the features to give you all the information needed to watch the node operation.`, settings: { description: `This view. Allows you to customize the application in term of options, operation and look and feel.`, label: `Settings` diff --git a/js/src/jsonrpc/interfaces/parity.js b/js/src/jsonrpc/interfaces/parity.js index cf62213a5..1e6df05de 100644 --- a/js/src/jsonrpc/interfaces/parity.js +++ b/js/src/jsonrpc/interfaces/parity.js @@ -199,7 +199,7 @@ export default { '2017-01-20 18:14:19 Configured for DevelopmentChain using InstantSeal engine', '2017-01-20 18:14:19 Operating mode: active', '2017-01-20 18:14:19 State DB configuration: fast', - '2017-01-20 18:14:19 Starting Parity/v1.6.0-unstable-2ae8b4c-20170120/x86_64-linux-gnu/rustc1.14.0' + '2017-01-20 18:14:19 Starting Parity/v1.7.0-unstable-2ae8b4c-20170120/x86_64-linux-gnu/rustc1.14.0' ] } }, diff --git a/js/src/modals/CreateAccount/CreationType/creationType.js b/js/src/modals/CreateAccount/CreationType/creationType.js index 9c0fb1b4f..392db7445 100644 --- a/js/src/modals/CreateAccount/CreationType/creationType.js +++ b/js/src/modals/CreateAccount/CreationType/creationType.js @@ -130,7 +130,7 @@ export default class CreationType extends Component {
{ this.renderList(createType) } diff --git a/js/src/modals/DeployContract/DetailsStep/detailsStep.js b/js/src/modals/DeployContract/DetailsStep/detailsStep.js index 3600c13dd..4086b08a3 100644 --- a/js/src/modals/DeployContract/DetailsStep/detailsStep.js +++ b/js/src/modals/DeployContract/DetailsStep/detailsStep.js @@ -16,12 +16,16 @@ import React, { Component, PropTypes } from 'react'; import { FormattedMessage } from 'react-intl'; -import { MenuItem } from 'material-ui'; +import { Checkbox, MenuItem } from 'material-ui'; import { AddressSelect, Form, Input, Select } from '~/ui'; import { validateAbi } from '~/util/validation'; import { parseAbiType } from '~/util/abi'; +const CHECK_STYLE = { + marginTop: '1em' +}; + export default class DetailsStep extends Component { static contextTypes = { api: PropTypes.object.isRequired @@ -30,8 +34,10 @@ export default class DetailsStep extends Component { static propTypes = { accounts: PropTypes.object.isRequired, onAbiChange: PropTypes.func.isRequired, + onAmountChange: PropTypes.func.isRequired, onCodeChange: PropTypes.func.isRequired, onDescriptionChange: PropTypes.func.isRequired, + onExtrasChange: PropTypes.func.isRequired, onFromAddressChange: PropTypes.func.isRequired, onInputsChange: PropTypes.func.isRequired, onNameChange: PropTypes.func.isRequired, @@ -39,11 +45,14 @@ export default class DetailsStep extends Component { abi: PropTypes.string, abiError: PropTypes.string, + amount: PropTypes.string, + amountError: PropTypes.string, balances: PropTypes.object, code: PropTypes.string, codeError: PropTypes.string, description: PropTypes.string, descriptionError: PropTypes.string, + extras: PropTypes.bool, fromAddress: PropTypes.string, fromAddressError: PropTypes.string, name: PropTypes.string, @@ -52,6 +61,7 @@ export default class DetailsStep extends Component { }; static defaultProps = { + extras: false, readOnly: false }; @@ -83,7 +93,7 @@ export default class DetailsStep extends Component { fromAddress, fromAddressError, name, nameError, description, descriptionError, - abiError, + abiError, extras, code, codeError } = this.props; @@ -189,10 +199,70 @@ export default class DetailsStep extends Component { value={ code } /> + { this.renderValueInput() } + +
+ + } + onCheck={ this.onCheckExtras } + style={ CHECK_STYLE } + /> +
+ ); } + renderValueInput () { + const { abi, amount, amountError } = this.props; + + let payable = false; + + try { + const parsedAbi = JSON.parse(abi); + + payable = parsedAbi.find((method) => method.type === 'constructor' && method.payable); + } catch (error) { + return null; + } + + if (!payable) { + return null; + } + + return ( + + } + label={ + + } + min={ 0 } + step={ 0.1 } + type='number' + onChange={ this.onAmountChange } + value={ amount } + /> + ); + } + renderContractSelect () { const { contracts } = this.state; @@ -295,6 +365,16 @@ export default class DetailsStep extends Component { onDescriptionChange(description); } + onAmountChange = (event, value) => { + const { onAmountChange } = this.props; + + onAmountChange(value); + } + + onCheckExtras = () => { + this.props.onExtrasChange(!this.props.extras); + } + onAbiChange = (abi) => { const { api } = this.context; const { onAbiChange, onParamsChange, onInputsChange } = this.props; diff --git a/js/src/modals/DeployContract/deployContract.js b/js/src/modals/DeployContract/deployContract.js index 14930d312..3e7c83d6d 100644 --- a/js/src/modals/DeployContract/deployContract.js +++ b/js/src/modals/DeployContract/deployContract.js @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import BigNumber from 'bignumber.js'; import { pick } from 'lodash'; import { observer } from 'mobx-react'; import React, { Component, PropTypes } from 'react'; @@ -22,12 +23,13 @@ import { connect } from 'react-redux'; import { BusyStep, Button, CompletedStep, CopyToClipboard, GasPriceEditor, IdentityIcon, Portal, TxHash, Warning } from '~/ui'; import { CancelIcon, DoneIcon } from '~/ui/Icons'; -import { ERRORS, validateAbi, validateCode, validateName } from '~/util/validation'; +import { ERRORS, validateAbi, validateCode, validateName, validatePositiveNumber } from '~/util/validation'; import { deploy, deployEstimateGas } from '~/util/tx'; import DetailsStep from './DetailsStep'; import ParametersStep from './ParametersStep'; import ErrorStep from './ErrorStep'; +import Extras from '../Transfer/Extras'; import styles from './deployContract.css'; @@ -50,6 +52,14 @@ const STEPS = { /> ) }, + EXTRAS: { + title: ( + + ) + }, DEPLOYMENT: { waiting: true, title: ( @@ -97,12 +107,16 @@ class DeployContract extends Component { state = { abi: '', abiError: ERRORS.invalidAbi, + amount: '0', + amountValue: new BigNumber(0), + amountError: '', code: '', codeError: ERRORS.invalidCode, deployState: '', deployError: null, description: '', descriptionError: null, + extras: false, fromAddress: Object.keys(this.props.accounts)[0], fromAddressError: null, name: '', @@ -142,12 +156,25 @@ class DeployContract extends Component { render () { const { step, deployError, rejected, inputs } = this.state; - const realStep = Object.keys(STEPS).findIndex((k) => k === step); - const realSteps = deployError || rejected - ? null + const realStepKeys = deployError || rejected + ? [] : Object.keys(STEPS) - .filter((k) => k !== 'CONTRACT_PARAMETERS' || inputs.length > 0) - .map((k) => STEPS[k]); + .filter((k) => { + if (k === 'CONTRACT_PARAMETERS') { + return inputs.length > 0; + } + + if (k === 'EXTRAS') { + return this.state.extras; + } + + return true; + }); + + const realStep = realStepKeys.findIndex((k) => k === step); + const realSteps = realStepKeys.length + ? realStepKeys.map((k) => STEPS[k]) + : null; const title = realSteps ? null @@ -206,8 +233,8 @@ class DeployContract extends Component { } renderDialogActions () { - const { deployError, abiError, codeError, nameError, descriptionError, fromAddressError, fromAddress, step } = this.state; - const isValid = !nameError && !fromAddressError && !descriptionError && !abiError && !codeError; + const { deployError, abiError, amountError, codeError, nameError, descriptionError, fromAddressError, fromAddress, step } = this.state; + const isValid = !nameError && !fromAddressError && !descriptionError && !abiError && !codeError && !amountError; const cancelBtn = (