Skip to content

Instantly share code, notes, and snippets.

@hashware
Last active June 16, 2018 14:21
Show Gist options
  • Save hashware/ac2ef17ba80f9f63d1bea87c2ad849b4 to your computer and use it in GitHub Desktop.
Save hashware/ac2ef17ba80f9f63d1bea87c2ad849b4 to your computer and use it in GitHub Desktop.

后续版本会对权限设置做修改

EOSIO/eos#3002

EOSIO/eos#3003

EOSIO/eos#3050

cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

cleos wallet import 5Jmsawgsp1tQ3GD6JyGCwy1dcvqKZgX6ugMVMdjirx85iv5VyPR

cleos create account eosio dice EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4

cleos set contract dice build/contracts/dice -p dice

cleos create account eosio alice EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4

cleos create account eosio bob EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4

cleos push action eosio.token issue '[ "alice", "1000.0000 SYS", "" ]' -p eosio

cleos push action eosio.token issue '[ "bob", "1000.0000 SYS", "" ]' -p eosio

cleos set account permission alice active '{"threshold": 1, "keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}], "accounts": [{"permission":{"actor":"dice","permission":"eosio.code"},"weight":1}]}' owner -p alice@owner

cleos push action dice deposit '[ "alice", "100.0000 SYS" ]' -p alice

cleos get account alice -j

cleos get currency balance eosio.token alice

cleos set account permission bob active '{"threshold": 1, "keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}], "accounts": [{"permission":{"actor":"dice","permission":"eosio.code"},"weight":1}]}' owner -p bob@owner

cleos push action dice deposit '[ "bob", "100.0000 SYS" ]' -p bob

openssl rand -hex 32

echo -n '28349b1d4bcdc9905e4ef9719019e55743c84efa0c5e9a0b077f0b54fcd84905' | xxd -r -p | sha256sum -b | awk '{print $1}'

cleos push action dice offerbet '[ "3.0000 SYS", "alice", "d533f24d6f28ddcef3f066474f7b8355383e485681ba8e793e037f5cf36e4883" ]' -p alice

openssl rand -hex 32

echo -n '15fe76d25e124b08feb835f12e00a879bd15666a33786e64b655891fba7d6c12' | xxd -r -p | sha256sum -b | awk '{print $1}'

cleos push action dice offerbet '[ "3.0000 SYS", "bob", "50ed53fcdaf27f88d51ea4e835b1055efe779bb87e6cfdff47d28c88ffb27129" ]' -p bob

cleos get table dice dice account

cleos get table dice dice game

cleos push action dice reveal '[ "50ed53fcdaf27f88d51ea4e835b1055efe779bb87e6cfdff47d28c88ffb27129", "15fe76d25e124b08feb835f12e00a879bd15666a33786e64b655891fba7d6c12" ]' -p bob

cleos push action dice reveal '[ "d533f24d6f28ddcef3f066474f7b8355383e485681ba8e793e037f5cf36e4883", "28349b1d4bcdc9905e4ef9719019e55743c84efa0c5e9a0b077f0b54fcd84905" ]' -p alice

cleos set account permission dice active '{"threshold": 1, "keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}], "accounts": [{"permission":{"actor":"dice","permission":"eosio.code"},"weight":1}]}' owner -p dice@owner

cleos push action dice withdraw '[ "alice", "103.0000 SYS" ]' -p alice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment