Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimum viable subminer #3055

Merged
merged 17 commits into from
Dec 4, 2018
Merged

minimum viable subminer #3055

merged 17 commits into from
Dec 4, 2018

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Dec 3, 2018

Description

I spent 2 hours today putting together a a Minimum Viable Subminer (MVS). MVS which can be run with

./manage.py subminer rinkeby

it will run `executeSubscription() for any subscription

Checklist
  • linter status: 100% pass
  • changes don't break existing behavior
  • commit message follows commit guidelines
Affected core subsystem(s)

grants / database

Testing

Test it locally.

Heres an example successful tx https://rinkeby.etherscan.io/tx/0x274c159a6d89513c3f0b533a5329bef4ce02b3ffc770bece9a8ce5d269319f72

Refers/Fixes

#2424
#2324

@@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

'''
import logging

from django.conf import settings

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'django.conf.settings' imported but unused

from django.core.management.base import BaseCommand
from django.utils import timezone

from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Subscription' imported but unused
F401 'grants.models.Update' imported but unused

# setup
network = options['network']

#TODO - when https://gitcoincore.slack.com/archives/CBDTKB59A/p1543864404079500

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '


for subscription in subs:
is_ready_to_be_processed_db = subscription.get_is_ready_to_be_processed_from_db()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

'tokenAddress':Web3.toChecksumAddress(tokenAddress),
'tokenAmount':int(tokenAmount),
'periodSeconds':int(periodSeconds),
'gasPrice':int(gasPrice),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ':'

'tokenAmount':int(tokenAmount),
'periodSeconds':int(periodSeconds),
'gasPrice':int(gasPrice),
'nonce':int(nonce),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ':'

'periodSeconds':int(periodSeconds),
'gasPrice':int(gasPrice),
'nonce':int(nonce),
'signature':signature,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ':'

@@ -364,6 +364,28 @@ def warn_account_out_of_eth(account, balance, denomination):
finally:
translation.activate(cur_language)

def warn_subscription_failed(subscription, txid, status):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

try:
setup_lang(to_email)
subject = subscription.pk + str(_(" subscription failed"))
body_str = _("is down to ")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F841 local variable 'body_str' is assigned to but never used

if not was_success:
warn_subscription_failed(subscription, txid, status)
else:
print("TODO: upon success, any DB mutations, send emails, handle failure")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captnseagraves we'll need to hook up the method ur writing here.

@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #3055 into grantz will decrease coverage by 0.02%.
The diff coverage is 15.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##           grantz    #3055      +/-   ##
==========================================
- Coverage   30.16%   30.14%   -0.03%     
==========================================
  Files         190      191       +1     
  Lines       14332    14372      +40     
  Branches     1898     1886      -12     
==========================================
+ Hits         4323     4332       +9     
- Misses       9868     9902      +34     
+ Partials      141      138       -3
Impacted Files Coverage Δ
app/grants/management/commands/subminer.py 0% <0%> (ø)
...management/commands/warn_when_wallet_out_of_eth.py 0% <0%> (ø) ⬆️
app/app/settings.py 80.23% <100%> (+0.15%) ⬆️
app/grants/models.py 69.01% <29.62%> (-24.17%) ⬇️
app/marketing/mails.py 11.53% <8.33%> (-0.08%) ⬇️
app/avatar/utils.py 17.28% <0%> (+0.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4296dea...f4f4c03. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #3055 into grantz will decrease coverage by 0.06%.
The diff coverage is 16.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           grantz    #3055      +/-   ##
==========================================
- Coverage    30.1%   30.03%   -0.07%     
==========================================
  Files         190      191       +1     
  Lines       14360    14436      +76     
  Branches     1901     1890      -11     
==========================================
+ Hits         4323     4336      +13     
- Misses       9896     9962      +66     
+ Partials      141      138       -3
Impacted Files Coverage Δ
app/grants/management/commands/subminer.py 0% <0%> (ø)
...management/commands/warn_when_wallet_out_of_eth.py 0% <0%> (ø) ⬆️
app/app/settings.py 80.23% <100%> (+0.15%) ⬆️
app/dashboard/tokens.py 69.23% <100%> (ø) ⬆️
app/kudos/views.py 22.69% <100%> (+0.82%) ⬆️
app/grants/models.py 60% <27.63%> (-25.11%) ⬇️
app/dashboard/utils.py 35.35% <5.88%> (-1.46%) ⬇️
app/marketing/mails.py 11.5% <8.33%> (-0.07%) ⬇️
app/dashboard/views.py 12.41% <0%> (+0.07%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec184e6...e111394. Read the comment docs.

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'


def get_is_ready_to_be_processed_from_web3(self):
"""Return true if subscription is ready to be processed according to web3."""
the_args = args = self.get_subscription_hash_arguments()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F841 local variable 'the_args' is assigned to but never used

if is_ready_to_be_processed_db:
print(" -- (ready via db) ")
are_we_past_next_valid_timestamp = subscription.get_are_we_past_next_valid_timestamp()
#is_ready_to_be_processed_web3 = subscription.get_is_subscription_ready_from_web3()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

print(" -- (ready via db) ")
are_we_past_next_valid_timestamp = subscription.get_are_we_past_next_valid_timestamp()
#is_ready_to_be_processed_web3 = subscription.get_is_subscription_ready_from_web3()
#is_active_web3 = subscription.get_is_active_from_web3()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

are_we_past_next_valid_timestamp = subscription.get_are_we_past_next_valid_timestamp()
#is_ready_to_be_processed_web3 = subscription.get_is_subscription_ready_from_web3()
#is_active_web3 = subscription.get_is_active_from_web3()
#signer = subscription.get_subscription_signer_from_web3()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

#is_ready_to_be_processed_web3 = subscription.get_is_subscription_ready_from_web3()
#is_active_web3 = subscription.get_is_active_from_web3()
#signer = subscription.get_subscription_signer_from_web3()
#print(are_we_past_next_valid_timestamp, is_ready_to_be_processed_web3, is_active_web3, signer)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

return timezone.now().timestamp() > self.get_next_valid_timestamp(address)


def get_is_subscription_ready_from_web3(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E303 too many blank lines (2)

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

from django.core.management.base import BaseCommand
from django.utils import timezone

from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Update' imported but unused

print(" -- *executing* ")
try:
txid = subscription.do_execute_subscription_via_web3()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

txid = subscription.do_execute_subscription_via_web3()

print(f" -- *waiting for mine* (txid {txid}) ")
while not has_tx_mined(txid, subscription.grant.network):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F821 undefined name 'has_tx_mined'


print(f" -- *waiting for mine* (txid {txid}) ")
while not has_tx_mined(txid, subscription.grant.network):
time.sleep(10)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F821 undefined name 'time'

print(f" -- *waiting for mine* (txid {txid}) ")
while not has_tx_mined(txid, subscription.grant.network):
time.sleep(10)
status, timestamp = get_tx_status(txid, subscription.grant.network, timezone.now())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F821 undefined name 'get_tx_status'

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@@ -364,6 +364,28 @@ def warn_account_out_of_eth(account, balance, denomination):
finally:
translation.activate(cur_language)

def warn_subscription_failed(subscription, txid, status, error):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

from django.core.management.base import BaseCommand
from django.utils import timezone

from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Update' imported but unused

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@@ -696,3 +696,33 @@ def get_tx_status(txid, network, created_on):
except:
pass
return status, timestamp

def get_nonce(network, address):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

nonce_from_db = 0
try:
nonce_from_db = JSONStore.objects.get(key=key, view=view).data[0]
nonce_from_db += 1 # increment by 1 bc we need to be 1 higher than last txid

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E261 at least two spaces before inline comment

JSONStore.objects.create(key=key, view=view, data=[new_nonce])

return new_nonce

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W391 blank line at end of file

from django.utils import timezone
from dashboard.utils import has_tx_mined

from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Update' imported but unused

logging.getLogger("web3").setLevel(logging.WARNING)
logging.getLogger("marketing.mails").setLevel(logging.WARNING)

def has_mined(txid, subscription):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

)
web3 = get_web3(self.grant.network)
signed_txn = web3.eth.account.signTransaction(tx, private_key=settings.GRANTS_PRIVATE_KEY)
return web3.eth.sendRawTransaction(signed_txn.rawTransaction)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

)
web3 = get_web3(self.grant.network)
signed_txn = web3.eth.account.signTransaction(tx, private_key=settings.GRANTS_PRIVATE_KEY)
return web3.eth.sendRawTransaction(signed_txn.rawTransaction)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace




def helper_tx_dict(self, minutes_to_confirm_within=5):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E303 too many blank lines (3)

nonce = subs.get_nonce(_from)
signature = subs.contributor_signature

#TODO - figure out the number of decimals

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

'from': Web3.toChecksumAddress(_from),
'to': Web3.toChecksumAddress(to),
'tokenAddress': Web3.toChecksumAddress(tokenAddress),
'tokenAmount': int(tokenAmount * 10**decimals),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E221 multiple spaces before operator

from django.utils import timezone

from dashboard.utils import has_tx_mined
from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Update' imported but unused

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

from django.utils import timezone

from dashboard.utils import has_tx_mined
from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Update' imported but unused

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@@ -304,6 +322,162 @@ def __str__(self):
"""Return the string representation of a Subscription."""
return f"id: {self.pk}, active: {self.active}, subscription_hash: {self.subscription_hash}"

<<<<<<< HEAD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E305 expected 2 blank lines after class or function definition, found 1
E999 SyntaxError: invalid syntax
E227 missing whitespace around bitwise or shift operator
E225 missing whitespace around operator

@@ -304,6 +322,162 @@ def __str__(self):
"""Return the string representation of a Subscription."""
return f"id: {self.pk}, active: {self.active}, subscription_hash: {self.subscription_hash}"

<<<<<<< HEAD
def get_nonce(self, address):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E113 unexpected indentation

).call()


=======

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E225 missing whitespace around operator

@@ -316,6 +490,7 @@ def successful_contribution(self, kwargs):
contribution = Contribution.objects.create(**contribution_kwargs)
successful_contribution(self.grant, self)
return contribution
>>>>>>> grantz

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E225 missing whitespace around operator

from django.utils import timezone

from dashboard.utils import has_tx_mined
from grants.models import Contribution, Grant, Milestone, Subscription, Update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'grants.models.Contribution' imported but unused
F401 'grants.models.Milestone' imported but unused
F401 'grants.models.Subscription' imported but unused
F401 'grants.models.Update' imported but unused

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@@ -299,14 +317,173 @@ class Subscription(SuperModel):
null=True,
help_text=_('The Subscription contributor\'s Profile.'),
)
last_contribution_date = models.DateField(help_text=_('The last contribution date'), default=timezone.datetime(1990, 1, 1))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (127 > 120 characters)

@@ -299,14 +317,173 @@ class Subscription(SuperModel):
null=True,
help_text=_('The Subscription contributor\'s Profile.'),
)
last_contribution_date = models.DateField(help_text=_('The last contribution date'), default=timezone.datetime(1990, 1, 1))
next_contribution_date = models.DateField(help_text=_('The next contribution date'), default=timezone.datetime(1990, 1, 1))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (127 > 120 characters)

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'



def addr_to_token(addr):
for token in get_tokens():
def addr_to_token(addr, network='mainnet'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

txid = subscription.do_execute_subscription_via_web3()
print(f" -- *waiting for mine* (txid {txid}) ")
while not has_mined(txid, subscription):
time.sleep(10)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F821 undefined name 'time'

print(f" -- *waiting for mine* (txid {txid}) ")
while not has_mined(txid, subscription):
time.sleep(10)
status, timestamp = get_tx_status(txid, subscription.grant.network, timezone.now())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F821 undefined name 'get_tx_status'

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@property
def abi(self):
"""Return grants abi."""
abi = [ { "constant": True, "inputs": [], "name": "requiredGasPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredToAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredPeriodSeconds", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "requiredTokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "contractVersion", "outputs": [ { "name": "", "type": "uint8" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "address" } ], "name": "extraNonce", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [], "name": "author", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "", "type": "bytes32" } ], "name": "nextValidTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_toAddress", "type": "address" }, { "name": "_tokenAddress", "type": "address" }, { "name": "_tokenAmount", "type": "uint256" }, { "name": "_periodSeconds", "type": "uint256" }, { "name": "_gasPrice", "type": "uint256" }, { "name": "_version", "type": "uint8" } ], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": True, "stateMutability": "payable", "type": "fallback" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "ExecuteSubscription", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "to", "type": "address" }, { "indexed": False, "name": "tokenAddress", "type": "address" }, { "indexed": False, "name": "tokenAmount", "type": "uint256" }, { "indexed": False, "name": "periodSeconds", "type": "uint256" }, { "indexed": False, "name": "gasPrice", "type": "uint256" }, { "indexed": False, "name": "nonce", "type": "uint256" } ], "name": "CancelSubscription", "type": "event" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "gracePeriodSeconds", "type": "uint256" } ], "name": "isSubscriptionActive", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" } ], "name": "getSubscriptionHash", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": True, "inputs": [ { "name": "subscriptionHash", "type": "bytes32" }, { "name": "signature", "type": "bytes" } ], "name": "getSubscriptionSigner", "outputs": [ { "name": "", "type": "address" } ], "payable": False, "stateMutability": "pure", "type": "function" }, { "constant": True, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "isSubscriptionReady", "outputs": [ { "name": "", "type": "bool" } ], "payable": False, "stateMutability": "view", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "cancelSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "tokenAmount", "type": "uint256" }, { "name": "periodSeconds", "type": "uint256" }, { "name": "gasPrice", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "signature", "type": "bytes" } ], "name": "executeSubscription", "outputs": [ { "name": "success", "type": "bool" } ], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [], "name": "endContract", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" } ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E201 whitespace after '['
E201 whitespace after '{'
E501 line too long (9244 > 120 characters)
E202 whitespace before '}'
E202 whitespace before ']'

@owocki owocki merged commit e111394 into grantz Dec 4, 2018
@thelostone-mc thelostone-mc deleted the kevin/subminer branch December 28, 2018 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants