Skip to content

Commit

Permalink
Merge pull request #341 from cyberway/develop
Browse files Browse the repository at this point in the history
 Merge develop -> master
  • Loading branch information
afalaleev authored Apr 15, 2020
2 parents 59068f2 + 2efebcb commit aea590f
Show file tree
Hide file tree
Showing 42 changed files with 3,289 additions and 397 deletions.
2 changes: 1 addition & 1 deletion .buildkite/steps/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ if [[ -z ${BUILDER_TAG+x} ]]; then
docker pull cyberway/builder:${BUILDER_TAG}
fi

docker build -t cyberway/cyberway.contracts:${REVISION} --build-arg=version=${REVISION} --build-arg=cw_tag=${CW_TAG} --build-arg=cdt_tag=${CDT_TAG} --build-arg=builder_tag=${BUILDER_TAG} -f Docker/Dockerfile .
docker build -t cyberway/cyberway.contracts:${REVISION} --build-arg=version=${REVISION} --build-arg=cw_tag=${CW_TAG} --build-arg=cdt_tag=${CDT_TAG} --build-arg=builder_tag=${BUILDER_TAG} --build-arg=ci_build=${CI} -f Docker/Dockerfile .
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "scripts/deployutils"]
path = scripts/deployutils
url = https://github.com/cyberway/deployutils.git
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,30 @@ macro(install_contract TARGET)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.abi DESTINATION ${CMAKE_INSTALL_PREFIX}/${TARGET}/)
endmacro()

macro(add_contract_with_checked_abi CONTRACT_NAME TARGET ABIFILE)
add_contract(${CONTRACT_NAME} ${TARGET} ${ARGN})
get_target_property(BINOUTPUT ${TARGET}.wasm BINARY_DIR)
if(ABICHECK STREQUAL "true")
add_custom_command(TARGET ${TARGET}.wasm POST_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/scripts/deployutils/abiprinter.py <${BINOUTPUT}/${TARGET}.abi >${BINOUTPUT}/${TARGET}.abi.pretty)
add_custom_target(${TARGET}.abicheck ALL
COMMAND ${CYBERWAY_ABIDIFF} ${CMAKE_CURRENT_SOURCE_DIR}/${ABIFILE} ${BINOUTPUT}/${TARGET}.abi
DEPENDS ${TARGET}.wasm ${ABIFILE}
)
else()
add_custom_command(TARGET ${TARGET}.wasm POST_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/scripts/deployutils/abiprinter.py <${BINOUTPUT}/${TARGET}.abi >${CMAKE_CURRENT_SOURCE_DIR}/${ABIFILE})
endif()
endmacro()

macro(add_contract_with_abi TARGET ABIFILE)
add_executable( ${TARGET}.wasm ${ARGN} )
configure_file(${ABIFILE} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.abi COPYONLY)
install_contract(TARGET)
endmacro()

set(CYBERWAY_ABIDIFF ${CYBERWAY_CDT_ROOT}/bin/cyberway-abidiff)

add_subdirectory(cyber.bios)
add_subdirectory(cyber.msig)
add_subdirectory(cyber.token)
Expand Down
3 changes: 3 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ ENV CYBERWAY /opt/cyberway/

COPY . /cyberway.contracts

ARG ci_build

RUN ldconfig && cd cyberway.contracts \
&& cmake -H. -B"build" \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/cyberway.contracts/ \
-Dcyberway.cdt_DIR=/opt/cyberway.cdt/lib/cmake/cyberway.cdt \
-DEOSIO_ROOT=$CYBERWAY \
-DABICHECK=$ci_build \
&& cmake --build build --target install

FROM ubuntu:18.04
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018, Respective Authors all rights reserved.
Copyright (c) 2019-2020 CyberWay and its contributors. All rights reserved.

The MIT License

Expand Down
5 changes: 4 additions & 1 deletion common/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

#ifdef UNIT_TEST_ENV
# include <eosio/chain/types.hpp>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template"
template <typename T, T... Str>
inline eosio::chain::name operator ""_n() {
return eosio::chain::name({Str...});
return eosio::chain::name({Str...});
}
#pragma clang diagnostic pop
#endif

#define CYBER_TOKEN "cyber.token"
Expand Down
2 changes: 1 addition & 1 deletion cyber.bios/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_contract(cyber.bios cyber.bios ${CMAKE_CURRENT_SOURCE_DIR}/src/cyber.bios.cpp)
add_contract_with_checked_abi(cyber.bios cyber.bios cyber.bios.abi ${CMAKE_CURRENT_SOURCE_DIR}/src/cyber.bios.cpp)
install_contract(cyber.bios)

target_include_directories(cyber.bios.wasm
Expand Down
306 changes: 306 additions & 0 deletions cyber.bios/cyber.bios.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
"version": "cyberway::abi/1.1",
"types": [],
"structs": [{
"name": "authority", "base": "",
"fields": [
{"name": "threshold", "type": "uint32"},
{"name": "keys", "type": "key_weight[]"},
{"name": "accounts", "type": "permission_level_weight[]"},
{"name": "waits", "type": "wait_weight[]"}
]
}, {
"name": "auto_recall", "base": "",
"fields": [
{"name": "id", "type": "uint64"},
{"name": "token_code", "type": "symbol_code"},
{"name": "account", "type": "name"},
{"name": "break_fee_enabled", "type": "bool"},
{"name": "break_min_stake_enabled", "type": "bool"}
]
}, {
"name": "bid_refund", "base": "",
"fields": [
{"name": "bidder", "type": "name"},
{"name": "amount", "type": "asset"}
]
}, {
"name": "bidname", "base": "",
"fields": [
{"name": "bidder", "type": "name"},
{"name": "newname", "type": "name"},
{"name": "bid", "type": "asset"}
]
}, {
"name": "bidrefund", "base": "",
"fields": [
{"name": "bidder", "type": "name"}
]
}, {
"name": "block_header", "base": "",
"fields": [
{"name": "timestamp", "type": "uint32"},
{"name": "producer", "type": "name"},
{"name": "confirmed", "type": "uint16"},
{"name": "previous", "type": "checksum256"},
{"name": "transaction_mroot", "type": "checksum256"},
{"name": "action_mroot", "type": "checksum256"},
{"name": "schedule_version", "type": "uint32"},
{"name": "new_producers", "type": "producer_schedule?"}
]
}, {
"name": "blockchain_parameters", "base": "",
"fields": [
{"name": "base_per_transaction_net_usage", "type": "uint32"},
{"name": "context_free_discount_net_usage_num", "type": "uint32"},
{"name": "context_free_discount_net_usage_den", "type": "uint32"},
{"name": "min_transaction_cpu_usage", "type": "uint32"},
{"name": "min_transaction_ram_usage", "type": "uint64"},
{"name": "max_transaction_lifetime", "type": "uint32"},
{"name": "deferred_trx_expiration_window", "type": "uint32"},
{"name": "max_transaction_delay", "type": "uint32"},
{"name": "max_inline_action_size", "type": "uint32"},
{"name": "max_inline_action_depth", "type": "uint16"},
{"name": "max_authority_depth", "type": "uint16"},
{"name": "ram_size", "type": "uint64"},
{"name": "reserved_ram_size", "type": "uint64"},
{"name": "max_block_usage", "type": "uint64[]"},
{"name": "max_transaction_usage", "type": "uint64[]"},
{"name": "target_virtual_limits", "type": "uint64[]"},
{"name": "min_virtual_limits", "type": "uint64[]"},
{"name": "max_virtual_limits", "type": "uint64[]"},
{"name": "usage_windows", "type": "uint32[]"},
{"name": "virtual_limit_decrease_pct", "type": "uint16[]"},
{"name": "virtual_limit_increase_pct", "type": "uint16[]"},
{"name": "account_usage_windows", "type": "uint32[]"}
]
}, {
"name": "canceldelay", "base": "",
"fields": [
{"name": "canceling_auth", "type": "permission_level"},
{"name": "trx_id", "type": "checksum256"}
]
}, {
"name": "checkversion", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "abi_version", "type": "checksum256?"},
{"name": "code_version", "type": "checksum256?"}
]
}, {
"name": "checkwin", "base": "",
"fields": []
}, {
"name": "deleteauth", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "permission", "type": "name"}
]
}, {
"name": "initautorc", "base": "",
"fields": [
{"name": "enable", "type": "bool"}
]
}, {
"name": "key_weight", "base": "",
"fields": [
{"name": "key", "type": "public_key"},
{"name": "weight", "type": "uint16"}
]
}, {
"name": "linkauth", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "code", "type": "name"},
{"name": "type", "type": "name"},
{"name": "requirement", "type": "name"}
]
}, {
"name": "name_bid", "base": "",
"fields": [
{"name": "newname", "type": "name"},
{"name": "high_bidder", "type": "name"},
{"name": "high_bid", "type": "int64"},
{"name": "last_bid_time", "type": "time_point_sec"}
]
}, {
"name": "newaccount", "base": "",
"fields": [
{"name": "creator", "type": "name"},
{"name": "name", "type": "name"},
{"name": "owner", "type": "authority"},
{"name": "active", "type": "authority"}
]
}, {
"name": "onblock", "base": "",
"fields": [
{"name": "header", "type": "block_header"}
]
}, {
"name": "onerror", "base": "",
"fields": [
{"name": "sender_id", "type": "uint128"},
{"name": "sent_trx", "type": "bytes"}
]
}, {
"name": "permission_level", "base": "",
"fields": [
{"name": "actor", "type": "name"},
{"name": "permission", "type": "name"}
]
}, {
"name": "permission_level_weight", "base": "",
"fields": [
{"name": "permission", "type": "permission_level"},
{"name": "weight", "type": "uint16"}
]
}, {
"name": "producer_key", "base": "",
"fields": [
{"name": "producer_name", "type": "name"},
{"name": "block_signing_key", "type": "public_key"}
]
}, {
"name": "producer_schedule", "base": "",
"fields": [
{"name": "version", "type": "uint32"},
{"name": "producers", "type": "producer_key[]"}
]
}, {
"name": "providebw", "base": "",
"fields": [
{"name": "provider", "type": "name"},
{"name": "account", "type": "name"}
]
}, {
"name": "reqauth", "base": "",
"fields": [
{"name": "from", "type": "name"}
]
}, {
"name": "setabi", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "abi", "type": "bytes"}
]
}, {
"name": "setcode", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "vmtype", "type": "uint8"},
{"name": "vmversion", "type": "uint8"},
{"name": "code", "type": "bytes"}
]
}, {
"name": "setparams", "base": "",
"fields": [
{"name": "params", "type": "blockchain_parameters"}
]
}, {
"name": "setprods", "base": "",
"fields": [
{"name": "schedule", "type": "producer_key[]"}
]
}, {
"name": "state_info", "base": "",
"fields": [
{"name": "id", "type": "uint64"},
{"name": "last_close_bid", "type": "time_point_sec"}
]
}, {
"name": "unlinkauth", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "code", "type": "name"},
{"name": "type", "type": "name"}
]
}, {
"name": "updateauth", "base": "",
"fields": [
{"name": "account", "type": "name"},
{"name": "permission", "type": "name"},
{"name": "parent", "type": "name"},
{"name": "auth", "type": "authority"}
]
}, {
"name": "wait_weight", "base": "",
"fields": [
{"name": "wait_sec", "type": "uint32"},
{"name": "weight", "type": "uint16"}
]
}
],
"actions": [
{"name": "bidname", "type": "bidname"},
{"name": "bidrefund", "type": "bidrefund"},
{"name": "canceldelay", "type": "canceldelay"},
{"name": "checkversion", "type": "checkversion"},
{"name": "checkwin", "type": "checkwin"},
{"name": "deleteauth", "type": "deleteauth"},
{"name": "initautorc", "type": "initautorc"},
{"name": "linkauth", "type": "linkauth"},
{"name": "newaccount", "type": "newaccount"},
{"name": "onblock", "type": "onblock"},
{"name": "onerror", "type": "onerror"},
{"name": "providebw", "type": "providebw"},
{"name": "reqauth", "type": "reqauth"},
{"name": "setabi", "type": "setabi"},
{"name": "setcode", "type": "setcode"},
{"name": "setparams", "type": "setparams"},
{"name": "setprods", "type": "setprods"},
{"name": "unlinkauth", "type": "unlinkauth"},
{"name": "updateauth", "type": "updateauth"}
],
"events": [],
"tables": [{
"name": "bidrefunds", "type": "bid_refund",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "bidder", "order": "asc"}
]
}
]
}, {
"name": "biosstate", "type": "state_info",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "id", "order": "asc"}
]
}
]
}, {
"name": "namebids", "type": "name_bid",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "newname", "order": "asc"}
]
}, {
"name": "highbid", "unique": false,
"orders": [
{"field": "high_bid", "order": "desc"}
]
}
]
}, {
"name": "stake.autorc", "type": "auto_recall",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "id", "order": "asc"}
]
}, {
"name": "bykey", "unique": true,
"orders": [
{"field": "token_code", "order": "asc"},
{"field": "account", "order": "asc"}
]
}
]
}
],
"variants": []
}
Loading

0 comments on commit aea590f

Please sign in to comment.