-
-
Notifications
You must be signed in to change notification settings - Fork 776
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
minimum viable subminer #3055
Conversation
@@ -0,0 +1,85 @@ | |||
# -*- coding: utf-8 -*- | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() | ||
|
There was a problem hiding this comment.
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
app/grants/models.py
Outdated
'tokenAddress':Web3.toChecksumAddress(tokenAddress), | ||
'tokenAmount':int(tokenAmount), | ||
'periodSeconds':int(periodSeconds), | ||
'gasPrice':int(gasPrice), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E231 missing whitespace after ':'
app/grants/models.py
Outdated
'tokenAmount':int(tokenAmount), | ||
'periodSeconds':int(periodSeconds), | ||
'gasPrice':int(gasPrice), | ||
'nonce':int(nonce), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E231 missing whitespace after ':'
app/grants/models.py
Outdated
'periodSeconds':int(periodSeconds), | ||
'gasPrice':int(gasPrice), | ||
'nonce':int(nonce), | ||
'signature':signature, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E231 missing whitespace after ':'
app/marketing/mails.py
Outdated
@@ -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): |
There was a problem hiding this comment.
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 ") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
@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" } ] |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() | ||
|
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
app/dashboard/utils.py
Outdated
JSONStore.objects.create(key=key, view=view, data=[new_nonce]) | ||
|
||
return new_nonce | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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 ']'
app/grants/models.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E113 unexpected indentation
app/grants/models.py
Outdated
).call() | ||
|
||
|
||
======= |
There was a problem hiding this comment.
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
app/grants/models.py
Outdated
@@ -316,6 +490,7 @@ def successful_contribution(self, kwargs): | |||
contribution = Contribution.objects.create(**contribution_kwargs) | |||
successful_contribution(self.grant, self) | |||
return contribution | |||
>>>>>>> grantz |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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'): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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" } ] |
There was a problem hiding this comment.
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 ']'
Description
I spent 2 hours today putting together a a Minimum Viable Subminer (MVS). MVS which can be run with
it will run `executeSubscription() for any subscription
Checklist
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