From 19db7137cad75ab4dbdc93db11a176334b294890 Mon Sep 17 00:00:00 2001 From: krzysztofwedrowicz Date: Tue, 15 Jan 2019 15:37:08 +0100 Subject: [PATCH 1/2] changes needed for easier Getting started in documentation --- .env.tpl | 4 ++-- Makefile | 2 ++ package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/.env.tpl b/.env.tpl index ae33908..7fe78a0 100644 --- a/.env.tpl +++ b/.env.tpl @@ -1,4 +1,4 @@ -PRIVATE_KEY= +PRIVATE_KEY=0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d MNEMONIC= ROPSTEN_PROVIDER_URL= -ORACLE_SERVER_ADDRESS= +ORACLE_SERVER_ADDRESS=0x1df62f291b2e969fb0849d99d9ce41e2f137006e diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..371311b --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +copy-env: + if ! [ -e .env ]; then cp .env.tpl .env; fi; diff --git a/package.json b/package.json index 6f196f7..cfa5d02 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "gardener-smart-contracts", + "name": "gardener-ethereum", "version": "0.1.0", "description": "Ethereum smart contracts for Gardener open source oracle project", "files": [ From e8e915e1ebbbf185278d00657ce1d4acbf95966b Mon Sep 17 00:00:00 2001 From: krzysztofwedrowicz Date: Wed, 16 Jan 2019 10:11:22 +0100 Subject: [PATCH 2/2] fixed tests --- test/OracleTest.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/OracleTest.js b/test/OracleTest.js index 562ee61..9d57e55 100644 --- a/test/OracleTest.js +++ b/test/OracleTest.js @@ -4,6 +4,8 @@ const timeController = require('./utils/timeController'); const Oracle = artifacts.require('Oracle'); const UsingOracle = artifacts.require('UsingOracle'); +const ONE_DAY = 60 * 60 * 24; + contract('Oracle', (accounts) => { const sut = {}; const serverAddress = accounts[1]; @@ -185,10 +187,11 @@ contract('Oracle', (accounts) => { it('should emit RequestFullfilled event when fulfill request with valid delay as timestamp', async () => { // given const url = 'someurl.example.com'; - const delayAsTimestamp = 1546300800; // 2020/01/01 as unix timestamp. + const delayAsTimestamp = timeController.currentTimestamp().add(ONE_DAY); + const transaction = await sut.usingOracle.delayedRequest(url, delayAsTimestamp); const { blockNumber } = transaction.receipt; - timeController.addDays(100); // Adding 15 months from now. + timeController.addDays(1); const events = await getEvents( sut.instance, { eventName: 'DelayedDataRequested', eventArgs: {} }, @@ -210,7 +213,7 @@ contract('Oracle', (accounts) => { it('should reject fulfilling request for invalid request delay as timestamp', async () => { // given const url = 'someurl.example.com'; - const delayInSeconds = 1577836802; + const delayInSeconds = timeController.currentTimestamp().add(ONE_DAY); const transaction = await sut.usingOracle.delayedRequest(url, delayInSeconds); const { blockNumber } = transaction.receipt; const events = await getEvents(