Permalink
Browse files

feat: eos v1.5.2, cdt 1.5.0, eosio.contracts#master

  • Loading branch information...
gaboesquivel committed Jan 17, 2019
1 parent 21041fc commit 12cc7b004c7dc572eb97a32138965e64e3b56d5d
@@ -7,8 +7,6 @@ services:
build:
context: ./services/eosio
dockerfile: Dockerfile
args:
symbol: EOS
image: eoslocal/eosio
stop_grace_period: 3m0s
ports:
@@ -22,6 +20,7 @@ services:
volumes:
- eosio-data-volume:/root/data-dir
- ./services/eosio:/opt/application
- ./contracts:/opt/contracts
depends_on:
- mongo
- wallet
@@ -7,4 +7,13 @@ flush: scripts/flush.sh
fresh: scripts/fresh.sh
./scripts/fresh.sh

stop: scripts/stop.sh
./scripts/stop.sh

start: scripts/start.sh
./scripts/start.sh

ditch_wallet: scripts/ditch-wallet.sh
./scripts/ditch-wallet.sh

FORCE:
@@ -7,6 +7,6 @@ rm "$(dirname "$0")/../services/eosio/config/keys/wallet_password.txt"


echo "=======================IMPORTANT================================"
echo "The wallet docker volume keosd-data-volume and the eosdemo wallet password file are not removed by this command."
echo "The wallet docker volume keosd-data-volume and the wallet password file are not removed by this command."
echo "That is in order avoid losing keys. Run 'make ditch_wallet' to remove the wallet and the password file"
echo "================================================================"
@@ -12,7 +12,7 @@ read -p "Initializing Chain data (y/n)? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker-compose run eosio /opt/application/scripts/init-chain.sh
docker-compose exec eosio bash /opt/application/scripts/setup.sh
fi

docker-compose up -d
@@ -1,9 +1,12 @@
FROM eosio/eos-dev:v1.5.2

RUN apt-get update && apt-get install curl git -y
RUN apt-get update && apt-get install jq curl git -y

COPY ./ /opt/application

# Install EOS Contract Development Toolkit
RUN apt install /opt/application/utils/eosio.cdt_1.5.0-1_amd64.deb

VOLUME /opt/application
WORKDIR /opt/application

@@ -14,7 +17,6 @@ RUN chmod +x /wait
# used by start.sh
ENV DATA_DIR /root/data-dir
ENV CONFIG_DIR /opt/application/config
ENV NODEOS_BIN_DIR /opt/eosio/bin

## Launch the wait tool and then start nodeos ( see docker compose, we are waiting for mongo)
CMD /wait && /opt/application/scripts/start.sh
@@ -0,0 +1,9 @@
[
{"name":"eostestusera", "privateKey":"5K7mtrinTFrVTduSxizUc5hjXJEtTjVTsqSHeBHes1Viep86FP5", "publicKey":"EOS6kYgMTCh1iqpq9XGNQbEi8Q6k5GujefN9DSs55dcjVyFAq7B6b"},
{"name":"eostestuserb", "privateKey":"5KLqT1UFxVnKRWkjvhFur4sECrPhciuUqsYRihc1p9rxhXQMZBg", "publicKey":"EOS78RuuHNgtmDv9jwAzhxZ9LmC6F295snyQ9eUDQ5YtVHJ1udE6p"},
{"name":"eostestuserc", "privateKey":"5K2jun7wohStgiCDSDYjk3eteRH1KaxUQsZTEmTGPH4GS9vVFb7", "publicKey":"EOS5yd9aufDv7MqMquGcQdD6Bfmv6umqSuh9ru3kheDBqbi6vtJ58"},
{"name":"eostestuserd", "privateKey":"5KNm1BgaopP9n5NqJDo9rbr49zJFWJTMJheLoLM5b7gjdhqAwCx", "publicKey":"EOS8LoJJUU3dhiFyJ5HmsMiAuNLGc6HMkxF4Etx6pxLRG7FU89x6X"},
{"name":"eostestusere", "privateKey":"5KE2UNPCZX5QepKcLpLXVCLdAw7dBfJFJnuCHhXUf61hPRMtUZg", "publicKey":"EOS7XPiPuL3jbgpfS3FFmjtXK62Th9n2WZdvJb6XLygAghfx1W7Nb"},
{"name":"eostestuserf", "privateKey":"5KaqYiQzKsXXXxVvrG8Q3ECZdQAj2hNcvCgGEubRvvq7CU3LySK", "publicKey":"EOS5btzHW33f9zbhkwjJTYsoyRzXUNstx1Da9X2nTzk8BQztxoP3H"},
{"name":"eostestuserg", "privateKey":"5KFyaxQW8L6uXFB6wSgC44EsAbzC7ideyhhQ68tiYfdKQp69xKo", "publicKey":"EOS8Du668rSVDE3KkmhwKkmAyxdBd73B51FKE7SjkKe5YERBULMrw"}
]
@@ -0,0 +1,21 @@
#!/bin/bash
# set -o errexit

# Import helper functions
source $(dirname $0)/helpers.sh

echo "Creating testing accounts ..."

# loop through the array in the json file, import keys and create accounts
# these pre-created accounts will be used for saving / erasing notes
# we hardcoded each account name, public and private key in the json.
# NEVER store the private key in any source code in your real life developmemnt
# This is just for demo purpose

jq -c '.[]' $(dirname $0)/accounts.json | while read i; do
name=$(jq -r '.name' <<< "$i")
pub=$(jq -r '.publicKey' <<< "$i")

# to simplify, we use the same key for owner and active key of each account
create_eos_account $name $pub $pub
done
@@ -26,3 +26,10 @@ function create_wallet () {
function import_private_key () {
$cleos wallet import --private-key $1
}

# Creates an eos account with 100 EOS
function create_eos_account () {
# $cleos system newaccount eosio --transfer $1 $2 $2 --stake-net '1 EOS' --stake-cpu '1 EOS' --buy-ram '1 EOS'
$cleos create account eosio $1 $2 $2
$cleos transfer eosio $1 '100 EOS' -p eosio
}
@@ -30,12 +30,19 @@ function create_eosio_accounts () {
create_system_account eosio.vpay $EOSIO_PUBKEY
}


function compile_system_contracts () {
git clone https://github.com/EOSIO/eosio.contracts.git /opt/eosio.contracts
cd /opt/eosio.contracts/
./build.sh
}

function deploy_system_contracts () {
echo "Deploy eosio.token"
$cleos set contract eosio.token /contracts/eosio.token
$cleos set contract eosio.token /opt/eosio.contracts/build/eosio.token

echo "Deploy eosio.msig"
$cleos set contract eosio.msig /contracts/eosio.msig
$cleos set contract eosio.msig /opt/eosio.contracts/build/eosio.msig

echo "Create and allocate the SYS currency" # https://github.com/EOSIO/eos/issues/3996
$cleos push action eosio.token create '[ "eosio", "10000000000.0000 SYS"]' -p eosio.token@active
@@ -46,10 +53,13 @@ function deploy_system_contracts () {
$cleos push action eosio.token issue '[ "eosio", "10000000000.0000 EOS", "initial supply" ]' -p eosio@active

echo "Deploy eosio.system"
$cleos set contract eosio /contracts/eosio.system
$cleos set contract eosio /opt/eosio.contracts/build/eosio.system

echo "Init system with EOS symbol"
$cleos push action eosio init '["0", "4,EOS"]' -p eosio@active

echo "Deploy eosio.bios"
$cleos set contract eosio /contracts/eosio.bios
$cleos set contract eosio /opt/eosio.contracts/build/eosio.bios

echo "Make eosio.msig privileged"
$cleos push action eosio setpriv '["eosio.msig", 1]' -p eosio@active
@@ -68,4 +78,7 @@ import_private_key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

# Initialize chain
create_eosio_accounts
compile_system_contracts
deploy_system_contracts


@@ -0,0 +1,24 @@
#!/usr/bin/env bash

# Throws error when using unset variable
set -ux

# Import helper functions
source $(dirname $0)/helpers.sh

source $(dirname $0)/unlock.sh

HELLO_PRIVKEY="5Khs2zo5wiK7yxcff5DqZ6tuJR7KQ1EqazG8Sj4jyTYGWLfo7Wb"
HELLO_PUBKEY="EOS6wHmRL5riQ1geW64kM4RmDbPCnWQ9bBzuP7K8nA4eKJ7JQrDJ6"

import_private_key $HELLO_PRIVKEY

create_eos_account hello $HELLO_PUBKEY $INTERX_PUBKEY

$cleos system buyram hello hello '20 EOS'
$cleos system delegatebw hello hello '4 EOS' '4 EOS'

cd /opt/contracts/hello
eosio-cpp -abigen hello.cpp -o hello.wasm
cd ..
$cleos set contract hello ./hello -p hello@active
@@ -0,0 +1,5 @@
#!/bin/bash
set -o errexit

source $(dirname $0)/init_chain.sh
source $(dirname $0)/create_accounts.sh
@@ -3,15 +3,10 @@
source $(dirname $0)/stop.sh

echo "Starting eosio service ..."

LOGFILE=/opt/application/logs/nodeos.log
NODEOS=/opt/eosio/bin/nodeos

# always a new log file
rm $LOGFILE && touch $LOGFILE

if [ "$(ls -A $DATA_DIR)" ]; then
$NODEOS --config-dir $CONFIG_DIR --data-dir $DATA_DIR -e --hard-replay >> $LOGFILE 2>&1 & tail -f $LOGFILE
else
$NODEOS --config-dir $CONFIG_DIR --data-dir $DATA_DIR -e >> $LOGFILE 2>&1 & tail -f $LOGFILE
fi
nodeos --config-dir $CONFIG_DIR --data-dir $DATA_DIR -e >> $LOGFILE 2>&1 & echo $! > $DATA_DIR/nodeos.pid & tail -f $LOGFILE

@@ -1,7 +1,4 @@
#!/bin/bash

echo "Stopping eosio service ..."

if [ -f $DATA_DIR"/nodeos.pid" ]; then
pid=`cat $DATA_DIR"/nodeos.pid"`
echo $pid
@@ -10,7 +10,7 @@ cleos="cleos -u http://eosio:8888 --wallet-url http://wallet:8901"
# Unlocks the default wallet and waits .5 seconds
function unlock_wallet () {
echo "unlocking default wallet..."
$cleos wallet unlock --name eoslocal --password $(cat $CONFIG_DIR/keys/eoslocal_wallet_password.txt)
$cleos wallet unlock --password $(cat $CONFIG_DIR/keys/wallet_password.txt)
sleep .5
}

This file was deleted.

Oops, something went wrong.

0 comments on commit 12cc7b0

Please sign in to comment.