Cheatsheet for calling Event and Oracle functions

This following is a rough cheat sheet for quickly but safely creating testinvoke transactions for working with the smart contracts. Use at own risk! It was meant for me but might serve others.

# predict
b'#\xba\'\x03\xc52c\xe8\xd6\xe5"\xdc2 39\xdc\xd8\xee\xe9'
b'23ba2703c53263e8d6e522dc32203339dcd8eee9' #binascii.hexlify
AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y
KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr # wif


#wallet1
b'\xc1~\xcb|\xf0\xb1\x1b\xfc\xd8Qo\x18\xcb!\xde,\xcd/\xba('
b'c17ecb7cf0b11bfcd8516f18cb21de2ccd2fba28'
AZQyxPDwXhiNyvzXx6sLyW1LcbotpeQjp1
Kx18o2sXsWL4NGsVfdAmXEaDwWsD8nNg2DonRdyvAhfSNqazjRPa

#wallet2
b'h\xd5\x89\xc3$\xfe\xfa\x8e\xe7\xd5\x7fG\xednF\x1e/\xd0\xf1\x0b'
b'68d589c324fefa8ee7d57f47ed6e461e2fd0f10b'
ARLBjLaSdK7bJusoRDetUSn4MdcFQnHso1
L2SHk5VmYL9bGZN3eWLhJ68vXBDF8WTHNt4cJPovesNcnK5eLRnv


Central oracle contract
cd26466c75c042a79d16983631b5364581cc8bec


Token1 contract
584660c663f114d803928b77cb9abdd585a0fc17

Token2 contract
2fba13c0e5d1f0beb96ec1e4e19869a854292449

Event contract
0b41feec799e128f69a22ef89254375840939fd0

--------------------------------------------------------------
# to get a timestamp for the event registration command do the following in a python console
import datetime
datetime.datetime.now().timestamp()

# run the python console as follows after having logged in to the docker image
cd /home/middleware
source venv/bin/activate
python prompt.py -p

#on the python console you can use `switch <wallet>` name to quickly switch wallet without entering passwords
# e.g.
switch predict
switch wallet1
switch wallet2

 # type `better` to turn on pretty printing on the console
 # type `config sc-events on` if you want to see all raw smart contract data flying by
--------------------------------------------------------------


# using predict wallet
build examples/prediction/sc/event.py 07101010 05 True True [] [] []
import contract examples/prediction/sc/event.avm 07101010 05 True True

0b41feec799e128f69a22ef89254375840939fd0 # event contract

# using predict wallet
testinvoke REPLACE_ME_WITH_NEW_EVENT_CONTRACT register [b'REPLACE_ME_WITH_OWNER_WALLET',"superbowl event description",REPLACE_ME_WITH_TIMESTAMP_OF_START_WINDOW,REPLACE_ME_WITH_TIMESTAMP_OF_END_WINDOW,REPLACE_ME_WITH_TIMESTAMP_OF_EVENT_START,REPLACE_ME_WITH_TIMESTAMP_OF_EVENT_END,b'REPLACE_ME_WITH_TOKEN_CONTRACT',b'REPLACE_ME_WITH_ORACLE_CONTRACT'] [] ['choice 1','choice 2']

# replace with new event id after registration
dcd1e8f2ed022a3c5875221ee257e45fba0e4774ded8940cfab8b2a1dfb151d9

# using wallet1 (approve event for funds of wallet 1)
testinvoke REPLACE_WITH_TOKEN_CONTRACT_USED_FOR_EVENT approve [b'c17ecb7cf0b11bfcd8516f18cb21de2ccd2fba28',b'REPLACE_ME_WITH_NEW_EVENT_CONTRACT',2500]

# using wallet2
testinvoke REPLACE_ME_WITH_NEW_EVENT_CONTRACT predict [b'REPLACE_ME_WITH_NEW_EVENT_ID','choice 1',2500,b'REPLACE_ME_WITH_WALLET_ADDRESS_WHO_IS_BETTING'] [] []


# using wallet of event owner
testinvoke REPLACE_ME_WITH_CENTRAL_ORACLE resolveEvent [b'REPLACE_ME_WITH_NEW_EVENT_ID','choice 2'] []

results matching ""

    No results matching ""