diff --git a/app/assets/v2/css/grants/detail.css b/app/assets/v2/css/grants/detail.css index 669f3752242..f1374a20ba0 100644 --- a/app/assets/v2/css/grants/detail.css +++ b/app/assets/v2/css/grants/detail.css @@ -128,6 +128,10 @@ textarea.editable { animation: rotation2 0.1s linear; } +.update-milestone { + background-color: white; +} + @keyframes rotation { from { transform: rotate(0deg); @@ -161,4 +165,4 @@ textarea.editable { display: flex; justify-content: center; } -} \ No newline at end of file +} diff --git a/app/assets/v2/js/grants/cancel_subscription.js b/app/assets/v2/js/grants/cancel_subscription.js index 6eec32d09b9..a6117d91691 100644 --- a/app/assets/v2/js/grants/cancel_subscription.js +++ b/app/assets/v2/js/grants/cancel_subscription.js @@ -11,20 +11,73 @@ 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, // data.token_address - '0xFD9C55bf4B75Ef115749cF76E9083c4241D7a7eB' + '0x00e8baC402e187608C6585c435C9D35947770f5B' ); - web3.eth.getAccounts(function(err, accounts) { + 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]}) + .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 + ]; - deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0], gas: 50000}, function(err, result) { + 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/assets/v2/js/grants/fund_grant.js b/app/assets/v2/js/grants/fund_grant.js index 6a02329a70c..9f113629847 100644 --- a/app/assets/v2/js/grants/fund_grant.js +++ b/app/assets/v2/js/grants/fund_grant.js @@ -17,28 +17,42 @@ $(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 - 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 +60,7 @@ $(document).ready(function() { let realGasPrice = Number(data.gas_price * 10 ** decimals); + console.log('realGasPrice', realGasPrice); web3.eth.getAccounts(function(err, accounts) { @@ -55,12 +70,11 @@ $(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); - deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { console.log('nonce1', nonce); @@ -75,13 +89,13 @@ $(document).ready(function() { // admin_address data.admin_address, // testing token - '0xFD9C55bf4B75Ef115749cF76E9083c4241D7a7eB', + '0x00e8baC402e187608C6585c435C9D35947770f5B', // data.amount_per_period - web3.utils.toTwosComplement(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(data.gas_price), + web3.utils.toTwosComplement(realGasPrice), // nonce web3.utils.toTwosComplement(nonce) ]; @@ -130,18 +144,12 @@ $(document).ready(function() { .catch((error)=>{ console.log(error); }); - - }); }); }); - }); - - }); }); - } }); @@ -159,8 +167,4 @@ $(document).ready(function() { }); $('#js-token').select2(); }); - }); - -// 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 43db141186d..f5f09567f7f 100644 --- a/app/assets/v2/js/grants/new.js +++ b/app/assets/v2/js/grants/new.js @@ -40,6 +40,25 @@ $(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); @@ -58,9 +77,9 @@ $(document).ready(function() { // data.token_address, '0x0000000000000000000000000000000000000000', // 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/cancel.html b/app/grants/templates/grants/cancel.html index 88d1a3bc219..7454abcbbb9 100644 --- a/app/grants/templates/grants/cancel.html +++ b/app/grants/templates/grants/cancel.html @@ -83,6 +83,11 @@

+ + + + + @@ -102,6 +107,7 @@

{% include 'shared/footer.html' %} + diff --git a/app/grants/templates/grants/detail.html b/app/grants/templates/grants/detail.html index e7197fc5457..74f0e27baaf 100644 --- a/app/grants/templates/grants/detail.html +++ b/app/grants/templates/grants/detail.html @@ -189,94 +189,97 @@

-
-
-
-

- {% 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 %} +
+
+
+
+

+ {% 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' %} {% include 'shared/bottom_notification.html' %} {% include 'shared/analytics.html' %} diff --git a/app/grants/templates/grants/fund.html b/app/grants/templates/grants/fund.html index b29d861124e..e026cc5fc19 100644 --- a/app/grants/templates/grants/fund.html +++ b/app/grants/templates/grants/fund.html @@ -84,7 +84,6 @@

-
@@ -93,9 +92,8 @@

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

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

- +
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 %}

diff --git a/app/grants/templates/grants/new.html b/app/grants/templates/grants/new.html index 58b532a78ce..7a3b4a52b8a 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" %}

- +
- +
@@ -173,7 +182,6 @@

{% trans "Create a Grant" %}

- 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"