Skip to content

Commit

Permalink
set approval tx hash to sync with final subscription
Browse files Browse the repository at this point in the history
remove setting approve tx an extra time

better subminer error for one-time subs
  • Loading branch information
danlipert committed Jun 5, 2019
1 parent b17efb5 commit 7337c1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/v2/js/grants/fund.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ $(document).ready(function() {
console.log('1', error);
_alert({ message: gettext('Your approval transaction failed. Please try again.')}, 'error');
}).on('transactionHash', function(transactionHash) {
$('#sub_new_approve_tx_id').val(transactionHash);
if (data.num_periods == 1) {
// call splitter after approval
splitPayment(accounts[0], data.admin_address, gitcoinDonationAddress, Number(grant_amount * Math.pow(10, decimals)).toLocaleString('fullwide', {useGrouping: false}), Number(gitcoin_grant_amount * Math.pow(10, decimals)).toLocaleString('fullwide', {useGrouping: false}));
Expand Down Expand Up @@ -243,7 +244,6 @@ $(document).ready(function() {
const subscribeToGrant = (transactionHash) => {
web3.eth.getAccounts(function(err, accounts) {
deployedToken.methods.decimals().call(function(err, decimals) {
$('#sub_new_approve_tx_id').val(transactionHash);
const linkURL = etherscan_tx_url(transactionHash);
let token_address = $('#js-token').length ? $('#js-token').val() : $('#sub_token_address').val();
let data = {
Expand Down
6 changes: 6 additions & 0 deletions app/grants/management/commands/subminer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def process_subscription(subscription, live):
elif not has_approve_tx_mined:
logger.info(f" -- ( NOT ready via approve tx, will be ready when {subscription.new_approve_tx_id} mines) ")
else:
if subscription.contributor_signature == "onetime":
subscription.error = True
subscription.subminer_comments = "One time subscription"
subscription.save()
logger.info('skipping one time subscription: %s' % subscription.id)
return
web3_hash_arguments = subscription.get_subscription_hash_arguments()
if web3_hash_arguments['periodSeconds'] < METATX_FREE_INTERVAL_SECONDS and web3_hash_arguments['gasPrice'] <= METATX_GAS_PRICE_THRESHOLD:
subscription.error = True
Expand Down

0 comments on commit 7337c1a

Please sign in to comment.