Archon Proposal - Gov Account Sells, Buys, Stakes, Unstakes, Witness Vote, and automation!


account = "archon-gov"


nodelist = NodeList()
nodelist.update_nodes()
nodes = nodelist.get_nodes(hive=True)
hive = Hive(node=nodes)


def sell_token(symbol, amount, price, account):
    he_market = Market(blockchain_instance=hive)
    market_trans = he_market.sell(account, amount, symbol, price)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(market_trans), "market_tx", account)


def buy_token(symbol, amount, price, account):
    he_market = Market(blockchain_instance=hive)
    market_trans = he_market.buy(account, amount, symbol, price)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(market_trans), "market_tx", account)


def stake_token(amount, symbol, account):
    he_wallet = Wallet(account, blockchain_instance=hive)
    stake_trans = he_wallet.stake(amount=amount, symbol=symbol, receiver=account)
    time.sleep(1)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(stake_trans), "stake_tx", account)


def unstake_token(amount, symbol, account):
    he_wallet = Wallet(account, blockchain_instance=hive)
    unstake_trans = he_wallet.unstake(amount=amount, symbol=symbol)
    time.sleep(1)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(unstake_trans), "stake_tx", account)


def transfer_hive(to, amount, asset, memo, account):
    hive_account = Account(account, blockchain_instance=hive)
    hive_tx = hive_account.transfer(to, amount, asset, memo, account)
    time.sleep(4)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(hive_tx), "hive_tx", account)


def power_up_hive(to, amount, account):
    hive_account = Account(account, blockchain_instance=hive)    
    hive_power_tx = hive_account.transfer_to_vesting(amount, to, account)
    time.sleep(4)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(hive_power_tx), "hive_tx", account)


def power_down_hive(amount, account):
    hive_account = Account(account, blockchain_instance=hive)
    h_v = hive.token_power_to_vests(amount)
    hive_power_tx = hive_account.withdraw_vesting(h_v, account)
    time.sleep(4)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(hive_power_tx), "hive_tx", account)


def approve_witnesses(witness, account):
    hive_account = Account(account, blockchain_instance=hive)
    witness_tx = hive_account.approvewitness(witness, account)
    time.sleep(4)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(witness_tx), "witness_tx", account)


def remove_witnesses(witness, account):
    hive_account = Account(account, blockchain_instance=hive)
    witness_tx = hive_account.disapprovewitness(witness, account)
    time.sleep(4)
    c = Comment(loaded_post, steem_instance=hive)
    c.reply(str(witness_tx), "witness_tx", account)


sell_token("ARCHON", 250.00, 0.45, account)
time.sleep(30)
sell_token("LEO", 1.00, 3.333, account)
time.sleep(30)
sell_token("SIM", 225.00, 0.00495, account)
time.sleep(30)
buy_token("DHEDGE", 500, 0.285, account)
time.sleep(30)
stake_token(100, "ARCHON", account)
time.sleep(30)
stake_token(606, "NEOXAG", account)
time.sleep(30)
unstake_token(22.222, "PAL", account)
time.sleep(30)
transfer_hive("archon-mining", 5, "HIVE", "mining-bump", account)
time.sleep(30)
power_down_hive(1, account)
time.sleep(30)
power_up_hive("archon-gov", 1, account)
time.sleep(30)
power_up_hive("archon-mining", 0.1, account)
time.sleep(30)
approve_witnesses("blocktrades", account)

!end



Last proposal didn't quite work as expected at first, but a fix was added in and code snippets are ready to continue.



This one has a little more to it code-wise, and a little light on hand-holding through the code... but there are 9 functions that can be copied and pasted into proposals to be run. We can't quite use them all yet for the demo as we don't have any witnesses to unvote yet but we did manage to use most of them.

Code snippets need to be contained within a language box, and at the start of the proposal. !end is used to separate the code snippet from normal text and is also required. Finally, a proposal with a code snippet must include #hive-py along with all the usual proposal requirements (100% beneficiary to @archon-gov, #archon-proposal, #archon-gov).

Proposal for humans



This proposal will:

  • demo code snippits
  • sell some ARCHON, LEO and SIM on the hive engine market
  • place a buy for some DHEDGE at a discount
  • stake some ARCHON and NEOXAG
  • un-stake some PAL
  • transfer 5 HIVE to mining account
  • power down 1 hive
  • power up 1 hive
  • approve blocktrades as a witness

@archon-gov will reply tx info for each transaction to this post if it's passed

Vote yes below to approve this proposal and watch some cool stuff happen! This will also test each function (again in live) for use in later proposals by any user (on multiple tribes)!



Yes and No vote options may take some time to load, @archon-gov will post the comment options to vote soon if they are not already loaded.



Image by @seckorama

H2
H3
H4
3 columns
2 columns
1 column
23 Comments
Ecency