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

Detect Mints #857

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions app/migrations/versions/efb8537855a8_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add mint enum

Revision ID: efb8537855a8
Revises: 50fa8260cee7
Create Date: 2022-09-15 14:21:37.580109

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'efb8537855a8'
down_revision = '50fa8260cee7'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute("ALTER TYPE transfertypeenum ADD VALUE 'MINT'")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
return
# ### end Alembic commands ###
5 changes: 4 additions & 1 deletion app/server/api/credit_transfer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,15 @@ def post(self):
else:
send_transfer_account = create_transfer_account_if_required(sender_blockchain_address, token, TransferAccountType.EXTERNAL)
receive_transfer_account = create_transfer_account_if_required(recipient_blockchain_address, token, TransferAccountType.EXTERNAL)
transfer_type = TransferTypeEnum.PAYMENT
if sender_blockchain_address == '0x0000000000000000000000000000000000000000':
transfer_type = TransferTypeEnum.MINT
transfer = CreditTransfer(
transfer_amount,
token=token,
sender_transfer_account=send_transfer_account,
recipient_transfer_account=receive_transfer_account,
transfer_type=TransferTypeEnum.PAYMENT,
transfer_type=transfer_type,
sender_user=maybe_sender_user,
recipient_user=maybe_recipient_user,
require_sufficient_balance=False,
Expand Down
1 change: 1 addition & 0 deletions app/server/utils/transfer_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class TransferTypeEnum(enum.Enum):
WITHDRAWAL = "WITHDRAWAL"
EXCHANGE = "EXCHANGE"
FEE = "FEE"
MINT = "MINT"


class TransferSubTypeEnum(enum.Enum):
Expand Down
2 changes: 1 addition & 1 deletion app/server/utils/transfer_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def transfer_filters(self):
'name': "Transfer Type",
'table': CreditTransfer.__tablename__,
'type': TransferFilterEnum.DISCRETE,
'values': ['PAYMENT', 'DEPOSIT', 'WITHDRAWAL', 'EXCHANGE', 'FEE', 'DISBURSEMENT', 'RECLAMATION', 'AGENT_IN', 'AGENT_OUT', 'INCENTIVE']
'values': ['PAYMENT', 'DEPOSIT', 'WITHDRAWAL', 'EXCHANGE', 'FEE', 'DISBURSEMENT', 'RECLAMATION', 'AGENT_IN', 'AGENT_OUT', 'INCENTIVE', 'MINT']
},
}

Expand Down