-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Kudos v1 #2492
Kudos v1 #2492
Conversation
Updates to handle the latest Kudos contract changes
WIP Kudos integrate
Deploy latest
Syncing this way still sucks though
@@ -75,7 +76,12 @@ def insert_settings(request): | |||
username__iexact=context['github_handle'], | |||
web3_type='v3', | |||
).exclude(txid='') | |||
context['unclaimed_kudos'] = KudosTransfer.objects.filter( | |||
receive_txid='', username__iexact="@" + context['github_handle'], web3_type='v3', |
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.
Can we update this model to directly relate to Profile
?
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.
@@ -25,7 +25,7 @@ window.onload = function() { | |||
} | |||
ipfs.catText(document.ipfs_key_to_secret, function(err, key2) { | |||
if (err) { | |||
_alert('could not reach IPFS. please try again later.', 'error'); | |||
_alert('Could not reach IPFS. please try again later.', '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.
😅
@@ -0,0 +1,33 @@ | |||
/** | |||
* Transform eth to usd |
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.
🙌
|
||
var rotate_kudos_msg = function() { | ||
var messages = [ | ||
[ 'Buy Me!', 'I\'m looking for a good home.' ], |
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.
@octavioamu @jasonrhaas Does this apply to all of the copy? Like the alert text for cloning errors?
app/dashboard/views.py
Outdated
owner_address=to_checksum_address(context['preferred_payout_address']), | ||
contract__network=settings.KUDOS_NETWORK | ||
).order_by(order_by) | ||
sent_kudos = Token.objects.filter( |
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.
We should select_related
on the 'kudos_transfer', 'contract'
since we're filtering on values from it here.
if context['preferred_payout_address']: | ||
owned_kudos = Token.objects.filter( | ||
owner_address=to_checksum_address(context['preferred_payout_address']), | ||
contract__network=settings.KUDOS_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.
We should select_related
on the 'contract'
since we're filtering on values from it here.
app/dashboard/views.py
Outdated
# Send kudos data when new preferred address | ||
address = request.POST.get('address') | ||
context['kudos'] = Token.objects.filter(owner_address=to_checksum_address(address)).order_by(order_by) | ||
context['sent_kudos'] = Token.objects.filter(kudos_transfer__from_address=to_checksum_address(address)).order_by(order_by) |
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.
We should select_related
on the 'kudos_transfer'
since we're filtering on values from it here.
app/dashboard/views.py
Outdated
datarequest = request.POST.get('request') | ||
order_by = request.GET.get('order_by', '-modified_on') | ||
# use Django’s pagination | ||
# https://docs.djangoproject.com/en/dev/topics/pagination/ |
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.
Can we omit these comments? Also, should we use paginator.get_page(page)
vs the manual handling of emptypage/integer/etc ?
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.
We can evaluate, I don't really know if with get_page we can do the same, I have seen get_page looks simpler. Right now each request is controlled by an ajax request from front end and then is returned the html cards json that a way (not nearly the best I know) to avoid redo all the front end logic two times (when page loads and when load more is clicked) In that way we are reusing the django template (quicker) instead of fill html with js. I think in a V2 we should go to a full ajax > json way and then change to get_page
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.
So I was taking a look go get_page and I think doesn't make change to wait to change, code gets more simpler, making the changes here!
app/dashboard/views.py
Outdated
if datarequest == 'mykudos': | ||
context['kudos'] = Token.objects.filter(owner_address=to_checksum_address(address)).order_by(order_by) | ||
paginator = Paginator(context['kudos'], results_per_page) | ||
else : |
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.
whitespace
The issue was that is was using the incorrect tokenId. It was using kudos_token.id (pk) instead of the kudos_token.token_id (contract token id).
…en QAed and looks good
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.
yolo 🎲
Great job @mbeacom |
Description
Kudos!
Checklist
Affected core subsystem(s)
Testing
To run this locally you must have the solidity contract code locally on your machine. It should be at the same directory level as this repo. The repository is called
gitcoin-erc721
. After you have cloned that repo, follow these steps inside this repo:git checkout kudos-v1
export TEST_MNEMONIC="Your test mnemonic"
docker-compose pull
to pull in all the latest imagesdocker-compose build --force-rm
to force a fresh build of the web docker container./fresh_start
to remove old docker volumes, spin up fresh instances, deploy the kudos contract locally, and finally mint all the kudos. Kudos will be minted to the first account in the wallet. Contact the Gitcoin core team to get the test keys for Rinkeby.Refers/Fixes