Skip to content

Commit 080a787

Browse files
committed
minter 2.0
1 parent ef2163b commit 080a787

72 files changed

Lines changed: 3117 additions & 264 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/conan_deps.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env bash
22

3-
conan install toolbox/3.2.1@edwardstock/latest -s build_type=Debug --build=missing
4-
conan install toolbox/3.2.1@edwardstock/latest -s build_type=Release --build=missing
3+
conan install toolbox/3.2.2@edwardstock/latest -s build_type=Debug --build=missing
4+
conan install toolbox/3.2.2@edwardstock/latest -s build_type=Release --build=missing
55

6-
conan install bip39/2.1.0@edwardstock/latest -s build_type=Debug --build=missing
7-
conan install bip39/2.1.0@edwardstock/latest -s build_type=Release --build=missing
6+
conan install bip39/2.1.1@edwardstock/latest -s build_type=Debug --build=missing
7+
conan install bip39/2.1.1@edwardstock/latest -s build_type=Release --build=missing
88

9-
conan install bigmath/1.0.0@edwardstock/latest -s build_type=Debug --build=missing
10-
conan install bigmath/1.0.0@edwardstock/latest -s build_type=Release --build=missing
9+
conan install bigmath/1.0.2@edwardstock/latest -s build_type=Debug --build=missing
10+
conan install bigmath/1.0.2@edwardstock/latest -s build_type=Release --build=missing
1111

1212
conan install secp256k1_java/1.0.0@edwardstock/latest -s build_type=Debug --build=missing
1313
conan install secp256k1_java/1.0.0@edwardstock/latest -s build_type=Release --build=missing
1414

15-
conan install gtest/1.8.1@bincrafters/stable -s build_type=Debug --build=missing
15+
conan install gtest/1.10.0@ -s build_type=Debug --build=missing

.circleci/config.yml

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ commands:
1111
command: git clone --recursive https://github.com/MinterTeam/cpp-minter .
1212
conan_remotes:
1313
steps:
14-
- run: conan remote add -f edwardstock https://api.bintray.com/conan/edwardstock/conan-public
15-
- run: conan remote add -f bincrafters https://api.bintray.com/conan/bincrafters/public-conan
16-
- run: conan remote add -f minter https://api.bintray.com/conan/minterteam/minter
17-
- run: conan user -p $BINTRAY_API_KEY -r minter edwardstock
14+
- run: conan remote add -f edwardstock https://edwardstock.jfrog.io/artifactory/api/conan/conan
15+
- run: conan remote add -f minter https://minter.jfrog.io/artifactory/api/conan/conan
16+
- run: conan user -p $ARTIFACTORY_API_KEY -r minter edward.vstock@gmail.com
1817

1918
conan_project_deps:
2019
steps:
@@ -34,12 +33,6 @@ commands:
3433
name: Deploy to Conan bintray
3534
command: $(which bash) .circleci/deploy.sh
3635

37-
38-
# make_package:
39-
# steps:
40-
# - run: bash cfg/package_make.sh -t package
41-
# - run: bash _build/package_upload.sh -t bintray
42-
4336
do_all_centos:
4437
steps:
4538
- checkout_recursive
@@ -58,20 +51,6 @@ commands:
5851
- deploy_conan
5952

6053
jobs:
61-
# package_all:
62-
# machine:
63-
# image: ubuntu-1604:202007-01
64-
# steps:
65-
# - run: bash cfg/add_repo.sh debian
66-
# - run: apt-get install dockerpack
67-
# - run: dockerpack build
68-
69-
gcc-4_8_5:
70-
docker:
71-
- image: docker.edwardstock.com/gcc_dev_el7
72-
steps:
73-
- do_all_centos
74-
7554
gcc-5:
7655
docker:
7756
- image: conanio/gcc5
@@ -136,9 +115,6 @@ jobs:
136115
workflows:
137116
build_and_test:
138117
jobs:
139-
- gcc-4_8_5:
140-
context:
141-
- remote_tokens
142118
- gcc-5:
143119
context:
144120
- remote_tokens

CMakeLists.txt

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.12)
22
project(minter_tx
3-
VERSION 1.0.0
3+
VERSION 2.0.0
44
DESCRIPTION "Minter Transaction SDK for C++"
55
LANGUAGES CXX
66
)
@@ -35,12 +35,12 @@ if (MSVC)
3535
add_compile_options(/wd4834)
3636
elseif (MINGW)
3737
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -Wno-unknown-pragmas -Wno-shift-count-overflow")
38-
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
38+
set(CMAKE_CXX_FLAGS_DEBUG "-g")
3939
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
4040
else ()
4141
#-fvisibility=hidden
4242
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -Wextra -pedantic -Wno-unknown-pragmas -Wno-unused-parameter -Wno-shift-count-overflow")
43-
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
43+
set(CMAKE_CXX_FLAGS_DEBUG "-g")
4444
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
4545
endif ()
4646

@@ -52,9 +52,8 @@ include(conan_fallback)
5252

5353
if (ENABLE_CONAN)
5454
include(ConanInit)
55-
add_conan_remote(bincrafters https://api.bintray.com/conan/bincrafters/public-conan)
56-
add_conan_remote(minter https://api.bintray.com/conan/minterteam/minter)
57-
add_conan_remote(edwardstock https://api.bintray.com/conan/edwardstock/conan-public)
55+
add_conan_remote(minter https://minter.jfrog.io/artifactory/api/conan/conan)
56+
add_conan_remote(edwardstock https://edwardstock.jfrog.io/artifactory/api/conan/conan)
5857
conan_init()
5958
else ()
6059
# toolbox
@@ -172,6 +171,19 @@ set(HEADERS
172171
include/minter/tx/tx_edit_multisig.h
173172
include/minter/tx/tx_price_vote.h
174173
include/minter/tx/tx_edit_candidate_public_key.h
174+
include/minter/tx/tx_add_liquidity.h
175+
include/minter/tx/tx_remove_liquidity.h
176+
include/minter/tx/tx_sell_swap_pool.h
177+
include/minter/tx/tx_buy_swap_pool.h
178+
include/minter/tx/tx_sell_all_swap_pool.h
179+
include/minter/tx/tx_edit_candidate_commission.h
180+
include/minter/tx/tx_mint_token.h
181+
include/minter/tx/tx_burn_token.h
182+
include/minter/tx/tx_create_token.h
183+
include/minter/tx/tx_recreate_token.h
184+
include/minter/tx/tx_vote_commission.h
185+
include/minter/tx/tx_vote_update.h
186+
include/minter/tx/tx_create_swap_pool.h
175187
)
176188

177189
set(SOURCES
@@ -209,6 +221,19 @@ set(SOURCES
209221
src/tx/tx_edit_multisig.cpp
210222
src/tx/tx_price_vote.cpp
211223
src/tx/tx_edit_candidate_public_key.cpp
224+
src/tx/tx_add_liquidity.cpp
225+
src/tx/tx_remove_liquidity.cpp
226+
src/tx/tx_sell_swap_pool.cpp
227+
src/tx/tx_buy_swap_pool.cpp
228+
src/tx/tx_sell_all_swap_pool.cpp
229+
src/tx/tx_edit_candidate_commission.cpp
230+
src/tx/tx_mint_token.cpp
231+
src/tx/tx_burn_token.cpp
232+
src/tx/tx_create_token.cpp
233+
src/tx/tx_recreate_token.cpp
234+
src/tx/tx_vote_commission.cpp
235+
src/tx/tx_vote_update.cpp
236+
src/tx/tx_create_swap_pool.cpp
212237
)
213238

214239
set(MINTER_TX_EXPORTING 1)
@@ -297,7 +322,7 @@ if (ENABLE_TEST)
297322
tests/tx_edit_coin_owner_test.cpp
298323
tests/tx_edit_multisig_test.cpp
299324
tests/tx_edit_candidate_public_key_test.cpp
300-
)
325+
tests/tx_swap_pool_test.cpp tests/tx_liquidity_add_remove_test.cpp tests/tx_edit_candidate_commission_test.cpp tests/tx_token_test.cpp)
301326

302327
add_executable(${PROJECT_NAME_TEST} ${TEST_SOURCES})
303328
if (NOT MSVC)

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,17 @@ Supported distributions:
2222

2323
Steps:
2424

25-
* Create `bintray-edwardstock.repo` file inside `/etc/yum.repos.d`
25+
* Create `edwardstock.repo` file inside `/etc/yum.repos.d`
2626
* Add below to this file
2727

2828
```ini
29-
[bintray-edwardstock]
30-
name=bintray-edwardstock
31-
baseurl=https://dl.bintray.com/edwardstock/rh/[paste here centos OR fedora]/$releasever/$basearch
32-
gpgcheck=0
33-
repo_gpgcheck=0
29+
[edwardstock]
30+
name=edwardstock
31+
baseurl=https://edwardstock.jfrog.io/artifactory/rhel/[centos or fedora]/$releasever/$basearch
3432
enabled=1
35-
```
36-
37-
* Add repository gpg to trusted
38-
39-
```bash
40-
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | gpg --import
33+
gpgcheck=0
34+
gpgkey=https://edwardstock.jfrog.io/artifactory/rhel/[centos or fedora]/$releasever/$basearch/repodata/repomd.xml.key
35+
repo_gpgcheck=1
4136
```
4237

4338
* Update repository `yum -y update` or `dnf update`
@@ -54,14 +49,22 @@ If you using other distribution, just find what your system based on, for exampl
5449
Buster. In this case just change distribution name in `/etc/apt/sources.list` by yourself.
5550

5651
```bash
57-
echo "deb https://dl.bintray.com/edwardstock/debian $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list
58-
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
52+
echo "deb https://edwardstock.jfrog.io/artifactory/debian $(lsb_release -c -s) main" | tee -a /etc/apt/sources.list
53+
curl -s https://edwardstock.jfrog.io/artifactory/api/gpg/key/public | apt-key add -
5954
apt update && apt install libminter_tx-dev
6055
```
6156

6257
If you got error **lsb_release: command not found** then just install `apt install lsb-release`. It can happened on
6358
naked Docker images.
6459

60+
<br/><br/>
61+
After installing package from repository, you can use cmake-find module to find library:
62+
63+
```cmake
64+
find_package(minter_tx 2.0.0 REQUIRED)
65+
target_link_libraries(MY_PROJECT minter_tx::minter_tx)
66+
```
67+
6568
## Using via Conan (very useful dependency manager for C++)
6669

6770
**Debian**
@@ -91,9 +94,8 @@ pip3 install conan
9194
**Setup repositories**
9295

9396
```bash
94-
conan remote add scatter https://api.bintray.com/conan/edwardstock/scatter
95-
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
96-
conan remote add minter https://api.bintray.com/conan/minterteam/minter
97+
conan remote add minter https://minter.jfrog.io/artifactory/api/conan/conan
98+
conan remote add edwardstock https://edwardstock.jfrog.io/artifactory/api/conan/conan
9799
```
98100

99101
For more information, see official [docs](https://docs.conan.io/en/latest/getting_started.html)
@@ -104,7 +106,7 @@ For more information, see official [docs](https://docs.conan.io/en/latest/gettin
104106

105107
You can just add to your conanfile.txt dependency:
106108

107-
`minter_tx/1.0.0@minter/latest`
109+
`minter_tx/2.0.0@minter/latest`
108110

109111
CMakeLists.txt
110112

RELEASE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Release notes
22

3+
## 2.0.0
4+
5+
- Added transactions:
6+
- AddLiquidity (`tx_add_liquidity`)
7+
- RemoveLiquidity (`tx_remove_liquidity`)
8+
- BuySwapPool (`tx_buy_swap_pool`)
9+
- SellSwapPool (`tx_sell_swap_pool`)
10+
- SellAllSwapPool (`tx_sell_all_swap_pool`)
11+
- CreateSwapPool (`tx_create_swap_pool`)
12+
- CreateToken (`tx_create_token`)
13+
- RecreateToken (`tx_recreate_token`)
14+
- MintToken (`tx_mint_token`)
15+
- BurnToken (`tx_burn_token`)
16+
- EditCandidateCommission (`tx_edit_candidate_commission`)
17+
- VoteCommission (`tx_vote_commission`)
18+
- VoteUpdate (`tx_vote_update`)
19+
20+
- Passing simple (not exactly) types by value instead of by const reference: dev::bigint, dev::bigdec18 etc
21+
- Added method overrides with `std::string` argument (float or integer representation) where by default
22+
passing `dev::bigdec18` or `dev::bigint`
23+
324
## 1.0.0 **Breaking changes**
425

526
- Now coins represented by its ID. It means, all methods like `set_coin(std::string)` or `set_gas_coin(std::string)`

cfg/add_repo.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,23 @@ REPO_TYPE=$1
44

55
case "${REPO_TYPE}" in
66
centos | fedora)
7-
cat <<REPO >/etc/yum.repos.d/bintray-edwardstock.repo
8-
[bintray-edwardstock]
9-
name=bintray-edwardstock
10-
baseurl=https://dl.bintray.com/edwardstock/rh/${REPO_TYPE}/\$releasever/\$basearch
11-
gpgcheck=0
12-
repo_gpgcheck=0
7+
cat <<REPO >/etc/yum.repos.d/edwardstock.repo
8+
[edwardstock]
9+
name=edwardstock
10+
baseurl=https://edwardstock.jfrog.io/artifactory/rhel/${REPO_TYPE}/\$releasever/\$basearch
1311
enabled=1
12+
gpgcheck=0
13+
gpgkey=https://edwardstock.jfrog.io/artifactory/rhel/${REPO_TYPE}/\$releasever/\$basearch/repodata/repomd.xml.key
14+
repo_gpgcheck=1
1415
REPO
15-
16-
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | gpg --import
1716
;;
1817

1918
debian)
20-
EXIST_REPO=$(cat /etc/apt/sources.list | grep edwardstock/debian | head -n 1)
19+
EXIST_REPO=$(cat /etc/apt/sources.list | grep "edwardstock.jfrog.io" | head -n 1)
2120
if [ "${EXIST_REPO}" == "" ]; then
22-
echo "deb https://dl.bintray.com/edwardstock/debian $(lsb_release -c -s) main" | tee -a /etc/apt/sources.list
21+
echo "deb https://edwardstock.jfrog.io/artifactory/debian $(lsb_release -c -s) main" | tee -a /etc/apt/sources.list
2322
fi
24-
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | apt-key add -
23+
curl -s https://edwardstock.jfrog.io/artifactory/api/gpg/key/public | apt-key add -
2524
;;
2625
*)
2726
echo "Unknown repo type"

cfg/package_make.sh

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ TYPE=""
77
DRY_RUN=""
88
CMAKE_OPTS=""
99
BUILD_ROOT="${PWD}/_build"
10-
TEST_ONLY=""
11-
TEST_OPTION="ENABLE_TEST"
1210

1311
function usage() {
1412
echo ""
@@ -17,7 +15,6 @@ function usage() {
1715
echo -e " -h, --help | This help"
1816
echo -e " -t, --type | Choose what package to build: archive or native OS package"
1917
echo -e " --dry-run | Only echo commands without real building"
20-
echo -e " --test | Build and run only test configuration"
2118
echo -e " -o, --options | Add string with additional cmake configure options. Example: -o \"-DVAR=1 -DVAR2=2\""
2219
echo -e " -b, --buildroot | Path where to build project. Default: ${BUILD_ROOT}"
2320
echo ""
@@ -34,16 +31,6 @@ while (("$#")); do
3431
DRY_RUN=1
3532
shift
3633
;;
37-
--test)
38-
if [ -n "$2" ]; then
39-
TEST_ONLY=1
40-
TEST_OPTION="$2"
41-
shift 2
42-
else
43-
TEST_ONLY=1
44-
shift
45-
fi
46-
;;
4734
-t | --type)
4835
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
4936
TYPE=$2
@@ -63,7 +50,7 @@ while (("$#")); do
6350
fi
6451
;;
6552
-o | --options)
66-
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
53+
if [ -n "$2" ]; then
6754
CMAKE_OPTS=$2
6855
shift 2
6956
else
@@ -90,19 +77,10 @@ else
9077
cpusCnt=$(lscpu | grep -E '^CPU\(' | awk '{print $2}') # cpus count
9178
tpcpu=$(lscpu | grep -E '^Thread' | awk '{print $4}') # threads per core
9279
threadCount=$((cpusCnt * tpcpu))
93-
fi
94-
95-
# create build root if not exists and go inside
96-
mkdir -p ${BUILD_ROOT} && cd ${BUILD_ROOT}
9780

98-
# if need to test project only
99-
if [ "${TEST_ONLY}" == "1" ]; then
100-
# delete everything inside just if build root already used
101-
rm -rf ./*
102-
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_CONAN=Off -D${TEST_OPTION}=On
103-
make -j ${threadCount}
104-
make test
105-
exit 0
81+
if ((threadCount <= 0)); then
82+
threadCount=2
83+
fi
10684
fi
10785

10886
if [ "${TYPE}" == "" ]; then
@@ -114,6 +92,7 @@ if [ "${TYPE}" == "archive" ]; then
11492
INTERNAL_OPTS="-DPACKAGE_ARCHIVE=On"
11593
fi
11694

95+
mkdir -p ${BUILD_ROOT} && cd ${BUILD_ROOT}
11796
rm -rf ./*
11897
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=Off -DENABLE_TEST=Off ${INTERNAL_OPTS} ${CMAKE_OPTS}
11998

0 commit comments

Comments
 (0)