Skip to content
Open
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
24 changes: 11 additions & 13 deletions contracts/Democratic_Rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#The inagaural democratic rewards program will focus on the advocacy for blockchain and cryptocurrency acceptance.


from algosdk import account, encoding, mnemonic,transaction
from algosdk import account, encoding, mnemonic, transaction
from algosdk.future.transaction import AssetTransferTxn, PaymentTxn
from algosdk.v2client import algod

Expand All @@ -12,20 +12,20 @@
algod_token = ""
# Initializes Client for node
headers = {"X-API-Key": algod_token }
algod_client = algod.AlgodClient(algod_token,algod_address,headers)
algod_client = algod.AlgodClient(algod_token, algod_address, headers)
reserve_address = "" # Put in main fund address here
reserve_mnemonic = "" # Put in main fund receiver_mnemonic here
reserve_key = mnemonic.to_private_key(reserve_mnemonic)
asset_id = # Probably will want to change if when we create a new asset

def choice_trade(sender, key, receiver, amount, index,comment):
def choice_trade(sender, key, receiver, amount, index, comment):
parameters = algod_client.suggested_params()
transaction = AssetTransferTxn(sender, parameters, receiver, amount, index,note=comment)
#Defines an inital transaction for choice Coin
transaction = AssetTransferTxn(sender, parameters, receiver, amount, index, note=comment)
# Defines an inital transaction for choice Coin
signature = transaction.sign(key)
#Signs the transaction with the senders private key
# Signs the transaction with the senders private key
algod_client.send_transaction(signature)
#Sends the transaction with the signature
# Sends the transaction with the signature
final = transaction.get_txid()
return True, final

Expand All @@ -34,16 +34,14 @@ def choice_trade(sender, key, receiver, amount, index,comment):

def init_democratic_participation():
parameters = algod_client.suggested_params()
choice_trade(reserve_address,reserve_key,participation_awards,"Value",asset_id,'Initial Democratic Participation Rewards')
choice_trade(reserve_address, reserve_key, participation_awards, "Value", asset_id, 'Initial Democratic Participation Rewards')


def democratic_awards(query,address):
def democratic_awards(query, address):
if query == 'Letter to local legistature':
comment = 'Here is your Choice Coin Reward. \n Thanks for sending a letter to your local government'
reward_amount = ""#Amount of Reward
choice_trade(fund_address, fund_key, address, reward_amount, asset_id,comment)
else:
comment = "Here is you Choice Coin Reward! \n Thanks for participating in our democracy!"
reward_amount = ""#Amount of Reward
choice_trade(fund_address, fund_key, address, reward_amount, asset_id,comment)
reward_amount = "" # Amount of Reward
choice_trade(fund_address, fund_key, address, reward_amount, asset_id, comment)