From e5950ed1dadc76fb81e2848571da74040fd80d2b Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Fri, 19 Oct 2018 15:12:38 -0600 Subject: [PATCH 01/11] decimals work in fund --- app/assets/v2/js/grants/fund_grant.js | 31 ++++++++++++++++----------- app/assets/v2/js/grants/new.js | 1 + app/assets/v2/js/shared.js | 3 ++- app/grants/templates/grants/fund.html | 1 - 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index 7086dfd9f0f..1dc9cc1fa2e 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -33,12 +33,16 @@ $(document).ready(function() { let deployedSubscription = new web3.eth.Contract(compiledSubscription.abi, data.contract_address); // This token is only for testing - let deployedToken = new web3.eth.Contract(compiledToken.abi, '0xFD9C55bf4B75Ef115749cF76E9083c4241D7a7eB'); - + // will need to make dynamic with data.token_address + let deployedToken = new web3.eth.Contract(compiledToken.abi, '0x00e8baC402e187608C6585c435C9D35947770f5B'); deployedToken.methods.decimals().call(function(err, decimals) { - console.log('decimals', typeof decimals); + console.log('decimals', decimals); + + let realApproval = Number(data.approve * 10 ** decimals); + + console.log("realApproval", realApproval); let realTokenAmount = Number(data.amount_per_period * 10 ** decimals); @@ -46,6 +50,7 @@ $(document).ready(function() { let realGasPrice = Number(data.gas_price * 10 ** decimals); + console.log('realGasPrice', realGasPrice); web3.eth.getAccounts(function(err, accounts) { @@ -55,7 +60,7 @@ $(document).ready(function() { // need to figure out why there does not seem to be a limit to this amount. Probably setting way higher than thought - deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(realTokenAmount)).send({from: accounts[0]}, function(err, result) { + deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(realApproval)).send({from: accounts[0]}, function(err, result) { // Should add approval transactions to transaction history console.log('result', result); @@ -75,7 +80,7 @@ $(document).ready(function() { // admin_address data.admin_address, // testing token - '0xFD9C55bf4B75Ef115749cF76E9083c4241D7a7eB', + '0x00e8baC402e187608C6585c435C9D35947770f5B', // data.amount_per_period web3.utils.toTwosComplement(data.amount_per_period), // data.period_seconds @@ -118,14 +123,14 @@ $(document).ready(function() { }).then((response)=>{ console.log('TX RESULT', response); - $.each($(form).serializeArray(), function() { - data[this.name] = this.value; - }); - - console.log('data', data); - - form.submit(); - + // $.each($(form).serializeArray(), function() { + // data[this.name] = this.value; + // }); + // + // console.log('data', data); + // + // form.submit(); + // }) .catch((error)=>{ console.log(error); diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 138b18a9381..0a081ae5e0e 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -69,6 +69,7 @@ $(document).ready(function() { web3.eth.getAccounts(function(err, accounts) { web3.eth.net.getId(function(err, network) { + network = 'testrpc' $('#network').val(network); SubscriptionContract.deploy({ data: compiledSubscription.bytecode, diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index fb3fe6aa4c4..cbfb2b214e9 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -712,7 +712,8 @@ var trigger_primary_form_web3_hooks = function() { if ($('#primary_form').length) { var is_zero_balance_not_okay = document.location.href.indexOf('/faucet') == -1; - var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase(); + // var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase(); + var unlock_metamask_error = '0x0000000000000000000000000000000000000000' if (typeof web3 == 'undefined') { $('#no_metamask_error').css('display', 'block'); diff --git a/app/grants/templates/grants/fund.html b/app/grants/templates/grants/fund.html index 5851e0a00de..ad0da590162 100644 --- a/app/grants/templates/grants/fund.html +++ b/app/grants/templates/grants/fund.html @@ -83,7 +83,6 @@

- From daf325758afde09b95ee94d74e24e7d58597ff1d Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 12:15:30 -0600 Subject: [PATCH 02/11] approve() zero working. fixed picture bleed through on detail --- app/assets/v2/js/grants/cancel_subscription.js | 2 +- app/assets/v2/js/grants/fund_grant.js | 2 +- app/assets/v2/js/grants/new.js | 2 +- app/assets/v2/js/shared.js | 2 +- app/grants/templates/grants/index.html | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/assets/v2/js/grants/cancel_subscription.js b/app/assets/v2/js/grants/cancel_subscription.js index 1cf35003187..3df061bdce7 100644 --- a/app/assets/v2/js/grants/cancel_subscription.js +++ b/app/assets/v2/js/grants/cancel_subscription.js @@ -21,7 +21,7 @@ window.onload = function() { web3.eth.getAccounts(function(err, accounts) { - deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0], gas: 10 0000}, function(err, result) { + deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]}, function(err, result) { form.submit(); diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index 896b7e54b2f..e6e5f859fa9 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -42,7 +42,7 @@ $(document).ready(function() { let realApproval = Number(data.approve * 10 ** decimals); - console.log("realApproval", realApproval); + console.log('realApproval', realApproval); let realTokenAmount = Number(data.amount_per_period * 10 ** decimals); diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 0a081ae5e0e..2778d75fd65 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -69,7 +69,7 @@ $(document).ready(function() { web3.eth.getAccounts(function(err, accounts) { web3.eth.net.getId(function(err, network) { - network = 'testrpc' + network = 'testrpc'; $('#network').val(network); SubscriptionContract.deploy({ data: compiledSubscription.bytecode, diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index cbfb2b214e9..ac82e13b425 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -713,7 +713,7 @@ var trigger_primary_form_web3_hooks = function() { if ($('#primary_form').length) { var is_zero_balance_not_okay = document.location.href.indexOf('/faucet') == -1; // var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase(); - var unlock_metamask_error = '0x0000000000000000000000000000000000000000' + var unlock_metamask_error = '0x0000000000000000000000000000000000000000'; if (typeof web3 == 'undefined') { $('#no_metamask_error').css('display', 'block'); diff --git a/app/grants/templates/grants/index.html b/app/grants/templates/grants/index.html index 2be7ea4d354..c2145f3fda2 100644 --- a/app/grants/templates/grants/index.html +++ b/app/grants/templates/grants/index.html @@ -40,10 +40,9 @@

{% trans 'Dev Grants' %}

{% blocktrans %} - Support Open Source Projects via Gitcoin's new Dev Grants feature. By leveraging - Staketree - , Gitcoin is helping facilitate blockchain-based - support for some of the best OSS projects in the space. + Want to provide sustainable funding for Open Source? Creating a Gitcoin Dev Grant is a great way to do it! Dev Grants, powered by the + EIP 1337 standard + , are a fast, easy, & secure way to provide recurring token contributions to your favorite OSS maintainers. Show your appreciation for maintainers in your dependancy tree with a Gitcoin Dev Grant today. {% endblocktrans %}

From 7cb0ff8350aedb092630457d139089b235f37062 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 13:20:08 -0600 Subject: [PATCH 03/11] cancelSubscription Contract funtion implemented. Was only using approve, but found bug with that system. --- .../v2/js/grants/cancel_subscription.js | 59 ++++++++++++++++++- app/grants/templates/grants/cancel.html | 6 ++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/app/assets/v2/js/grants/cancel_subscription.js b/app/assets/v2/js/grants/cancel_subscription.js index 3df061bdce7..f5732fdb01d 100644 --- a/app/assets/v2/js/grants/cancel_subscription.js +++ b/app/assets/v2/js/grants/cancel_subscription.js @@ -11,7 +11,9 @@ window.onload = function() { data[this.name] = this.value; }); - // currently practically cancelled, but need to delete subscription from miner so it isn't checked every 15 seconds. + // need to delete subscription from miner so it isn't checked every 15 seconds. + + let deployedSubscription = new web3.eth.Contract(compiledSubscription.abi, data.contract_address); let deployedToken = new web3.eth.Contract( compiledToken.abi, @@ -19,14 +21,65 @@ window.onload = function() { '0x00e8baC402e187608C6585c435C9D35947770f5B' ); + deployedToken.methods.decimals().call(function(err, decimals) { + + let realTokenAmount = Number(data.amount_per_period * 10 ** decimals); + + console.log('realTokenAmount', realTokenAmount); + + let realGasPrice = Number(data.gas_price * 10 ** decimals); + + console.log('realGasPrice', realGasPrice); + web3.eth.getAccounts(function(err, accounts) { - deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]}, function(err, result) { + deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]}) + .on('transactionHash', function(hash){ + console.log('hash', hash); + + deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { + + nonce = parseInt(nonce) + 1; + + const parts = [ + // subscriber address + accounts[0], + // admin_address + data.admin_address, + // testing token + '0x00e8baC402e187608C6585c435C9D35947770f5B', + // data.amount_per_period + web3.utils.toTwosComplement(realTokenAmount), + // data.period_seconds + web3.utils.toTwosComplement(60), + // data.gas_price + web3.utils.toTwosComplement(realGasPrice), + // nonce + web3.utils.toTwosComplement(1), + // contributor_signature + data.signature + ]; + + console.log('parts', parts); - form.submit(); + deployedSubscription.methods.cancelSubscription( + ...parts + ).send({from: accounts[0]}) + .on('confirmation', function(confirmationNumber, receipt){ + console.log("receipt", receipt); + form.submit(); + }) + }) + }) + .on('confirmation', function(confirmationNumber, receipt){ + console.log("receipt", receipt); + }) + .on('error', function(err){ + console.log("err", err); }); }); + }); } }); diff --git a/app/grants/templates/grants/cancel.html b/app/grants/templates/grants/cancel.html index 22d076d2818..d78cb3501e7 100644 --- a/app/grants/templates/grants/cancel.html +++ b/app/grants/templates/grants/cancel.html @@ -79,6 +79,11 @@

+ + + + + @@ -110,6 +115,7 @@

{% include 'shared/footer.html' %} + From 452b1fe516cb0ebe0f90b198b4cd789f283fa097 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 13:23:03 -0600 Subject: [PATCH 04/11] run linters --- .../v2/js/grants/cancel_subscription.js | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/app/assets/v2/js/grants/cancel_subscription.js b/app/assets/v2/js/grants/cancel_subscription.js index f5732fdb01d..a6117d91691 100644 --- a/app/assets/v2/js/grants/cancel_subscription.js +++ b/app/assets/v2/js/grants/cancel_subscription.js @@ -31,55 +31,55 @@ window.onload = function() { console.log('realGasPrice', realGasPrice); - web3.eth.getAccounts(function(err, accounts) { + web3.eth.getAccounts(function(err, accounts) { - deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]}) - .on('transactionHash', function(hash){ - console.log('hash', hash); + deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]}) + .on('transactionHash', function(hash) { + console.log('hash', hash); - deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { + deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { - nonce = parseInt(nonce) + 1; + nonce = parseInt(nonce) + 1; - const parts = [ + const parts = [ // subscriber address - accounts[0], - // admin_address - data.admin_address, - // testing token - '0x00e8baC402e187608C6585c435C9D35947770f5B', - // data.amount_per_period - web3.utils.toTwosComplement(realTokenAmount), - // data.period_seconds - web3.utils.toTwosComplement(60), - // data.gas_price - web3.utils.toTwosComplement(realGasPrice), - // nonce - web3.utils.toTwosComplement(1), - // contributor_signature - data.signature - ]; - - console.log('parts', parts); - - deployedSubscription.methods.cancelSubscription( - ...parts - ).send({from: accounts[0]}) - .on('confirmation', function(confirmationNumber, receipt){ - console.log("receipt", receipt); - - form.submit(); - }) + accounts[0], + // admin_address + data.admin_address, + // testing token + '0x00e8baC402e187608C6585c435C9D35947770f5B', + // data.amount_per_period + web3.utils.toTwosComplement(realTokenAmount), + // data.period_seconds + web3.utils.toTwosComplement(60), + // data.gas_price + web3.utils.toTwosComplement(realGasPrice), + // nonce + web3.utils.toTwosComplement(1), + // contributor_signature + data.signature + ]; + + console.log('parts', parts); + + deployedSubscription.methods.cancelSubscription( + ...parts + ).send({from: accounts[0]}) + .on('confirmation', function(confirmationNumber, receipt) { + console.log('receipt', receipt); + + form.submit(); + }); + }); }) - }) - .on('confirmation', function(confirmationNumber, receipt){ - console.log("receipt", receipt); - }) - .on('error', function(err){ - console.log("err", err); + .on('confirmation', function(confirmationNumber, receipt) { + console.log('receipt', receipt); + }) + .on('error', function(err) { + console.log('err', err); + }); }); }); - }); } }); From 4641ea16ee974305dda3d4c36f46dadb61e5090c Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 13:27:55 -0600 Subject: [PATCH 05/11] fix stickler errors --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 47474b8b3db..b24b6825a12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,11 +12,11 @@ services: pgweb: image: sosedoff/pgweb environment: - - DATABASE_URL=postgres://postgres:postgres@db:5432?sslmode=disable + - DATABASE_URL=postgres://postgres:postgres@db:5432?sslmode=disable links: - - db + - db ports: - - "8081:8081" + - "8081:8081" depends_on: - db restart: "on-failure:10" From 0b2d92462cb703cfff84d49f3ab9ac22e8e2a525 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 14:09:44 -0600 Subject: [PATCH 06/11] period selection on grants/new is dynamic --- app/assets/v2/js/grants/fund_grant.js | 13 +------------ app/assets/v2/js/grants/new.js | 24 ++++++++++++++++++++---- app/grants/templates/grants/new.html | 17 +++++++++++++---- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index e6e5f859fa9..67de0649623 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -65,7 +65,6 @@ $(document).ready(function() { // Should add approval transactions to transaction history console.log('result', result); - deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { console.log('nonce1', nonce); @@ -130,27 +129,17 @@ $(document).ready(function() { console.log('data', data); form.submit(); - // + }) .catch((error)=>{ console.log(error); }); - - }); }); }); - }); - - }); }); - } }); - }); - -// will want to check if account already has a subscription. If a second is produced the timestamp will not function properly -// will need to check network to make sure users aren't submiting transactions to non-existant contracts diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 2778d75fd65..e69ec153b84 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -40,6 +40,23 @@ $(document).ready(function() { data[this.name] = this.value; }); + let requiredPeriodSeconds = 0; + if(data.frequency){ + //translate timeAmount&timeType to requiredPeriodSeconds + let periodSeconds = data.frequency; + if(data.frequency_unit=="minutes"){ + periodSeconds*=60 + }else if(data.frequency_unit=="hours"){ + periodSeconds*=3600 + }else if(data.frequency_unit=="days"){ + periodSeconds*=86400 + }else if(data.frequency_unit=="months"){ + periodSeconds*=2592000 + } + if(periodSeconds){ + requiredPeriodSeconds=periodSeconds + } + } // Begin New Deploy Subscription Contract let SubscriptionContract = new web3.eth.Contract(compiledSubscription.abi); @@ -55,12 +72,11 @@ $(document).ready(function() { // admin_address data.admin_address, // required token, if any. Will need to make dynamic - // data.token_address, - '0x0000000000000000000000000000000000000000', + data.token_address, // required tokenAmount - setting to zero - web3.utils.toTwosComplement(0), + web3.utils.toTwosComplement(data.required_amount), // data.frequency - web3.utils.toTwosComplement(0), + web3.utils.toTwosComplement(requiredPeriodSeconds), // data.gas_price web3.utils.toTwosComplement(0) ]; diff --git a/app/grants/templates/grants/new.html b/app/grants/templates/grants/new.html index 58b532a78ce..c9cdffe2453 100644 --- a/app/grants/templates/grants/new.html +++ b/app/grants/templates/grants/new.html @@ -104,6 +104,15 @@

{% trans "Create a Grant" %}

+
+ +
+
+ +
+
+
+
@@ -117,22 +126,22 @@

{% trans "Create a Grant" %}

- +
- +
From 36a326ad2fa1113522f483c11f8d2e3cbcd77cd7 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 14:11:35 -0600 Subject: [PATCH 07/11] changes per review by mbeacom --- app/assets/v2/js/grants/fund_grant.js | 9 +-------- app/assets/v2/js/grants/new.js | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index e6e5f859fa9..30d888c492a 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -130,26 +130,19 @@ $(document).ready(function() { console.log('data', data); form.submit(); - // + }) .catch((error)=>{ console.log(error); }); - - }); }); }); - }); - - }); }); - } }); - }); // will want to check if account already has a subscription. If a second is produced the timestamp will not function properly diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 2778d75fd65..138b18a9381 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -69,7 +69,6 @@ $(document).ready(function() { web3.eth.getAccounts(function(err, accounts) { web3.eth.net.getId(function(err, network) { - network = 'testrpc'; $('#network').val(network); SubscriptionContract.deploy({ data: compiledSubscription.bytecode, From 6e2a9085c7a0bc87e49eada383691d12476419a3 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 14:59:53 -0600 Subject: [PATCH 08/11] period selection on grants/fund is dynamic. plus some dopy edits on fund. --- app/assets/v2/js/grants/fund_grant.js | 28 +++++++++++++++++---------- app/assets/v2/js/grants/new.js | 3 ++- app/grants/templates/grants/fund.html | 6 +++--- app/grants/templates/grants/new.html | 1 - 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index 67de0649623..f8658ffa062 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -17,19 +17,27 @@ $(document).ready(function() { data[this.name] = this.value; }); - console.log(data); - - let value = 0; - let txData = '0x02'; // something like this to say, hardcoded VERSION 2, we're sending approved tokens - let gasLimit = 120000; - - // hardcode period seconds to monthly - let periodSeconds = 60; + let realPeriodSeconds = 0; + if(data.frequency){ + //translate timeAmount&timeType to requiredPeriodSeconds + let periodSeconds = data.frequency; + if(data.frequency_unit=="minutes"){ + periodSeconds*=60 + }else if(data.frequency_unit=="hours"){ + periodSeconds*=3600 + }else if(data.frequency_unit=="days"){ + periodSeconds*=86400 + }else if(data.frequency_unit=="months"){ + periodSeconds*=2592000 + } + if(periodSeconds){ + realPeriodSeconds=periodSeconds + } + } if (!data.gas_price) data.gas_price = 0; - let deployedSubscription = new web3.eth.Contract(compiledSubscription.abi, data.contract_address); // This token is only for testing @@ -83,7 +91,7 @@ $(document).ready(function() { // data.amount_per_period web3.utils.toTwosComplement(realTokenAmount), // data.period_seconds - web3.utils.toTwosComplement(60), + web3.utils.toTwosComplement(realPeriodSeconds), // data.gas_price web3.utils.toTwosComplement(realGasPrice), // nonce diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index e69ec153b84..129283a22c1 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -72,7 +72,8 @@ $(document).ready(function() { // admin_address data.admin_address, // required token, if any. Will need to make dynamic - data.token_address, + // data.token_address, + "0x0000000000000000000000000000000000000000", // required tokenAmount - setting to zero web3.utils.toTwosComplement(data.required_amount), // data.frequency diff --git a/app/grants/templates/grants/fund.html b/app/grants/templates/grants/fund.html index 552770727ea..e026cc5fc19 100644 --- a/app/grants/templates/grants/fund.html +++ b/app/grants/templates/grants/fund.html @@ -93,7 +93,7 @@

- +
@@ -102,7 +102,7 @@

- +
@@ -120,7 +120,7 @@

- +
diff --git a/app/grants/templates/grants/new.html b/app/grants/templates/grants/new.html index c9cdffe2453..7a3b4a52b8a 100644 --- a/app/grants/templates/grants/new.html +++ b/app/grants/templates/grants/new.html @@ -182,7 +182,6 @@

{% trans "Create a Grant" %}

- From 91bced5f1b1dc2c166256f5b735d275472a0ba67 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 15:04:48 -0600 Subject: [PATCH 09/11] remove network=testrpc --- app/assets/v2/js/grants/new.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 1ff29a8e74e..03ac8f794a0 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -86,7 +86,6 @@ $(document).ready(function() { web3.eth.getAccounts(function(err, accounts) { web3.eth.net.getId(function(err, network) { - $('#network').val(network); SubscriptionContract.deploy({ data: compiledSubscription.bytecode, arguments: args From 746c0419eed0be4dc3e6c14232729137bc623aa4 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Sat, 20 Oct 2018 15:07:34 -0600 Subject: [PATCH 10/11] run linters --- app/assets/v2/js/grants/fund_grant.js | 26 +++++++++++++------------ app/assets/v2/js/grants/new.js | 28 ++++++++++++++------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index f8658ffa062..00020e0fd82 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -18,20 +18,22 @@ $(document).ready(function() { }); let realPeriodSeconds = 0; - if(data.frequency){ - //translate timeAmount&timeType to requiredPeriodSeconds + + if (data.frequency) { + // translate timeAmount&timeType to requiredPeriodSeconds let periodSeconds = data.frequency; - if(data.frequency_unit=="minutes"){ - periodSeconds*=60 - }else if(data.frequency_unit=="hours"){ - periodSeconds*=3600 - }else if(data.frequency_unit=="days"){ - periodSeconds*=86400 - }else if(data.frequency_unit=="months"){ - periodSeconds*=2592000 + + if (data.frequency_unit == 'minutes') { + periodSeconds *= 60; + } else if (data.frequency_unit == 'hours') { + periodSeconds *= 3600; + } else if (data.frequency_unit == 'days') { + periodSeconds *= 86400; + } else if (data.frequency_unit == 'months') { + periodSeconds *= 2592000; } - if(periodSeconds){ - realPeriodSeconds=periodSeconds + if (periodSeconds) { + realPeriodSeconds = periodSeconds; } } diff --git a/app/assets/v2/js/grants/new.js b/app/assets/v2/js/grants/new.js index 03ac8f794a0..f5f09567f7f 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -41,20 +41,22 @@ $(document).ready(function() { }); let requiredPeriodSeconds = 0; - if(data.frequency){ - //translate timeAmount&timeType to requiredPeriodSeconds + + if (data.frequency) { + // translate timeAmount&timeType to requiredPeriodSeconds let periodSeconds = data.frequency; - if(data.frequency_unit=="minutes"){ - periodSeconds*=60 - }else if(data.frequency_unit=="hours"){ - periodSeconds*=3600 - }else if(data.frequency_unit=="days"){ - periodSeconds*=86400 - }else if(data.frequency_unit=="months"){ - periodSeconds*=2592000 + + if (data.frequency_unit == 'minutes') { + periodSeconds *= 60; + } else if (data.frequency_unit == 'hours') { + periodSeconds *= 3600; + } else if (data.frequency_unit == 'days') { + periodSeconds *= 86400; + } else if (data.frequency_unit == 'months') { + periodSeconds *= 2592000; } - if(periodSeconds){ - requiredPeriodSeconds=periodSeconds + if (periodSeconds) { + requiredPeriodSeconds = periodSeconds; } } @@ -73,7 +75,7 @@ $(document).ready(function() { data.admin_address, // required token, if any. Will need to make dynamic // data.token_address, - "0x0000000000000000000000000000000000000000", + '0x0000000000000000000000000000000000000000', // required tokenAmount - setting to zero web3.utils.toTwosComplement(data.required_amount), // data.frequency From 40bede7046130daef79e15717679dfb6feb52149 Mon Sep 17 00:00:00 2001 From: Kevin Seagraves Date: Mon, 22 Oct 2018 14:24:49 -0600 Subject: [PATCH 11/11] address PR comments --- app/assets/v2/js/shared.js | 3 +- app/grants/templates/grants/detail.html | 159 ++++++++++++------------ 2 files changed, 80 insertions(+), 82 deletions(-) diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index ac82e13b425..fb3fe6aa4c4 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -712,8 +712,7 @@ var trigger_primary_form_web3_hooks = function() { if ($('#primary_form').length) { var is_zero_balance_not_okay = document.location.href.indexOf('/faucet') == -1; - // var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase(); - var unlock_metamask_error = '0x0000000000000000000000000000000000000000'; + var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase(); if (typeof web3 == 'undefined') { $('#no_metamask_error').css('display', 'block'); diff --git a/app/grants/templates/grants/detail.html b/app/grants/templates/grants/detail.html index b6ac411bb81..ba4b72efb24 100644 --- a/app/grants/templates/grants/detail.html +++ b/app/grants/templates/grants/detail.html @@ -187,95 +187,94 @@

- -
-
-
-

- {% trans "Milestones" %} - {% if is_admin %}{% trans "Edit Milestones" %}{% endif %} -

-
- {% if milestones %} -
    - {% for milestone in milestones %} -
  • -
    {{ milestone.title }}
    -
    - {{ milestone.due_date }} - - {% if milestone.completion_date %} - {{ milestone.completion_date }} - {% else %} - {% trans "Present" %} - {% endif %} -
    -

    {{ milestone.description }}

    -
  • - {% endfor %} -
- {% else %} -

{% trans "No milestones currently set for this grant." %}

- {% endif %} +
+ -
-
- - {% if is_admin %} -
-
- {% csrf_token %} -
- -
- -
- -
- -
- -
-
-
- {% endif %} -
+
+
    - {% for item in activity %} -
  • -
    {{ item.title }}
    - -

    {{ item.description }}

    -
  • - {% empty %} - {% trans "No updates yet!" %} - {% endfor %} -
-
-
-
    - {% for item in gh_activity %} -
  • -
    {{ item.title }}
    - -

    {{ item.description }}

    -
  • - {% empty %} - {% trans "No Github activity yet!" %} - {% endfor %} +
  • {% trans "Updates" %}
  • +
  • {% trans "GitHub" %}
+ {% if is_admin %} +
+
+ {% csrf_token %} +
+ +
+ +
+ +
+ +
+ +
+
+
+ {% endif %} +
+
    + {% for item in activity %} +
  • +
    {{ item.title }}
    + +

    {{ item.description }}

    +
  • + {% empty %} + {% trans "No updates yet!" %} + {% endfor %} +
+
+
+
    + {% for item in gh_activity %} +
  • +
    {{ item.title }}
    + +

    {{ item.description }}

    +
  • + {% empty %} + {% trans "No Github activity yet!" %} + {% endfor %} +
+
-
{% include 'shared/current_profile.html' %}