Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Dev -> prod #133

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions indexer_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ async def handle_list_update(
)


logger.info(f"updating list..... {data}")
logger.info(f"updating list from result..... {data}")

listObject = await List.objects.filter(on_chain_id=data["list_id"]).aupdate(
listObject = await List.objects.filter(on_chain_id=data["id"]).aupdate(
owner_id=data["owner"],
default_registration_status=data["default_registration_status"],
name=data["name"],
Expand Down
21 changes: 21 additions & 0 deletions pots/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import requests
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from django.conf import settings

from accounts.serializers import SIMPLE_ACCOUNT_EXAMPLE, AccountSerializer
from base.serializers import TwoDecimalPlacesField
from tokens.serializers import SIMPLE_TOKEN_EXAMPLE, TokenSerializer
Expand Down Expand Up @@ -316,6 +319,24 @@ class MpdaoVoterSerializer(serializers.Serializer):
locking_positions = LockingPositionSerializer(many=True)
vote_positions = VotePositionSerializer(many=True)

staking_token_balance = serializers.SerializerMethodField()

staking_token_id = serializers.SerializerMethodField() # mpdao is only available on mainnet,

def get_staking_token_balance(self, obj):
voter_id = obj.get('voter_id')
url = f"https://rpc.web4.near.page/account/meta-pool.near/view/ft_balance_of?account_id={voter_id}"
response = requests.get(url)
if response.status_code == 200:
balance = response.json()
return balance
return "0"

def get_staking_token_id(self, obj):
return "meta-pool.near"




class PaginatedMpdaoVotersResponseSerializer(serializers.Serializer):
count = serializers.IntegerField()
Expand Down
Loading