[개발] 스몬 카드 투자[9]

in #sct7 years ago (edited)

스몬에서 게임을 하여 이기면 DEC 토큰을 받습니다. 아래 그림에 있는 Balance가 DEC 수량입니다.

계정이 가지고 있는 DEC 수량을 알아보는 API는 다음과 같습니다.
https://steemmonsters.com/players/balances?username=tradingideas

계정에는 여러 토큰이 있는데, 이 중 3번째에 있는 것이 DEC 입니다.

다음은 계정에 있는 토큰들을 확인하는 코드입니다.

        acc = 'tradingideas'
        r = requests.get("https://steemmonsters.com/players/balances?username="+acc)
        bal = r.json()
        print(bal[2]['balance'])

이 API에서 보여주는 자산들은 Steemmonsters 계정이 가지고 있으며, 사용자가 요청하면 steem-engine으로 옮겨줍니다. custom json을 이용하여 Steemmonsters 에 요청을 하면 됩니다.

DEC 10개를 steem-engine으로 보내는 방법입니다.

    def request_dec_to_steem_engine(self, qty) :
        json_data = {"to": "steemmonsters", "qty":qty, "token":"DEC","type":"withdraw", "app":'steemmonsters/0.7.0'}
        self.stm.custom_json('sm_token_transfer', json_data, required_posting_auths=[self.account_name])
        print("sm_token_transfer broadcasted...")

이렇게 보내면 steem 블록체인에 아래와 같이 기록이 되고 잠시 후 지정한 수량이 steem-engine으로 전송이 됩니다.

key chain으로 확인을 해 보니 잘 들어왔군요.

일전에 소개한 steem-engine에서 토큰을 파는 기능을 이용하면 게임하여 채굴한 DEC을 자동으로 steem-engine으로 보낸 후 정한 가격에 매도를 할 수 있습니다.

하나씩 자동화가 되는군요.

Sort:  

정말 부러운 트아님~~~

재미가 있네요.

Posted using Partiko Android

jcar토큰 9월 구독 보팅입니다.
좋은 하루 보내세요. ^^

EMFOUR: can we talk on discord?

Hi @tradingideas!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.398 which ranks you at #2480 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 114 contributions, your post is ranked at #63.

Evaluation of your UA score:
  • Some people are already following you, keep going!
  • The readers like your work!
  • Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!

Feel free to join our @steem-ua Discord server

Congratulations @tradingideas! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published a post every day of the week

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemitBoard supports the SteemFest⁴ Travel Reimbursement Fund.
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.075
BTC 63576.69
ETH 1674.29
USDT 1.00
SBD 0.41