#!/usr/bin/env bash

# 创建账号eosgetbox123
cleos -u https://api.eosnewyork.io system newaccount --stake-net "0.0500 EOS" --stake-cpu "0.1500 EOS" --buy-ram-kbytes 3 eosgetadmin1 eosgetbox123 EOS5joP2McPANXpEnpDFQW2r3tYuw5BpdMD5TiopeDmxHqKy6XpJi EOS6HSUr68YM1wrAafRwVVnZWyFK5SFU2schdhFTxYpFg2pfwkcQg

cleos wallet unlock -n eosget
# 导入eosgetbox123的私钥
cleos wallet import -n eosget --private-key

# 购买内存
cleos -u https://api.eosnewyork.io system buyram eosgetdice12 eosgetbox123 "50 EOS"

# 抵押CPU，带宽
cleos -u https://api.eosnewyork.io system delegatebw eosgetdice12 eosgetbox123 "0.1000 EOS" "1000.0000 EOS" -p eosgetdice12

# 编辑合约
cd /Users/ben/Desktop/eos_master

eosiocpp -o contracts/box/box.wast contracts/box/box.cpp
eosiocpp -g contracts/box/box.abi contracts/box/box.cpp

# 使用sicbosmartco来发布sicbo合约：
cleos -u https://nodes.get-scatter.com set contract eosgetbox123 contracts/box -p eosgetbox123@active

# 增加修改余额的权限
# cleos -u https://nodes.get-scatter.com set account permission eosgetdice12 active '{"threshold": 1,"keys": [{"key":"EOS7T2QLXGNnpkSdqAWNivGgXkjWjjGSvAoAvgQShhwpTa7dUvWfJ","weight": 1}],"accounts": [{"permission":{"actor":"eosgetdice12","permission":"eosio.code"},"weight":1}]}'
