Skip to content

Commit

Permalink
Merge pull request #1 from skyach/feature/bitcoincash
Browse files Browse the repository at this point in the history
bundle gem peatio-bitcoincash
  • Loading branch information
mod authored Jul 31, 2019
2 parents 6847d2f + cefd634 commit 74f3448
Show file tree
Hide file tree
Showing 39 changed files with 2,001 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status

# Ignore RubyMine files
.idea
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.5.3
- 2.6.2
before_install: gem install bundler -v 1.17.1
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in peatio-bitcoincash.gemspec
gemspec
114 changes: 114 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
PATH
remote: .
specs:
peatio-bitcoincash (0.1.0)
activesupport (~> 5.2.3)
better-faraday (~> 1.0.5)
cash-addr (~> 0.2.0)
faraday (~> 0.15.4)
memoist (~> 0.16.0)
peatio (~> 0.6.1)

GEM
remote: https://rubygems.org/
specs:
activemodel (5.2.3)
activesupport (= 5.2.3)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
amq-protocol (2.3.0)
amqp (1.8.0)
amq-protocol (>= 2.2.0)
eventmachine
base58 (0.2.3)
better-faraday (1.0.5)
activesupport (>= 4.0, < 6.0)
faraday (~> 0.12)
bunny (2.14.2)
amq-protocol (~> 2.3, >= 2.3.0)
byebug (11.0.1)
cash-addr (0.2.0)
base58 (~> 0.2.2)
clamp (1.3.0)
coderay (1.1.2)
concurrent-ruby (1.1.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
hashdiff (0.3.9)
http_parser.rb (0.6.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jwt (2.2.1)
memoist (0.16.0)
metaclass (0.0.4)
method_source (0.9.2)
minitest (5.11.3)
mocha (1.8.0)
metaclass (~> 0.0.1)
multipart-post (2.1.1)
mysql2 (0.5.2)
peatio (0.6.1)
activemodel (~> 5.2.3)
amqp
bunny
clamp
em-websocket
eventmachine
jwt
mysql2
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (3.0.3)
rake (10.5.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
safe_yaml (1.0.5)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.17)
mocha (~> 1.8)
peatio-bitcoincash!
pry-byebug
rake (~> 10.0)
rspec (~> 3.0)
webmock (~> 3.5)

BUNDLED WITH
1.17.1
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Dinesh Chohda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,67 @@
# peatio-bitcoincash
# Peatio::Bitcoincash

Peatio bitcoincash plugin for Rubykube stack

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'peatio-bitcoincash'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install peatio-bitcoincash

## Usage

For Peatio Bitcoincash plugin integration you need to do the following steps:

### Image Build.

1. Add peatio-bitcoincash gem into your Gemfile.plugin
```ruby
gem 'peatio-bitcoincash', '~> 0.1.0'
```

2. Run `bundle install` for updating Gemfile.lock

3. Build custom Peatio [docker image with Bitcoincash plugin](https://github.com/rubykube/peatio/blob/master/docs/plugins.md#build)

4. Push your image using `docker push`

5. Update your deployment to use image with peatio-bitcoincash gem

### Peatio Configuration.

1. Create Bitcoincash Blockchain [config example](config/blockchains.yml).
* No additional steps are needed

2. Create Bitcoincash Currency [config example](config/currencies.yml).
* No additional steps are needed

3. Create Bitcoincash Wallets [config example](config/wallets.yml)(deposit and hot wallets are required).
* No additional steps are needed


## Development

Plugin development [example](https://github.com/rubykube/peatio/blob/master/docs/coins/development.md).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rubykube/peatio-bitcoincash.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Consulting

You can contact Openware for finding certified vendors:
[Openware.com](https://www.openware.com)
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "peatio/bitcoincash"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
10 changes: 10 additions & 0 deletions config/blockchains.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- key: bch-testnet
name: Bitcoincash Testnet
client: bitcoincash # API client name.
server: http://user:[email protected]:18332 # Public Bitcoincash node endpoint.
height: 1087160 # Initial block number from which sync will be started.
min_confirmations: 6 # Minimal confirmations needed for withdraw and deposit confirmation.
explorer:
address: https://www.blocktrail.com/tBCC/address/#{address}
transaction: https://www.blocktrail.com/tBCC/tx/#{txid}
status: active
18 changes: 18 additions & 0 deletions config/currencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- id: bch
name: Bitcoin Cash
blockchain_key: bch-testnet
symbol: '฿'
type: coin
precision: 8
base_factor: 100_000_000
enabled: true
# Deposits with less amount are skipped during blockchain synchronization.
# We advise to set value 10 times bigger than the network fee to prevent losses.
min_deposit_amount: 0.0000748
min_collection_amount: 0.0000748
withdraw_limit_24h: 0.1
withdraw_limit_72h: 0.2
deposit_fee: 0
withdraw_fee: 0
position: 4
options: {}
47 changes: 47 additions & 0 deletions config/wallets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- name: Bitcoincash Deposit Wallet
blockchain_key: bch-testnet
currency_id: bch
# Address where deposits will be collected to.
# IMPORTANT: Use Cash Address Format
address: 'bchtest:qqpkpjpsv5ngwjet9alaktdhklgcrlf9qg9l4ta2w5' # IMPORTANT: Always wrap this value in quotes!
kind: deposit # Wallet kind (deposit, hot, warm, cold or fee).
nsig: 1 # Number of signatures required for performing withdraw.
max_balance: 0.0
status: active
gateway: bitcoincashd # Gateway client name.
settings:
#
# Bitcoincashd gateway client settings.
uri: http://user:[email protected]:18332

- name: Bitcoincash Hot Wallet
blockchain_key: bch-testnet
currency_id: bch
# Address where deposits will be collected to.
# IMPORTANT: Use Cash Address Format
address: 'bchtest:qqpkpjpsv5ngwjet9alaktdhklgcrlf9qg9l4ta2w5' # IMPORTANT: Always wrap this value in quotes!
kind: hot # Wallet kind (deposit, hot, warm, cold or fee).
nsig: 1 # Number of signatures required for performing withdraw.
max_balance: 5.0
status: active
gateway: bitcoincashd # Gateway client name.
settings:
#
# Bitcoincashd gateway client settings.
uri: http://user:[email protected]:18332

- name: Bitcoincash Warm Wallet
blockchain_key: bch-testnet
currency_id: bch
# Address where deposits will be collected to.
# IMPORTANT: Use Cash Address Format
address: 'bchtest:qqpkpjpsv5ngwjet9alaktdhklgcrlf9qg9l4ta2w5' # IMPORTANT: Always wrap this value in quotes!
kind: warm # Wallet kind (deposit, hot, warm, cold or fee).
nsig: 1 # Number of signatures required for performing withdraw.
max_balance: 50.0
status: active
gateway: bitcoincashd # Gateway client name.
settings:
#
# Bitcoincashd gateway client settings.
uri: http://user:[email protected]:18332
29 changes: 29 additions & 0 deletions docs/integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Integration.

For Peatio Bitcoincash plugin integration you need to do the following steps:

## Image Build.

1. Add peatio-bitcoincash gem into your Gemfile.plugin
```ruby
gem 'peatio-bitcoincash', '~> 0.1.0'
```

2. Run `bundle install` for updating Gemfile.lock

3. Build custom Peatio [docker image with Bitcoincash plugin](https://github.com/rubykube/peatio/blob/master/docs/plugins.md#build)

4. Push your image using `docker push`

5. Update your deployment to use image with peatio-bitcoincash gem

## Peatio Configuration.

1. Create Bitcoincash Blockchain [config example](../config/blockchains.yml).
* No additional steps are needed

2. Create Bitcoincash Currency [config example](../config/currencies.yml).
* No additional steps are needed

3. Create Bitcoincash Wallets [config example](../config/wallets.yml)(deposit and hot wallets are required).
* No additional steps are needed
Loading

0 comments on commit 74f3448

Please sign in to comment.