├── .github └── workflows │ └── no-links.yml ├── .gitignore ├── CHANGELOG.md ├── Gemfile ├── Gemfile.lock ├── Guardfile ├── PEATIO-INSTALLER-ONE.sh ├── PEATIO-INSTALLER-THREE.sh ├── PEATIO-INSTALLER-TWO.sh ├── README.md ├── Rakefile ├── app ├── api │ └── api_v2 │ │ ├── auth │ │ ├── authenticator.rb │ │ ├── middleware.rb │ │ └── utils.rb │ │ ├── constraints.rb │ │ ├── deposits.rb │ │ ├── entities │ │ ├── account.rb │ │ ├── base.rb │ │ ├── deposit.rb │ │ ├── market.rb │ │ ├── member.rb │ │ ├── order.rb │ │ ├── order_book.rb │ │ └── trade.rb │ │ ├── errors.rb │ │ ├── helpers.rb │ │ ├── k.rb │ │ ├── markets.rb │ │ ├── members.rb │ │ ├── mount.rb │ │ ├── named_params.rb │ │ ├── order_books.rb │ │ ├── orders.rb │ │ ├── tickers.rb │ │ ├── tools.rb │ │ ├── trades.rb │ │ ├── validations.rb │ │ └── websocket_protocol.rb ├── assets │ ├── images │ │ ├── favicon.ico │ │ └── logo.png │ ├── javascripts │ │ ├── admin.js │ │ ├── admin │ │ │ └── app.js.coffee │ │ ├── api_v2.js │ │ ├── application.js.coffee │ │ ├── component_data │ │ │ ├── global.js.coffee │ │ │ ├── market.js.coffee │ │ │ ├── member.js.coffee │ │ │ └── place_order.js.coffee │ │ ├── component_mixin │ │ │ ├── item_list.js.coffee │ │ │ ├── notification.js.coffee │ │ │ └── order_input.js.coffee │ │ ├── component_ui │ │ │ ├── account_balance.js.coffee │ │ │ ├── account_summary.js.coffee │ │ │ ├── auto_window.js.coffee │ │ │ ├── candlestick.js.coffee │ │ │ ├── depth.js.coffee │ │ │ ├── flash_message.js.coffee │ │ │ ├── float.js.coffee │ │ │ ├── header.js.coffee │ │ │ ├── key_bind.js.coffee │ │ │ ├── market_switch.js.coffee │ │ │ ├── market_ticker.js.coffee │ │ │ ├── market_trades.js.coffee │ │ │ ├── my_orders.js.coffee │ │ │ ├── order_book.js.coffee │ │ │ ├── order_price.js.coffee │ │ │ ├── order_total.js.coffee │ │ │ ├── order_volume.js.coffee │ │ │ ├── place_order.js.coffee │ │ │ ├── push_button.js.coffee │ │ │ ├── range_switch.js.coffee │ │ │ ├── sms_auth_verify.js.coffee │ │ │ ├── switch.js.coffee │ │ │ └── two_factor_auth.js.coffee │ │ ├── funds.js.coffee │ │ ├── funds │ │ │ ├── controllers │ │ │ │ ├── deposit_history_controller.js.coffee │ │ │ │ ├── deposits_controller.js.coffee │ │ │ │ ├── fund_sources_controller.js.coffee │ │ │ │ ├── withdraw_hitstory_controller.js.coffee │ │ │ │ └── withdraws_controller.js.coffee │ │ │ ├── directives │ │ │ │ └── accounts_directives.js.coffee │ │ │ ├── events.js.coffee │ │ │ ├── filters │ │ │ │ ├── precision_filters.js.coffee │ │ │ │ ├── text_filters.js.coffee │ │ │ │ └── translate_filters.js.coffee │ │ │ ├── funds.js.coffee │ │ │ ├── models │ │ │ │ ├── .gitkeep │ │ │ │ ├── account.js.coffee │ │ │ │ ├── currency.js.coffee │ │ │ │ ├── deposit.js.coffee │ │ │ │ ├── deposit_channel.js.coffee │ │ │ │ ├── member.js.coffee │ │ │ │ ├── withdraw.js.coffee │ │ │ │ └── withdraw_channel.js.coffee │ │ │ ├── router.js.coffee │ │ │ └── services │ │ │ │ ├── account_service.js.coffee │ │ │ │ ├── fund_source_service.js.coffee │ │ │ │ ├── gon.js.coffee │ │ │ │ └── ng_dialog.js.coffee │ │ ├── helpers │ │ │ ├── .gitkeep │ │ │ └── formatter.js.coffee │ │ ├── highcharts │ │ │ ├── config.js.coffee │ │ │ └── technical_indicators.js │ │ ├── html5.js │ │ ├── lib │ │ │ ├── ajax.js.coffee │ │ │ ├── angular-ui-router.js │ │ │ ├── notifier.js.coffee │ │ │ ├── peatio_model.js.coffee │ │ │ ├── pusher_connection.js.coffee │ │ │ ├── pusher_subscriber.js.coffee │ │ │ ├── sfx.js.coffee │ │ │ └── tiny-pubsub.js │ │ ├── locales │ │ │ ├── en.js.erb │ │ │ └── zh-CN.js.erb │ │ ├── market.js.coffee │ │ ├── swagger-ui │ │ │ ├── lib │ │ │ │ ├── backbone-min.js │ │ │ │ ├── handlebars-1.0.0.js │ │ │ │ ├── highlight.7.3.pack.js │ │ │ │ ├── jquery-1.8.0.min.js │ │ │ │ ├── jquery.ba-bbq.min.js │ │ │ │ ├── jquery.slideto.min.js │ │ │ │ ├── jquery.wiggle.min.js │ │ │ │ ├── shred.bundle.js │ │ │ │ ├── shred │ │ │ │ │ └── content.js │ │ │ │ ├── swagger-oauth.js │ │ │ │ ├── swagger.js │ │ │ │ └── underscore-min.js │ │ │ └── swagger-ui.js │ │ └── templates │ │ │ ├── flash_message.jst.eco │ │ │ ├── hint_order_success.jst.eco │ │ │ ├── hint_order_warning.jst.eco │ │ │ ├── market_trade.jst.eco │ │ │ ├── my_trade.jst.eco │ │ │ ├── order_active.jst.eco │ │ │ ├── order_book_ask.jst.eco │ │ │ ├── order_book_bid.jst.eco │ │ │ ├── order_done.jst.eco │ │ │ └── tooltip.jst.eco │ └── stylesheets │ │ ├── admin.css.scss │ │ ├── api_v2.css.scss │ │ ├── application.css.scss │ │ ├── custom │ │ └── market.css.scss │ │ ├── features │ │ ├── _assets.css.scss │ │ ├── _custom.css.scss │ │ ├── _documents.css.scss │ │ ├── _history.css.scss │ │ ├── _id_document.css.scss │ │ ├── _market.css.scss │ │ ├── _market_chart.css.scss │ │ ├── _simple_captcha.css.scss │ │ ├── _welcome.css.scss │ │ └── funds.css.scss │ │ ├── layouts │ │ ├── _basic.css.scss │ │ ├── _custom.css.scss │ │ └── _header.css.scss │ │ ├── market.css.scss │ │ ├── market_light.css.scss │ │ ├── swagger-ui │ │ ├── highlight.default.css │ │ └── screen.css │ │ └── vars │ │ ├── _basic.css.scss │ │ ├── _bootstrap.css.scss │ │ ├── _bootstrap_market.css.scss │ │ ├── _custom.css.scss │ │ ├── _market.css.scss │ │ └── _market_light.css.scss ├── controllers │ ├── activations_controller.rb │ ├── admin │ │ ├── base_controller.rb │ │ ├── comments_controller.rb │ │ ├── dashboard_controller.rb │ │ ├── deposits │ │ │ ├── banks_controller.rb │ │ │ ├── base_controller.rb │ │ │ ├── ethers_controller.rb │ │ │ └── satoshis_controller.rb │ │ ├── deposits_controller.rb │ │ ├── documents_controller.rb │ │ ├── id_documents_controller.rb │ │ ├── members_controller.rb │ │ ├── proofs_controller.rb │ │ ├── statistic │ │ │ ├── base_controller.rb │ │ │ ├── deposits_controller.rb │ │ │ ├── members_controller.rb │ │ │ ├── orders_controller.rb │ │ │ ├── trades_controller.rb │ │ │ └── withdraws_controller.rb │ │ ├── tickets_controller.rb │ │ ├── two_factors_controller.rb │ │ └── withdraws │ │ │ ├── banks_controller.rb │ │ │ ├── base_controller.rb │ │ │ ├── ethers_controller.rb │ │ │ └── satoshis_controller.rb │ ├── application_controller.rb │ ├── authentications │ │ ├── emails_controller.rb │ │ └── identities_controller.rb │ ├── concerns │ │ ├── deposits │ │ │ ├── ctrl_bankable.rb │ │ │ └── ctrl_coinable.rb │ │ ├── order_creation.rb │ │ ├── token_management.rb │ │ └── withdraws │ │ │ └── withdrawable.rb │ ├── documents_controller.rb │ ├── identities_controller.rb │ ├── members_controller.rb │ ├── private │ │ ├── account_versions_controller.rb │ │ ├── api_tokens_controller.rb │ │ ├── assets_controller.rb │ │ ├── base_controller.rb │ │ ├── comments_controller.rb │ │ ├── deposits │ │ │ ├── banks_controller.rb │ │ │ ├── base_controller.rb │ │ │ ├── ethers_controller.rb │ │ │ └── satoshis_controller.rb │ │ ├── fund_sources_controller.rb │ │ ├── funds_controller.rb │ │ ├── history_controller.rb │ │ ├── id_documents_controller.rb │ │ ├── markets_controller.rb │ │ ├── order_asks_controller.rb │ │ ├── order_bids_controller.rb │ │ ├── orders_controller.rb │ │ ├── payment_addresses_controller.rb │ │ ├── pusher_controller.rb │ │ ├── settings_controller.rb │ │ ├── tickets_controller.rb │ │ ├── trade_states_controller.rb │ │ └── withdraws │ │ │ ├── banks_controller.rb │ │ │ ├── base_controller.rb │ │ │ ├── ethers_controller.rb │ │ │ └── satoshis_controller.rb │ ├── reset_passwords_controller.rb │ ├── sessions_controller.rb │ ├── two_factors_controller.rb │ ├── verify │ │ ├── google_auths_controller.rb │ │ └── sms_auths_controller.rb │ ├── webhooks_controller.rb │ └── welcome_controller.rb ├── grids │ ├── account_versions_grid.rb │ ├── documents_grid.rb │ ├── proofs_grid.rb │ └── statistic │ │ ├── deposits_grid.rb │ │ ├── orders_grid.rb │ │ ├── trades_grid.rb │ │ └── withdraws_grid.rb ├── helpers │ ├── application_helper.rb │ ├── mailer_helper.rb │ ├── private │ │ ├── assets_helper.rb │ │ ├── history_helper.rb │ │ └── tickets_helper.rb │ ├── tag_helper.rb │ └── two_factor_helper.rb ├── inputs │ └── display_input.rb ├── mailers │ ├── .gitkeep │ ├── base_mailer.rb │ ├── comment_mailer.rb │ ├── deposit_mailer.rb │ ├── member_mailer.rb │ ├── system_mailer.rb │ ├── ticket_mailer.rb │ ├── token_mailer.rb │ └── withdraw_mailer.rb ├── models │ ├── .gitkeep │ ├── account.rb │ ├── account_version.rb │ ├── active_yaml_base.rb │ ├── admin │ │ └── ability.rb │ ├── amqp_config.rb │ ├── amqp_queue.rb │ ├── api_token.rb │ ├── asset.rb │ ├── audit │ │ ├── audit_log.rb │ │ └── transfer_audit_log.rb │ ├── authentication.rb │ ├── bank.rb │ ├── comment.rb │ ├── concerns │ │ ├── aasm_absolutely.rb │ │ ├── channelable.rb │ │ ├── currencible.rb │ │ ├── deposits │ │ │ ├── bankable.rb │ │ │ └── coinable.rb │ │ ├── fund_sourceable.rb │ │ ├── hash_currencible.rb │ │ ├── international.rb │ │ └── withdraws │ │ │ ├── bankable.rb │ │ │ └── coinable.rb │ ├── currency.rb │ ├── deposit.rb │ ├── deposit_channel.rb │ ├── deposits │ │ ├── bank.rb │ │ ├── ether.rb │ │ └── satoshi.rb │ ├── document.rb │ ├── fund_source.rb │ ├── global.rb │ ├── id_document.rb │ ├── identity.rb │ ├── market.rb │ ├── matching │ │ ├── constants.rb │ │ ├── engine.rb │ │ ├── executor.rb │ │ ├── limit_order.rb │ │ ├── market_order.rb │ │ ├── order_book.rb │ │ ├── order_book_manager.rb │ │ └── price_level.rb │ ├── member.rb │ ├── member_tag.rb │ ├── order.rb │ ├── order_ask.rb │ ├── order_bid.rb │ ├── partial_tree.rb │ ├── payment_address.rb │ ├── payment_transaction.rb │ ├── payment_transaction │ │ └── normal.rb │ ├── proof.rb │ ├── running_account.rb │ ├── signup_history.rb │ ├── ticket.rb │ ├── token.rb │ ├── token │ │ ├── activation.rb │ │ └── reset_password.rb │ ├── trade.rb │ ├── two_factor.rb │ ├── two_factor │ │ ├── app.rb │ │ ├── email.rb │ │ ├── sms.rb │ │ └── wechat.rb │ ├── withdraw.rb │ ├── withdraw_channel.rb │ ├── withdraws │ │ ├── bank.rb │ │ ├── ether.rb │ │ └── satoshi.rb │ └── worker │ │ ├── deposit_coin.rb │ │ ├── deposit_coin_address.rb │ │ ├── email_notification.rb │ │ ├── fund_stats.rb │ │ ├── market_ticker.rb │ │ ├── matching.rb │ │ ├── member_stats.rb │ │ ├── order_processor.rb │ │ ├── pusher_market.rb │ │ ├── pusher_member.rb │ │ ├── slave_book.rb │ │ ├── sms_notification.rb │ │ ├── stats.rb │ │ ├── top_stats.rb │ │ ├── trade_executor.rb │ │ ├── trade_stats.rb │ │ ├── wallet_stats.rb │ │ └── withdraw_coin.rb ├── observers │ ├── audit_observer.rb │ └── transfer_observer.rb ├── services │ ├── coin_rpc.rb │ └── ordering.rb ├── uploaders │ └── file_uploader.rb ├── validators │ ├── currency_validator.rb │ ├── email_validator.rb │ ├── strength_validator.rb │ ├── ticket_validator.rb │ └── withdraw_blacklist_validator.rb └── views │ ├── activations │ └── new.html.slim │ ├── admin │ ├── currency_deposits │ │ └── new.html.slim │ ├── dashboard │ │ └── index.html.slim │ ├── deposits │ │ ├── _deposit.html.slim │ │ ├── banks │ │ │ ├── _table.html.slim │ │ │ ├── index.html.slim │ │ │ └── show.html.slim │ │ ├── edit.html.slim │ │ ├── ethers │ │ │ └── index.html.slim │ │ ├── index.html.slim │ │ └── satoshis │ │ │ └── index.html.slim │ ├── documents │ │ ├── _form.html.slim │ │ ├── edit.html.slim │ │ ├── index.html.slim │ │ └── new.html.slim │ ├── id_documents │ │ ├── index.html.slim │ │ └── show.html.slim │ ├── members │ │ ├── index.html.slim │ │ ├── show.html.slim │ │ ├── show.json.jbuilder │ │ └── toggle.js.erb │ ├── proofs │ │ ├── edit.html.slim │ │ └── index.html.slim │ ├── statistic │ │ ├── deposits │ │ │ └── show.html.slim │ │ ├── members │ │ │ └── show.html.slim │ │ ├── orders │ │ │ └── show.html.slim │ │ ├── shared │ │ │ ├── _filter.html.slim │ │ │ └── _summary.html.slim │ │ ├── trades │ │ │ └── show.html.slim │ │ └── withdraws │ │ │ └── show.html.slim │ ├── tickets │ │ ├── index.html.slim │ │ └── show.html.slim │ └── withdraws │ │ ├── banks │ │ ├── _table.html.slim │ │ ├── index.html.slim │ │ └── show.html.slim │ │ ├── ethers │ │ ├── _table.html.slim │ │ ├── index.html.slim │ │ └── show.html.slim │ │ └── satoshis │ │ ├── _table.html.slim │ │ ├── index.html.slim │ │ └── show.html.slim │ ├── api │ └── v1 │ │ ├── deeps │ │ └── show.jbuilder │ │ ├── prices │ │ └── show.jbuilder │ │ ├── tickers │ │ └── show.jbuilder │ │ └── trades │ │ └── show.jbuilder │ ├── authentications │ ├── emails │ │ └── new.html.slim │ └── identities │ │ └── new.html.slim │ ├── comment_mailer │ ├── admin_notification.html.erb │ └── user_notification.html.erb │ ├── datagrid │ ├── _form.html.erb │ ├── _head.html.erb │ ├── _order_for.html.erb │ ├── _row.html.erb │ └── _table.html.erb │ ├── deposit_mailer │ └── accepted.html.erb │ ├── documents │ ├── api_v2.en.html.slim │ ├── api_v2.zh-CN.html.slim │ ├── oauth.en.html.slim │ ├── oauth.zh-CN.html.slim │ ├── show.html.slim │ └── websocket_api.html.slim │ ├── doorkeeper │ └── authorizations │ │ └── new.html.erb │ ├── errors │ └── connection.html.slim │ ├── identities │ ├── edit.html.slim │ └── new.html.slim │ ├── kaminari │ ├── _first_page.html.slim │ ├── _gap.html.slim │ ├── _last_page.html.slim │ ├── _next_page.html.slim │ ├── _page.html.slim │ ├── _paginator.html.slim │ └── _prev_page.html.slim │ ├── layouts │ ├── admin.html.slim │ ├── api_v2.html.slim │ ├── application.html.slim │ ├── funds.html.erb │ ├── landing.html.slim │ └── mailers │ │ ├── application.html.erb │ │ └── system.html.erb │ ├── member_mailer │ ├── google_auth_activated.html.erb │ ├── google_auth_deactivated.html.erb │ ├── notify_signin.html.erb │ ├── phone_number_verified.html.erb │ ├── reset_password_done.html.erb │ ├── sms_auth_activated.html.erb │ └── sms_auth_deactivated.html.erb │ ├── members │ └── edit.html.slim │ ├── private │ ├── account_versions │ │ └── index.html.slim │ ├── api_tokens │ │ ├── _oauth_tokens.html.slim │ │ ├── _user_tokens.html.slim │ │ ├── create.html.slim │ │ ├── edit.html.slim │ │ ├── index.html.slim │ │ └── new.html.slim │ ├── assets │ │ ├── _btc_assets.html.slim │ │ ├── _cny_assets.html.slim │ │ ├── _liability_data.html.slim │ │ ├── _liability_proof.html.slim │ │ ├── _liability_tabs.html.slim │ │ ├── index.html.slim │ │ └── partial_tree.js.erb │ ├── funds │ │ ├── index.html.erb │ │ └── index.json.jbuilder │ ├── history │ │ ├── _order.html.slim │ │ ├── _tabs.html.slim │ │ ├── _trade.html.slim │ │ ├── _transaction.html.slim │ │ ├── account.html.slim │ │ ├── orders.html.slim │ │ └── trades.html.slim │ ├── id_documents │ │ └── edit.html.slim │ ├── markets │ │ ├── _account_summary.html.slim │ │ ├── _ask_entry.html.slim │ │ ├── _balance.html.slim │ │ ├── _bid_entry.html.slim │ │ ├── _candlestick.html.slim │ │ ├── _chat.html.slim │ │ ├── _depths.html.slim │ │ ├── _header.html.slim │ │ ├── _indicator_switch.html.slim │ │ ├── _language.html.slim │ │ ├── _market_list.html.slim │ │ ├── _market_trades.html.slim │ │ ├── _mask.html.slim │ │ ├── _my_orders.html.slim │ │ ├── _order_book.html.slim │ │ ├── _range_switch.html.slim │ │ ├── _settings.html.slim │ │ ├── _status.html.slim │ │ ├── _ticker.html.slim │ │ ├── show.html.slim │ │ └── show.json.jbuilder │ ├── settings │ │ └── index.html.slim │ ├── shared │ │ └── _balances.html.slim │ ├── tickets │ │ ├── index.html.slim │ │ ├── new.html.slim │ │ └── show.html.slim │ └── withdraws │ │ ├── ethers │ │ ├── edit.html.slim │ │ └── new.html.slim │ │ ├── index.html.slim │ │ └── satoshis │ │ ├── edit.html.slim │ │ └── new.html.slim │ ├── reset_passwords │ ├── edit.html.slim │ └── new.html.slim │ ├── sessions │ └── new.html.slim │ ├── shared │ ├── _alert.html.slim │ ├── _document.html.slim │ ├── _flash.slim │ ├── _footer.html.slim │ ├── _frame.html.slim │ ├── _header.html.slim │ ├── _header_account_balance.html.slim │ ├── _header_lang_sel.html.slim │ ├── _header_profile_setting.html.slim │ ├── _html5.html.slim │ ├── _meta.html.slim │ ├── _two_factor_app.html.slim │ ├── _two_factor_app_and_sms.html.slim │ ├── _two_factor_auth.html.slim │ ├── _two_factor_sms.html.slim │ ├── admin │ │ ├── _account.html.slim │ │ ├── _member.html.slim │ │ └── _member_accounts.html.slim │ └── market │ │ ├── _chart.html.slim │ │ ├── _market_sel.html.slim │ │ └── _ticker.html.slim │ ├── simple_captcha │ └── _simple_captcha.erb │ ├── system_mailer │ ├── balance_warning.text.erb │ ├── daily_stats.html.erb │ ├── order_processor_error.text.erb │ └── trade_execute_error.text.erb │ ├── ticket_mailer │ ├── admin_notification.html.erb │ └── author_notification.html.erb │ ├── token_mailer │ ├── activation.html.erb │ └── reset_password.html.erb │ ├── two_factors │ └── index.html.slim │ ├── verify │ ├── google_auths │ │ ├── edit.html.slim │ │ └── show.html.slim │ └── sms_auths │ │ └── show.html.slim │ ├── welcome │ └── index.html.slim │ └── withdraw_mailer │ ├── done.html.erb │ ├── processing.html.erb │ ├── submitted.html.erb │ └── withdraw_state.html.erb ├── bin ├── bundle ├── concurrent_create_order_benchmark.rb ├── init_config ├── rails ├── rake ├── rspec └── transifex ├── config.ru ├── config ├── amqp.yml.example ├── application.rb ├── application.yml.example ├── banks.yml.example ├── boot.rb ├── currencies.yml.example ├── daemons.yml ├── database.yml.example ├── deploy.rb ├── deposit_channels.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── action_controller.rb │ ├── activerecord.rb │ ├── backtrace_silencers.rb │ ├── carrierwave.rb │ ├── check_env.rb │ ├── datagrid │ │ └── filters │ │ │ └── date_time_filter.rb │ ├── date_time_format.rb │ ├── dirty_ext.rb │ ├── doorkeeper.rb │ ├── easy_table.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── kaminari_config.rb │ ├── mime_types.rb │ ├── mysql2_adapter.rb │ ├── omniauth.rb │ ├── pusher.rb │ ├── secret_token.rb │ ├── simple_form.rb │ ├── simple_form_bootstrap.rb │ ├── string_extend.rb │ ├── withdraw_blacklist.rb │ └── wrap_parameters.rb ├── locales │ ├── client.cs.yml │ ├── client.de.yml │ ├── client.el.yml │ ├── client.en.yml │ ├── client.it.yml │ ├── client.ko.yml │ ├── client.ru_RU.yml │ ├── client.zh-CN.yml │ ├── client.zh-TW.yml │ ├── custom │ │ ├── client.en.yml │ │ ├── client.zh-CN.yml │ │ ├── server.en.yml │ │ └── server.zh-CN.yml │ ├── server.cs.yml │ ├── server.de.yml │ ├── server.el.yml │ ├── server.en.yml │ ├── server.it.yml │ ├── server.ko.yml │ ├── server.ru_RU.yml │ ├── server.zh-CN.yml │ └── server.zh-TW.yml ├── logrotate.conf ├── maintenance.sh ├── markets.yml.example ├── member_tags.yml ├── nginx.conf ├── nginx_maintenance.conf ├── routes.rb ├── routes │ └── admin.rb ├── schedule.rb ├── slack.yml.example └── withdraw_channels.yml ├── db ├── migrate │ ├── 20130624011823_create_members.rb │ ├── 20130629015414_create_identities.rb │ ├── 20130810162023_create_reset_passwords.rb │ ├── 20130901010953_create_orders.rb │ ├── 20130901154530_create_trades.rb │ ├── 20130903080937_create_account_versions.rb │ ├── 20130904215802_add_is_active_to_two_factors.rb │ ├── 20130905025823_fix_account_id_by_reset_pin.rb │ ├── 20130905132250_add_balance_to_account_versions.rb │ ├── 20130906073020_create_payment_addresses.rb │ ├── 20130906073931_create_payment_transactions.rb │ ├── 20130907110146_create_withdraws.rb │ ├── 20130907124647_create_deposits.rb │ ├── 20130912144526_add_receive_at_to_payment_transactions.rb │ ├── 20130915150504_add_payment_id_to_withdraws.rb │ ├── 20130918143551_add_ref_to_account_versions.rb │ ├── 20130919091853_add_sn_to_orders.rb │ ├── 20130925154257_change_to_enumerize_in_orders.rb │ ├── 20130925165804_change_to_enumerize_in_trades.rb │ ├── 20130925171856_change_to_enumerize_in_accounts.rb │ ├── 20130925175113_change_to_enumerize_in_deposits.rb │ ├── 20130926011813_change_to_enumerize_in_payment_transactions.rb │ ├── 20130926014845_change_to_enumerize_in_withdraws.rb │ ├── 20130926075355_change_to_enumerize_in_account_versions.rb │ ├── 20130926170008_change_ref_to_text_in_account_versions.rb │ ├── 20130928080757_create_account_logs.rb │ ├── 20130928113620_delete_table_account_versions.rb │ ├── 20130928122042_rename_account_logs_to_account_versions.rb │ ├── 20130928165236_add_alipay_to_members.rb │ ├── 20130928190156_rename_member_id_to_identity_id.rb │ ├── 20130928194048_add_alipay_address_to_members.rb │ ├── 20130929012418_create_invitations.rb │ ├── 20130930172651_rebuild_withdraws.rb │ ├── 20130930183833_migrate_withdraw_addresses.rb │ ├── 20131001103847_add_deleted_at_to_withdraw_addresses.rb │ ├── 20131002012809_add_fee_to_withdraws.rb │ ├── 20131002190141_rebuild_deposits.rb │ ├── 20131003003357_add_address_to_deposits.rb │ ├── 20131003021225_rename_txid_to_payment_transactions.rb │ ├── 20131006183340_create_tokens.rb │ ├── 20131009132505_create_documents.rb │ ├── 20131022035138_add_in_out_to_accounts.rb │ ├── 20131027012836_change_in_out_to_accounts.rb │ ├── 20131110214254_add_currency_to_payment_transactions.rb │ ├── 20131130190923_remove_pin_digest_from_identities.rb │ ├── 20131201011127_drop_reset_pins.rb │ ├── 20131204020953_add_currency_to_account_versions.rb │ ├── 20131208012814_fix_payment_address_currency.rb │ ├── 20131224162832_add_sn_to_withdraws.rb │ ├── 20140101175408_add_fee_to_account_versions.rb │ ├── 20140102024125_add_fun_to_account_versions.rb │ ├── 20140102172835_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb │ ├── 20140102172836_add_missing_unique_indices.acts_as_taggable_on_engine.rb │ ├── 20140105034746_drop_reset_passwords.rb │ ├── 20140302094520_rename_identity_id_to_member_id.rb │ ├── 20140302094729_migration_data_identity_id_to_member_id.rb │ ├── 20140302161905_create_authentications.rb │ ├── 20140303060739_add_activated_to_members.rb │ ├── 20140303080054_rename_is_active_to_activated.rb │ ├── 20140304015055_create_documents_translations.rb │ ├── 20140306020939_create_id_documents.rb │ ├── 20140306021833_add_verified_to_id_documents.rb │ ├── 20140312061206_add_aasm_state_to_withdraws.rb │ ├── 20140312071704_add_sum_to_withdraws.rb │ ├── 20140319022202_add_partial_tree_to_accounts.rb │ ├── 20140319022302_create_proofs.rb │ ├── 20140320142701_create_versions.rb │ ├── 20140324060148_rename_withdraw_addresses_to_fund_sources.rb │ ├── 20140324062812_rename_address_column_by_withdraws.rb │ ├── 20140326170234_change_deposits.rb │ ├── 20140326191837_add_deposit_id_to_payment_transactions.rb │ ├── 20140327044440_change_withdraws.rb │ ├── 20140327062025_add_memo_and_remove_fund_source_to_deposits.rb │ ├── 20140327065708_rename_fund_sources_category_to_channel_id.rb │ ├── 20140327105217_remove_fund_sources_account_id.rb │ ├── 20140328101707_add_type_to_deposits.rb │ ├── 20140329070543_remove_channel_id.rb │ ├── 20140331084541_fund_sources_is_locked_default_to_false.rb │ ├── 20140402043033_create_partial_trees.rb │ ├── 20140403031847_create_api_tokens.rb │ ├── 20140403070840_add_type_to_withdraws.rb │ ├── 20140404074816_add_currency_index_to_trades.rb │ ├── 20140404101823_add_ask_member_id_and_bid_member_id_to_trades.rb │ ├── 20140405053744_remove_withdraws_state_and_channel_id.rb │ ├── 20140407011310_add_source_to_orders.rb │ ├── 20140416143239_add_country_code_to_members.rb │ ├── 20140416143352_add_phone_number_to_members.rb │ ├── 20140416151403_add_phone_number_verified_to_members.rb │ ├── 20140416194209_remove_table_invitations.rb │ ├── 20140416194300_remove_table_members_trades.rb │ ├── 20140418082715_add_sum_to_proofs.rb │ ├── 20140421061712_add_index_on_accounts.rb │ ├── 20140421080408_add_type_to_two_factors.rb │ ├── 20140428203350_add_desc_and_keyword_to_documents.rb │ ├── 20140507120249_add_addresses_to_proofs.rb │ ├── 20140524014413_add_ord_type_to_orders.rb │ ├── 20140530133210_add_locked_to_orders.rb │ ├── 20140531054739_add_used_funds_to_trades.rb │ ├── 20140618004355_add_displayname_to_members.rb │ ├── 20140702035833_add_balance_to_proofs.rb │ ├── 20140703065321_add_order_id_indices_to_trades.rb │ ├── 20140703070953_add_funds_received_to_orders.rb │ ├── 20140707115022_create_audit_logs.rb │ ├── 20140709084906_create_tickets.rb │ ├── 20140709085158_create_comments.rb │ ├── 20140712030803_add_disabled_to_members.rb │ ├── 20140714143823_unread_migration.rb │ ├── 20140715002401_add_more_fields_to_id_documents_table.rb │ ├── 20140715040545_remove_name_field_from_members_table.rb │ ├── 20140715083857_add_aasm_state_to_id_document.rb │ ├── 20140717033231_add_assets_table.rb │ ├── 20140718134132_rename_id_documents_column_category_to_id_document_type.rb │ ├── 20140718141345_rename_id_documents_column_from_sn_to_id_document_number.rb │ ├── 20140721125900_remove_column_verified_from_id_documents.rb │ ├── 20140724033014_add_trusted_ip_list_to_api_tokens.rb │ ├── 20140803202610_remove_channel_id_from_fund_sources.rb │ ├── 20140804002557_add_api_disabled_to_members.rb │ ├── 20140804151249_change_default_of_withdrao_fee.rb │ ├── 20140806141035_add_index_to_orders.rb │ ├── 20140806141419_add_index_to_trades.rb │ ├── 20140819085359_add_index_to_order_state.rb │ ├── 20140819090417_add_index_on_orders_member_id_and_state.rb │ ├── 20140826083906_add_label_to_api_token.rb │ ├── 20140826093508_add_refreshed_at_to_two_factors.rb │ ├── 20140902112641_create_simple_captcha_data.rb │ ├── 20140920062130_add_type_to_payment_transactions.rb │ ├── 20141002075102_add_tx_out_to_payment_transactions.rb │ ├── 20141003040822_add_payment_transaction_id_to_deposits.rb │ ├── 20141003061259_add_txout_to_deposits.rb │ ├── 20141010083930_remove_phone_number_verified_from_members.rb │ ├── 20141012124243_set_token_is_used_to_false_as_default.rb │ ├── 20141014085101_add_nickname_to_members.rb │ ├── 20141015034040_add_nickname_to_authentications.rb │ ├── 20141105023306_create_doorkeeper_tables.rb │ ├── 20141105090746_add_oauth_columns_to_api_tokens.rb │ ├── 20141107031140_add_deleted_at_to_api_tokens_and_oauth_tokens.rb │ ├── 20141119155043_create_running_accounts.rb │ ├── 20141203042029_rename_deposits_memo_to_confirmations.rb │ ├── 20141216120736_add_trades_count_to_orders.rb │ ├── 20150117151634_add_signup_histories.rb │ ├── 20150205011423_add_account_id_index_on_account_versions.rb │ └── 20150405053726_add_default_withdraw_fund_source_id_to_accounts.rb ├── schema.rb └── seeds.rb ├── doc ├── AWS.md ├── README.md ├── bitgo.md ├── currency.md ├── deploy-production-server.md ├── docker │ ├── Dockerfile │ ├── bin │ │ ├── base.sh │ │ └── webapp.sh │ └── conf │ │ ├── nginx-peatio-env.conf │ │ ├── nginx-peatio-with-ssl.conf │ │ ├── rails-amqp.yml │ │ ├── rails-application.yml │ │ └── rails-database.yml ├── eth.md ├── setup-local-osx.md └── setup-local-ubuntu.md ├── eth ├── default ├── filter.service ├── geth.service ├── restart.cgi ├── service.rb ├── total.cgi └── total.js ├── lib ├── aasm │ └── locking.rb ├── assets │ └── .gitkeep ├── benchmark │ ├── amqp_mock.rb │ ├── execution.rb │ ├── helpers.rb │ ├── integration.rb │ ├── matching.rb │ └── sweat_factory.rb ├── daemons │ ├── amqp_daemon.rb │ ├── daemons │ ├── deposit_coin_ctl │ ├── global_state.rb │ ├── global_state_ctl │ ├── hot_wallets.rb │ ├── hot_wallets_ctl │ ├── k.rb │ ├── k_ctl │ ├── market_data_ctl │ ├── matching_ctl │ ├── notification_ctl │ ├── order_processor_ctl │ ├── payment_transaction.rb │ ├── payment_transaction_ctl │ ├── pusher_ctl │ ├── stats.rb │ ├── stats_ctl │ ├── trade_executor_ctl │ ├── websocket_api.rb │ ├── websocket_api_ctl │ ├── withdraw_audit.rb │ ├── withdraw_audit_ctl │ └── withdraw_coin_ctl ├── datagrid │ ├── column_i18n.rb │ └── naming.rb ├── doorkeeper │ └── access_token.rb ├── extras │ └── simple_form_extensions.rb ├── generators │ ├── deposit │ │ ├── USAGE │ │ ├── deposit_generator.rb │ │ └── templates │ │ │ ├── controller.rb.erb │ │ │ ├── locales │ │ │ ├── en.yml.erb │ │ │ └── zh-CN.yml.erb │ │ │ ├── model.rb.erb │ │ │ └── views │ │ │ └── new.html.slim.erb │ └── withdraw │ │ ├── USAGE │ │ ├── templates │ │ ├── controller.rb.erb │ │ ├── locales │ │ │ ├── en.yml.erb │ │ │ └── zh-CN.yml.erb │ │ ├── model.rb.erb │ │ └── views │ │ │ ├── edit.html.slim.erb │ │ │ └── new.html.slim.erb │ │ └── withdraw_generator.rb ├── js_locale_helper.rb ├── kline_db.rb ├── market_constraint.rb ├── middleware │ ├── i18n_js.rb │ └── security.rb ├── peatio │ └── version.rb ├── tasks │ ├── .gitkeep │ ├── benchmark.rake │ ├── coin.rake │ ├── deploy.rake │ ├── emu.rake │ ├── install.rake │ ├── migration.rake │ ├── order.rake │ ├── replay.rake │ ├── solvency.rake │ └── stats.rake └── templates │ └── slim │ └── scaffold │ └── _form.html.slim ├── peatio-installer-using-vagrant.sh ├── peatio-run-daemons.sh ├── public ├── 404.html ├── 422.html ├── 500.html ├── 502.html ├── ZeroClipboard.swf ├── btsx.chongzhi.yunbi.png ├── favicon.ico ├── icon-btc.png ├── icon-cny.png ├── icon-eth.png ├── icon-pts.png ├── languages │ ├── en.png │ ├── ko.png │ └── zh-CN.png ├── peatio-notification-logo.png ├── peatio.png ├── robots.txt ├── sounds │ ├── success.mp3 │ └── warning.mp3 ├── templates │ ├── fund_sources │ │ ├── bank.html │ │ └── coin.html │ ├── funds │ │ ├── _address.html │ │ ├── _coin_withdraw.html │ │ ├── _deposit_coin.html │ │ ├── _deposit_coin_history.html │ │ ├── _flash.html │ │ ├── _qrcode.html │ │ ├── _two_factor_auth.html │ │ ├── accounts.html │ │ ├── deposit.html │ │ ├── deposit_btc.html │ │ ├── deposit_cny.html │ │ ├── deposit_eth.html │ │ ├── deposits.html │ │ ├── withdraw.html │ │ ├── withdraw_btc.html │ │ ├── withdraw_cny.html │ │ ├── withdraw_eth.html │ │ └── withdraws.html │ └── shared │ │ └── confirm_dialog.html └── throbber.gif ├── rails.sh ├── script └── pre-commit.sh ├── server.sh ├── spec ├── api │ └── api_v2 │ │ ├── auth │ │ ├── authenticator_spec.rb │ │ ├── middleware_spec.rb │ │ └── utils_spec.rb │ │ ├── deposits_spec.rb │ │ ├── entities │ │ ├── account_spec.rb │ │ ├── member_spec.rb │ │ ├── order_spec.rb │ │ └── trade_spec.rb │ │ ├── helpers_spec.rb │ │ ├── markets_spec.rb │ │ ├── members_spec.rb │ │ ├── mount_spec.rb │ │ ├── order_books_spec.rb │ │ ├── orders_spec.rb │ │ ├── tickers_spec.rb │ │ └── trades_spec.rb ├── controllers │ ├── activations_controller_spec.rb │ ├── admin │ │ ├── id_documents_controller_spec.rb │ │ ├── members_controller_spec.rb │ │ └── two_factors_spec.rb │ ├── application_controller_spec.rb │ ├── authentications │ │ ├── emails_controller_spec.rb │ │ └── identities_controller_spec.rb │ ├── private │ │ ├── assets_controller_spec.rb │ │ ├── fund_sources_controller_spec.rb │ │ ├── funds_controller_spec.rb │ │ ├── id_documents_controller_spec.rb │ │ ├── markets_controller_spec.rb │ │ ├── order_asks_controller_spec.rb │ │ ├── order_bids_controller_spec.rb │ │ └── settings_controller_spec.rb │ ├── reset_password_controller_spec.rb │ ├── two_factors_controller_spec.rb │ └── verify │ │ ├── google_auths_controller_spec.rb │ │ └── sms_auths_controller_spec.rb ├── factories │ ├── account.rb │ ├── api_tokens.rb │ ├── authentications.rb │ ├── comments.rb │ ├── deposits.rb │ ├── documents.rb │ ├── fund_source.rb │ ├── id_document.rb │ ├── identity.rb │ ├── member.rb │ ├── orders.rb │ ├── partial_trees.rb │ ├── payment_addresses.rb │ ├── payment_transactions.rb │ ├── proofs.rb │ ├── tickets.rb │ ├── token.rb │ ├── trade.rb │ ├── two_factor.rb │ └── withdraw.rb ├── features │ ├── admin │ │ └── withdraw_spec.rb │ ├── market_spec.rb │ ├── market_trade_history_spec.rb │ ├── reset_password_spec.rb │ ├── sign_in_spec.rb │ ├── sign_up_spec.rb │ ├── tag_spec.rb │ ├── two_factor_auth_spec.rb │ └── withdraw_spec.rb ├── fixtures │ ├── banks.yml │ ├── currencies.yml │ ├── deposit_channels.yml │ ├── markets.yml │ ├── member_tags.yml │ └── withdraw_channels.yml ├── helpers │ ├── private │ │ └── assets_helper_spec.rb │ └── two_factor_helper_spec.rb ├── lib │ └── doorkeeper │ │ └── access_token_spec.rb ├── mailers │ ├── deposit_mailer_spec.rb │ ├── member_mailer_spec.rb │ └── withdraw_mailer_spec.rb ├── models │ ├── account_spec.rb │ ├── account_version_spec.rb │ ├── amqp_config_spec.rb │ ├── amqp_queue_spec.rb │ ├── api_token_spec.rb │ ├── audit │ │ └── transfer_audit_log_spec.rb │ ├── bank_spec.rb │ ├── comment_spec.rb │ ├── deposit_channel_spec.rb │ ├── deposit_spec.rb │ ├── documnet_spec.rb │ ├── fund_source_spec.rb │ ├── global_spec.rb │ ├── id_document_spec.rb │ ├── identity_spec.rb │ ├── market_spec.rb │ ├── matching │ │ ├── engine_spec.rb │ │ ├── executor_spec.rb │ │ ├── limit_order_spec.rb │ │ ├── market_order_spec.rb │ │ ├── order_book_manager_spec.rb │ │ ├── order_book_spec.rb │ │ └── price_level_spec.rb │ ├── member_spec.rb │ ├── order_ask_spec.rb │ ├── order_bid_spec.rb │ ├── order_spec.rb │ ├── partial_tree_spec.rb │ ├── payment_address_spec.rb │ ├── payment_transaction_spec.rb │ ├── proof_spec.rb │ ├── ticket_spec.rb │ ├── token │ │ ├── activation_spec.rb │ │ └── reset_password_spec.rb │ ├── trade_spec.rb │ ├── two_factor │ │ ├── app_spec.rb │ │ └── sms_spec.rb │ ├── withdraw_spec.rb │ └── worker │ │ ├── deposit_coin_spec.rb │ │ ├── matching_spec.rb │ │ └── slave_book_spec.rb ├── observers │ └── transfer_observer_spec.rb ├── routing │ ├── admin │ │ ├── members_spec.rb │ │ └── two_factors_spec.rb │ ├── trade_spec.rb │ ├── two_factors_spec.rb │ └── verify │ │ ├── google_auths_spec.rb │ │ └── sms_auths_spec.rb ├── services │ ├── coin_rpc_spec.rb │ └── ordering_spec.rb ├── spec_helper.rb └── support │ ├── api_helper.rb │ ├── cookie_helper.rb │ ├── deposit_helper.rb │ ├── i18n_helper.rb │ ├── login_helper.rb │ ├── matching_helper.rb │ ├── pusher.rb │ ├── rspec_matchers.rb │ └── two_factor_helper.rb └── vendor ├── assets ├── javascripts │ ├── ZeroClipboard.js │ ├── bignumber.js │ ├── bootstrap-datetimepicker.js │ ├── bootstrap-switch.min.js │ ├── cookies.min.js │ ├── es5-sham.min.js │ ├── es5-shim.min.js │ ├── flight.min.js │ ├── highstock.js │ ├── html5shiv.js │ ├── i18n.js │ ├── jquery-timing.min.js │ ├── jquery.mousewheel.js │ ├── jquery.nicescroll.min.js │ ├── list.js │ ├── ngDialog │ │ └── ngDialog.js │ ├── pusher.min.js │ ├── qrcode.js │ ├── respond.min.js │ ├── scrollIt.js │ ├── underscore.js │ └── wysihtml5.js └── stylesheets │ ├── bootstrap-datetimepicker.css │ ├── bootstrap-switch.min.css │ ├── csshake.min.css │ ├── ngDialog │ ├── ngDialog-theme-default.css │ ├── ngDialog-theme-plain.css │ └── ngDialog.css │ ├── selectize.bootstrap3.scss │ ├── selectize.default.scss │ └── selectize.scss └── plugins └── .gitkeep /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | * Add visible attribute to market and default visible is true 2 | * I18n translations for Email template 3 | * Put Our Mission and Features into README.md 4 | * Add CHANGELOG.md 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Peatio::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/account.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class Account < Base 4 | expose :currency 5 | expose :balance, format_with: :decimal 6 | expose :locked, format_with: :decimal 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/base.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class Base < Grape::Entity 4 | format_with(:iso8601) {|t| t.iso8601 if t } 5 | format_with(:decimal) {|d| d.to_s('F') if d } 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/deposit.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class Deposit < Base 4 | expose :id, documentation: "Unique deposit id." 5 | expose :currency 6 | expose :amount, format_with: :decimal 7 | expose :fee 8 | expose :txid 9 | expose :created_at, format_with: :iso8601 10 | expose :confirmations 11 | expose :done_at, format_with: :iso8601 12 | expose :aasm_state, as: :state 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/market.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class Market < Base 4 | expose :id, documentation: "Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btccny'. All available markets can be found at /api/v2/markets." 5 | 6 | expose :name 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/member.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class Member < Base 4 | expose :sn 5 | expose :name 6 | expose :email 7 | expose :activated 8 | expose :accounts, using: ::APIv2::Entities::Account 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/api/api_v2/entities/order_book.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | module Entities 3 | class OrderBook < Base 4 | expose :asks, using: Order 5 | expose :bids, using: Order 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/api/api_v2/markets.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | class Markets < Grape::API 3 | 4 | desc 'Get all available markets.' 5 | get "/markets" do 6 | present Market.all, with: APIv2::Entities::Market 7 | end 8 | 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/api/api_v2/members.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | class Members < Grape::API 3 | helpers ::APIv2::NamedParams 4 | 5 | desc 'Get your profile and accounts info.', scopes: %w(profile) 6 | params do 7 | use :auth 8 | end 9 | get "/members/me" do 10 | authenticate! 11 | present current_user, with: APIv2::Entities::Member 12 | end 13 | 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/api/api_v2/tickers.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | class Tickers < Grape::API 3 | helpers ::APIv2::NamedParams 4 | 5 | desc 'Get ticker of all markets.' 6 | get "/tickers" do 7 | Market.all.inject({}) do |h, m| 8 | h[m.id] = format_ticker Global[m.id].ticker 9 | h 10 | end 11 | end 12 | 13 | desc 'Get ticker of specific market.' 14 | params do 15 | use :market 16 | end 17 | get "/tickers/:market" do 18 | format_ticker Global[params[:market]].ticker 19 | end 20 | 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/api/api_v2/tools.rb: -------------------------------------------------------------------------------- 1 | module APIv2 2 | class Tools < Grape::API 3 | desc 'Get server current time, in seconds since Unix epoch.' 4 | get "/timestamp" do 5 | ::Time.now.to_i 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/assets/images/logo.png -------------------------------------------------------------------------------- /app/assets/javascripts/admin.js: -------------------------------------------------------------------------------- 1 | //= require jquery 2 | //= require jquery_ujs 3 | //= require bootstrap 4 | //= require bootstrap-wysihtml5/b3 5 | //= require bootstrap-datetimepicker 6 | //= require ZeroClipboard 7 | //= require admin/app 8 | -------------------------------------------------------------------------------- /app/assets/javascripts/component_mixin/notification.js.coffee: -------------------------------------------------------------------------------- 1 | @NotificationMixin = -> 2 | @notify = (body, title) -> 3 | title ||= gon.i18n.notification.title 4 | notification = notifier.notify(title, body) 5 | -------------------------------------------------------------------------------- /app/assets/javascripts/component_ui/key_bind.js.coffee: -------------------------------------------------------------------------------- 1 | ESC = 27 2 | @KeyBindUI = flight.component -> 3 | @after 'initialize', -> 4 | entry = '#ask_entry' 5 | @$node.on 'keyup', (e) -> 6 | if e.keyCode == ESC 7 | if entry == '#bid_entry' then entry = '#ask_entry' else entry = '#bid_entry' 8 | $(entry).trigger 'place_order::clear' 9 | -------------------------------------------------------------------------------- /app/assets/javascripts/component_ui/order_total.js.coffee: -------------------------------------------------------------------------------- 1 | @OrderTotalUI = flight.component -> 2 | flight.compose.mixin @, [OrderInputMixin] 3 | 4 | @attributes 5 | precision: gon.market.bid.fixed 6 | variables: 7 | input: 'total' 8 | known: 'price' 9 | output: 'volume' 10 | 11 | @onOutput = (event, order) -> 12 | total = order.price.times order.volume 13 | 14 | @changeOrder @value unless @validateRange(total) 15 | @setInputValue @value 16 | 17 | order.total = @value 18 | @trigger 'place_order::order::updated', order 19 | -------------------------------------------------------------------------------- /app/assets/javascripts/component_ui/push_button.js.coffee: -------------------------------------------------------------------------------- 1 | @PushButton = flight.component -> 2 | @attributes 3 | buttons: '.type-toggle button' 4 | 5 | @setActiveButton = (event) -> 6 | @select('buttons').removeClass('active') 7 | $(event.target).closest('button').addClass('active') 8 | 9 | @after 'initialize', -> 10 | @on @select('buttons'), 'click', @setActiveButton 11 | -------------------------------------------------------------------------------- /app/assets/javascripts/component_ui/range_switch.js.coffee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/assets/javascripts/component_ui/range_switch.js.coffee -------------------------------------------------------------------------------- /app/assets/javascripts/funds/filters/precision_filters.js.coffee: -------------------------------------------------------------------------------- 1 | angular.module('precisionFilters', []).filter 'round_down', -> 2 | (number) -> 3 | BigNumber(number).round(5, BigNumber.ROUND_DOWN).toF(5) 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/filters/text_filters.js.coffee: -------------------------------------------------------------------------------- 1 | angular.module('textFilters', []).filter 'truncate', -> 2 | (text, size) -> 3 | if text.length > 20 4 | text.slice(0, size) + '...' 5 | else 6 | text 7 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/filters/translate_filters.js.coffee: -------------------------------------------------------------------------------- 1 | angular.module('translateFilters', []).filter 't', -> 2 | (key, args={}) -> 3 | I18n.t(key, args) 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/assets/javascripts/funds/models/.gitkeep -------------------------------------------------------------------------------- /app/assets/javascripts/funds/models/currency.js.coffee: -------------------------------------------------------------------------------- 1 | class Currency extends PeatioModel.Model 2 | @configure 'Currency', 'key', 'code', 'coin', 'blockchain' 3 | 4 | @initData: (records) -> 5 | PeatioModel.Ajax.disable -> 6 | $.each records, (idx, record) -> 7 | currency = Currency.create(record.attributes) 8 | 9 | window.Currency = Currency 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/models/deposit_channel.js.coffee: -------------------------------------------------------------------------------- 1 | class DepositChannel extends PeatioModel.Model 2 | @configure 'DepositChannel', 'key', 'currency', 'min_confirm', 'max_confirm', 'bank_accounts', 'resource_name' 3 | 4 | @initData: (records) -> 5 | PeatioModel.Ajax.disable -> 6 | $.each records, (idx, record) -> 7 | DepositChannel.create(record) 8 | 9 | account: -> 10 | Account.findBy('currency', @currency) 11 | 12 | window.DepositChannel = DepositChannel 13 | 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/models/member.js.coffee: -------------------------------------------------------------------------------- 1 | class Member extends PeatioModel.Model 2 | @configure 'Member', 'sn', 'display_name', 'created_at', 'updated_at', 'state', 3 | 'country_code', 'phone_number', 'name', 'app_activated', 'sms_activated' 4 | 5 | @initData: (records) -> 6 | PeatioModel.Ajax.disable -> 7 | $.each records, (idx, record) -> 8 | Member.create(record) 9 | 10 | window.Member = Member 11 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/models/withdraw_channel.js.coffee: -------------------------------------------------------------------------------- 1 | class WithdrawChannel extends PeatioModel.Model 2 | @configure 'WithdrawChannel', 'key', 'currency', 'resource_name' 3 | 4 | @initData: (records) -> 5 | PeatioModel.Ajax.disable -> 6 | $.each records, (idx, record) -> 7 | WithdrawChannel.create(record) 8 | 9 | account: -> 10 | Account.findBy('currency', @currency) 11 | 12 | window.WithdrawChannel = WithdrawChannel 13 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/services/account_service.js.coffee: -------------------------------------------------------------------------------- 1 | app.service 'accountService', ['$filter', '$gon', ($filter, $gon) -> 2 | 3 | filterBy: (filter) -> 4 | $filter('filter')($gon.accounts, filter) 5 | 6 | findBy: (filter) -> 7 | result = @filterBy filter 8 | if result.length then result[0] else null 9 | 10 | ] 11 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/services/gon.js.coffee: -------------------------------------------------------------------------------- 1 | app.factory '$gon', ['$window', (win)-> win.gon] 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/funds/services/ng_dialog.js.coffee: -------------------------------------------------------------------------------- 1 | app.config ['ngDialogProvider', (ngDialogProvider) -> 2 | ngDialogProvider.setDefaults 3 | closeByDocument: false 4 | closeByEscape: false 5 | trapFocus: false 6 | cache: false 7 | ] 8 | -------------------------------------------------------------------------------- /app/assets/javascripts/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/assets/javascripts/helpers/.gitkeep -------------------------------------------------------------------------------- /app/assets/javascripts/html5.js: -------------------------------------------------------------------------------- 1 | //= require html5shiv 2 | //= require respond.min 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/lib/pusher_connection.js.coffee: -------------------------------------------------------------------------------- 1 | pusher = new Pusher gon.pusher.key, 2 | encrypted: gon.pusher.encrypted 3 | wsHost: gon.pusher.wsHost 4 | wsPort: gon.pusher.wsPort 5 | wssPort: gon.pusher.wssPort 6 | 7 | window.pusher = pusher 8 | -------------------------------------------------------------------------------- /app/assets/javascripts/lib/sfx.js.coffee: -------------------------------------------------------------------------------- 1 | window.sfx_warning = -> 2 | window.sfx('warning') 3 | 4 | window.sfx_success = -> 5 | window.sfx('success') 6 | 7 | window.sfx = (kind) -> 8 | s = $("##{kind}-fx")[0] 9 | return if Cookies.get('sound') == 'false' 10 | return unless s.play 11 | s.pause() 12 | s.currentTime = 0 13 | s.play() 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/lib/tiny-pubsub.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Tiny Pub/Sub 3 | * https://github.com/cowboy/jquery-tiny-pubsub 4 | * 5 | * Copyright (c) 2013 "Cowboy" Ben Alman 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | (function($) { 10 | 11 | var o = $({}); 12 | 13 | $.subscribe = function() { 14 | o.on.apply(o, arguments); 15 | }; 16 | 17 | $.unsubscribe = function() { 18 | o.off.apply(o, arguments); 19 | }; 20 | 21 | $.publish = function() { 22 | o.trigger.apply(o, arguments); 23 | }; 24 | 25 | }(jQuery)); 26 | -------------------------------------------------------------------------------- /app/assets/javascripts/locales/en.js.erb: -------------------------------------------------------------------------------- 1 | //= require i18n 2 | <%= JsLocaleHelper.output_locale(:en) %> 3 | 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/locales/zh-CN.js.erb: -------------------------------------------------------------------------------- 1 | //= require i18n 2 | <%= JsLocaleHelper.output_locale(:'zh-CN') %> 3 | 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/swagger-ui/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/templates/hint_order_success.jst.eco: -------------------------------------------------------------------------------- 1 | 2 | <%= @msg %> 3 | 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/templates/hint_order_warning.jst.eco: -------------------------------------------------------------------------------- 1 | 2 | <%= @msg %> 3 | 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/templates/my_trade.jst.eco: -------------------------------------------------------------------------------- 1 | <% trend = formatter.trend @kind %> 2 | 3 |
2 | <%= t('.notification_content', email: @author_email)%> 3 |
4 | 5 |6 | <%= link_to @ticket_url, @ticket_url %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/comment_mailer/user_notification.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.notification_content')%> 3 |
4 | 5 |6 | <%= link_to @ticket_url, @ticket_url %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/datagrid/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for grid, options do |f| -%> 2 | <% grid.filters.each do |filter| %> 3 |2 | <%= t('.content', currency: @deposit.currency_text) %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/documents/show.html.slim: -------------------------------------------------------------------------------- 1 | = content_for :page_title do 2 | title = @doc.title 3 | 4 | = content_for :description do 5 | meta name='description' content= @doc.desc 6 | 7 | = content_for :keywords do 8 | meta name='keywords' content= @doc.keywords 9 | 10 | = content_for :frame do 11 | .container 12 | .panel.panel-default 13 | .panel-body == @doc.body 14 | -------------------------------------------------------------------------------- /app/views/errors/connection.html.slim: -------------------------------------------------------------------------------- 1 | h1.text-error CoinRPC::ConnectionRefusedError 2 | p Have you started bitcoind? 3 | -------------------------------------------------------------------------------- /app/views/identities/edit.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @identity do |f| 2 | = f.input :old_password 3 | = f.input :password 4 | = f.input :password_confirmation 5 | hr.split 6 | = f.button :wrapped, cancel: settings_path 7 | -------------------------------------------------------------------------------- /app/views/identities/new.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @identity, :url => '/auth/identity/register' do |f| 2 | = f.input :email, :input_html => {:name => 'email', :autofocus => 'true'} 3 | = f.input :password, :input_html => {:name => 'password'} 4 | = f.input :password_confirmation, :input_html => {:name => 'password_confirmation'} 5 | hr.split 6 | = f.button :wrapped, t('header.signup'), cancel: root_path 7 | 8 | = content_for :guide do 9 | ul.list-unstyled 10 | li: a href='#{signin_path}'= t('.signin') 11 | -------------------------------------------------------------------------------- /app/views/kaminari/_first_page.html.slim: -------------------------------------------------------------------------------- 1 | / Link to the "First" page 2 | - available local variables 3 | url : url to the first page 4 | current_page : a page object for the currently displayed page 5 | total_pages : total number of pages 6 | per_page : number of items to fetch per page 7 | remote : data-remote 8 | li.previous class="#{'disabled' if current_page.first?}" 9 | == link_to raw(t 'views.pagination.first'), url, :remote => remote 10 | ' 11 | -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.slim: -------------------------------------------------------------------------------- 1 | / Non-link tag that stands for skipped pages... 2 | - available local variables 3 | current_page : a page object for the currently displayed page 4 | total_pages : total number of pages 5 | per_page : number of items to fetch per page 6 | remote : data-remote 7 | li.page.gap 8 | a 9 | == raw(t 'views.pagination.truncate') 10 | ' 11 | -------------------------------------------------------------------------------- /app/views/kaminari/_last_page.html.slim: -------------------------------------------------------------------------------- 1 | / Link to the "Last" page 2 | - available local variables 3 | url : url to the last page 4 | current_page : a page object for the currently displayed page 5 | total_pages : total number of pages 6 | per_page : number of items to fetch per page 7 | remote : data-remote 8 | li.next class="#{'disabled' if current_page.first?}" 9 | == link_to raw(t 'views.pagination.last'), url, {:remote => remote} 10 | ' 11 | -------------------------------------------------------------------------------- /app/views/kaminari/_next_page.html.slim: -------------------------------------------------------------------------------- 1 | / Link to the "Next" page 2 | - available local variables 3 | url : url to the next page 4 | current_page : a page object for the currently displayed page 5 | total_pages : total number of pages 6 | per_page : number of items to fetch per page 7 | remote : data-remote 8 | li.next class="#{'disabled' if current_page.last?}" 9 | == link_to raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote 10 | ' 11 | -------------------------------------------------------------------------------- /app/views/kaminari/_page.html.slim: -------------------------------------------------------------------------------- 1 | / Link showing page number 2 | - available local variables 3 | page : a page object for "this" page 4 | url : url to this page 5 | current_page : a page object for the currently displayed page 6 | total_pages : total number of pages 7 | per_page : number of items to fetch per page 8 | remote : data-remote 9 | li class="page#{' active' if page.current?}" 10 | == link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} 11 | ' 12 | -------------------------------------------------------------------------------- /app/views/kaminari/_prev_page.html.slim: -------------------------------------------------------------------------------- 1 | / Link to the "Previous" page 2 | - available local variables 3 | url : url to the previous page 4 | current_page : a page object for the currently displayed page 5 | total_pages : total number of pages 6 | per_page : number of items to fetch per page 7 | remote : data-remote 8 | li.previous class="#{'disabled' if current_page.first?}" 9 | == link_to raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote 10 | ' 11 | -------------------------------------------------------------------------------- /app/views/layouts/landing.html.slim: -------------------------------------------------------------------------------- 1 | doctype html 2 | html lang="en" 3 | head 4 | link rel="shortcut icon" href="/favicon.ico" 5 | = include_gon 6 | = stylesheet_link_tag "application", :media => "all" 7 | = javascript_include_tag "application" 8 | = javascript_include_tag "locales/#{I18n.locale}" 9 | = render 'shared/html5' 10 | = render 'shared/meta' 11 | = csrf_meta_tags 12 | body id='#{body_id}' data-lang="#{locale_name}" 13 | #wrap 14 | = render 'shared/alert' 15 | = yield 16 | #push 17 | = render 'shared/footer' 18 | -------------------------------------------------------------------------------- /app/views/member_mailer/google_auth_activated.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".google_auth_activated") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/google_auth_deactivated.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".google_auth_deactivated") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/notify_signin.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".just_signed_in") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/phone_number_verified.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".verified", phone_number: @member.phone_number) %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/reset_password_done.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".successful") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/sms_auth_activated.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".sms_auth_activated") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/member_mailer/sms_auth_deactivated.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".sms_auth_deactivated") %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/members/edit.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @member do |f| 2 | = f.input :display_name 3 | = f.button :wrapped, t('actions.submit') 4 | -------------------------------------------------------------------------------- /app/views/private/account_versions/index.html.slim: -------------------------------------------------------------------------------- 1 | .content.row 2 | .profile 3 | .picture 4 | i.fa.fa-list 5 | .summary 6 | p = t('.description') 7 | = datagrid_form_for @account_versions_grid, url: account_versions_path 8 | .versions 9 | = datagrid_table(@account_versions_grid, @assets, html: {:class => 'datagrid table-striped table-hover account_versions_grid'}) 10 | -------------------------------------------------------------------------------- /app/views/private/api_tokens/index.html.slim: -------------------------------------------------------------------------------- 1 | = content_for :frame do 2 | .container 3 | = render 'shared/flash' 4 | = render 'user_tokens' 5 | = render 'oauth_tokens' 6 | 7 | -------------------------------------------------------------------------------- /app/views/private/api_tokens/new.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @token do |f| 2 | = f.input :label, hint: t('.label_hint') 3 | = two_factor_tag(current_user) 4 | hr.split 5 | = f.button :wrapped, t('actions.confirm') do 6 | = link_to t('actions.cancel'), api_tokens_path, role: 'button', class: 'btn btn-danger btn-lg pull-right' 7 | -------------------------------------------------------------------------------- /app/views/private/assets/_liability_proof.html.slim: -------------------------------------------------------------------------------- 1 | .panel.panel-default 2 | .panel-body 3 | .row 4 | #guide.col-xs-8 5 | h3 = t('.title') 6 | p.text-ignore = t('.intro') 7 | p 8 | = link_to t('.how-to-verify'), t('.how-to-verify-uri'), :target => '_blank' 9 | #content.col-xs-16 10 | = render 'liability_tabs' 11 | -------------------------------------------------------------------------------- /app/views/private/assets/index.html.slim: -------------------------------------------------------------------------------- 1 | = content_for :frame do 2 | .container 3 | ul.nav.nav-justified.assets-nav 4 | li.active data-scroll-nav='0' 5 | a = t('.liability-proof') 6 | li data-scroll-nav='1' 7 | a = t('.btc-assets') 8 | li data-scroll-nav='2' 9 | a = t('.cny-assets') 10 | 11 | - if current_user 12 | div data-scroll-index=0 = render 'liability_proof' 13 | 14 | div data-scroll-index=1 = render 'btc_assets' 15 | div data-scroll-index=2 = render 'cny_assets' 16 | 17 | -------------------------------------------------------------------------------- /app/views/private/assets/partial_tree.js.erb: -------------------------------------------------------------------------------- 1 | var scope = '#<%= params[:id] %>-proof .partial-tree'; 2 | $(scope + ' pre').text('<%= @json %>').show(); 3 | 4 | copy_link = $(scope + ' a.copy'); 5 | copy_link.removeClass('disabled'); 6 | 7 | get_link = $(scope + ' a.get-partial-tree'); 8 | get_link.addClass('disabled'); 9 | 10 | $(scope + ' .message').text('<%= t('.success', timestamp: @timestamp.to_s) %>') 11 | -------------------------------------------------------------------------------- /app/views/private/funds/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.current_user @current_user 2 | json.deposit_channels @deposit_channels 3 | json.withdraw_channels @withdraw_channels 4 | json.currencies @currencies 5 | json.deposits @deposits 6 | json.accounts @accounts 7 | json.withdraws @withdraws 8 | json.fund_sources @fund_sources 9 | json.banks @banks.map(&:attributes), :code 10 | -------------------------------------------------------------------------------- /app/views/private/history/_order.html.slim: -------------------------------------------------------------------------------- 1 | tr 2 | td = order.id 3 | td = t ".#{order.kind}" 4 | td = t ".#{order.state}" 5 | td = order.currency.upcase 6 | td = order.price 7 | td = order.origin_volume 8 | td = order.avg_price 9 | td = order.origin_volume - order.volume 10 | td = order.created_at 11 | -------------------------------------------------------------------------------- /app/views/private/history/_tabs.html.slim: -------------------------------------------------------------------------------- 1 | ul.nav.nav-pills role='tablist' 2 | - tabs.each do |name, args| 3 | - css_class = name == active ? 'active' : '' 4 | li class=css_class = link_to t(args[0]), args[1] 5 | -------------------------------------------------------------------------------- /app/views/private/history/_trade.html.slim: -------------------------------------------------------------------------------- 1 | tr 2 | td = t(".#{trade_side trade}") 3 | td = trade.created_at 4 | td = trade.market.base_unit.upcase 5 | td = trade.volume 6 | td = trade.market.quote_unit.upcase 7 | td = trade.volume*trade.price 8 | td = trade.price 9 | -------------------------------------------------------------------------------- /app/views/private/history/_transaction.html.slim: -------------------------------------------------------------------------------- 1 | tr 2 | td = transaction_type transaction 3 | td = transaction.created_at 4 | td = transaction.currency_obj.code_text 5 | td = transaction.amount 6 | td = transaction.fee 7 | td = transaction_txid_link transaction 8 | -------------------------------------------------------------------------------- /app/views/private/markets/_balance.html.slim: -------------------------------------------------------------------------------- 1 | .row.row-tips 2 | .col-xs-24.text-right 3 | span.label.label-info.status-info 4 | span.label.label-success.status-success 5 | span.label.label-danger.status-danger 6 | span.current-balance.number 7 | span.unit = currency 8 | -------------------------------------------------------------------------------- /app/views/private/markets/_candlestick.html.slim: -------------------------------------------------------------------------------- 1 | #candlestick 2 | #candlestick_chart style='height: 100%;' 3 | .mask: table: tr: td.text-center 4 | i.fa.fa-refresh.fa-spin.fa-1x 5 | span Loading ... 6 | -------------------------------------------------------------------------------- /app/views/private/markets/_chat.html.slim: -------------------------------------------------------------------------------- 1 | #chat.panel.panel-default 2 | .panel-heading 3 | span = t('.title') 4 | a.hand-point.pull-right: i.fa.fa-close 5 | .panel-body.panel-body-content 6 | -------------------------------------------------------------------------------- /app/views/private/markets/_depths.html.slim: -------------------------------------------------------------------------------- 1 | #depths_wrapper.panel.panel-default 2 | .panel-body.panel-body-content 3 | #depths 4 | -------------------------------------------------------------------------------- /app/views/private/markets/_language.html.slim: -------------------------------------------------------------------------------- 1 | li#language.dropdown 2 | a.dropdown-toggle href="#" data-toggle="dropdown" 3 | img class="lang-icon" src='#{language_path}' 4 | b.caret 5 | ul.dropdown-menu 6 | - I18n.available_locales.each do |lang| 7 | li: a href="?lang=#{lang}": img class="lang-icon" src="/languages/#{lang || I18n.locale}.png" 8 | -------------------------------------------------------------------------------- /app/views/private/markets/_mask.html.slim: -------------------------------------------------------------------------------- 1 | - unless current_user 2 | .mask 3 | p.text-center == "#{t('.warning')}" 4 | -------------------------------------------------------------------------------- /app/views/private/markets/_range_switch.html.slim: -------------------------------------------------------------------------------- 1 | ul#range_switch.list-inline.switch data-x='60' 2 | - %w(1 5 15 30 | 60 120 240 360 720 | 1440 4320 | 10080).each do |x| 3 | li.text-center 4 | - if x == '|' 5 | span | 6 | - else 7 | a.hand-point.chart-switch href='#' data-x='#{x}' = t(".switch_#{x}") 8 | -------------------------------------------------------------------------------- /app/views/private/markets/_status.html.slim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/app/views/private/markets/_status.html.slim -------------------------------------------------------------------------------- /app/views/private/markets/_ticker.html.slim: -------------------------------------------------------------------------------- 1 | #ticker.panel.panel-default 2 | .panel-body 3 | .bid.col-xs-7.pull-left 4 | .hint = t('.bid') 5 | .price 6 | .last.col-xs-10 7 | .price 8 | .ask.col-xs-7.pull-right 9 | .hint = t('.ask') 10 | .price 11 | -------------------------------------------------------------------------------- /app/views/private/markets/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.asks @asks 2 | json.bids @bids 3 | json.trades @trades 4 | 5 | if @member 6 | json.my_trades @trades_done.map(&:for_notify) 7 | json.my_orders *([@orders_wait] + Order::ATTRIBUTES) 8 | end 9 | -------------------------------------------------------------------------------- /app/views/private/shared/_balances.html.slim: -------------------------------------------------------------------------------- 1 | .row 2 | - member.accounts.each do |account| 3 | .col-xs-6 4 | .row class='account-#{account.currency}' 5 | .col-xs-4: h5.amount data-title='#{account.currency_text}' = account.amount 6 | .col-xs-3: h5.locked.text-right data-title='#{t('.locked')}' = account.locked 7 | .col-xs-3: h5.available.text-right data-title='#{t('.available')}' = account.balance 8 | -------------------------------------------------------------------------------- /app/views/private/tickets/new.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @ticket do |f| 2 | .form-group 3 | .col-xs-20.col-xs-offset-4 4 | = t('.intro') 5 | = f.input :title 6 | = f.input :content, input_html: {rows: 10} 7 | hr.split 8 | = f.button :wrapped, cancel: tickets_path 9 | -------------------------------------------------------------------------------- /app/views/reset_passwords/edit.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @token, url: reset_password_path(@token), as: :reset_password do |f| 2 | = f.input :password 3 | hr.split 4 | = f.button :wrapped 5 | -------------------------------------------------------------------------------- /app/views/reset_passwords/new.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @token, url: reset_passwords_path, as: :reset_password do |f| 2 | = f.input :email 3 | hr.split 4 | = f.button :wrapped, cancel: signin_path 5 | -------------------------------------------------------------------------------- /app/views/shared/_document.html.slim: -------------------------------------------------------------------------------- 1 | #document_modal.modal.hide.fade tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" 2 | .modal-body 3 | .modal-footer: a.close data-dismiss='modal' aria-hidden='true' = t('.close') 4 | -------------------------------------------------------------------------------- /app/views/shared/_header_lang_sel.html.slim: -------------------------------------------------------------------------------- 1 | li.dropdown 2 | a.dropdown-toggle href="#" data-toggle="dropdown" 3 | img src='#{language_path}' 4 | b.caret 5 | ul#languages.dropdown-menu 6 | - I18n.available_locales.each do |lang| 7 | li: a href="?lang=#{lang}": img src="/languages/#{lang || I18n.locale}.png" 8 | 9 | -------------------------------------------------------------------------------- /app/views/shared/_html5.html.slim: -------------------------------------------------------------------------------- 1 | == "" 4 | -------------------------------------------------------------------------------- /app/views/shared/_meta.html.slim: -------------------------------------------------------------------------------- 1 | title = i18n_meta('page_title') 2 | 3 | meta name='description' content=i18n_meta('page_description') 4 | meta name='keywords' content=i18n_meta('page_keywords') 5 | -------------------------------------------------------------------------------- /app/views/shared/_two_factor_app.html.slim: -------------------------------------------------------------------------------- 1 | label.string.required.col-xs-8.control-label for="two_factor_otp" 2 | abbr == "* " 3 | span = t('two_factors.auth.google_app') 4 | 5 | .col-xs-14 6 | .input-group style="width:100%;" 7 | input.two_factor_auth_type type="hidden" name="two_factor[type]" value="app" 8 | input.string.required.form-control id="two_factor_otp" name="two_factor[otp]" placeholder=t('two_factors.auth.otp_placeholder') 9 | span.hint.app = t('two_factors.auth.hints.app') 10 | .captcha-wrap 11 | -------------------------------------------------------------------------------- /app/views/shared/_two_factor_auth.html.slim: -------------------------------------------------------------------------------- 1 | .two-factor-auth-container 2 | .form-group.string.required 3 | - if app_activated && sms_activated 4 | = render partial: 'shared/two_factor_app_and_sms' 5 | 6 | - elsif app_activated 7 | = render partial: 'shared/two_factor_app' 8 | 9 | - elsif sms_activated 10 | = render partial: 'shared/two_factor_sms' 11 | -------------------------------------------------------------------------------- /app/views/shared/admin/_account.html.slim: -------------------------------------------------------------------------------- 1 | .panel.panel-info 2 | .panel-heading 3 | span = t('.account_info') 4 | span = " : " 5 | span = account.currency_text 6 | .panel-body 7 | dl.dl-horizontal 8 | = item_for account, :amount 9 | = item_for account, :locked 10 | = item_for account, :balance 11 | - if account.currency_obj.coin? 12 | = item_for t('.payment_address') do 13 | = account.payment_address.address 14 | -------------------------------------------------------------------------------- /app/views/shared/admin/_member_accounts.html.slim: -------------------------------------------------------------------------------- 1 | - member.accounts.each do |account| 2 | = render partial: 'shared/admin/account', locals: {account: account} 3 | -------------------------------------------------------------------------------- /app/views/shared/market/_chart.html.slim: -------------------------------------------------------------------------------- 1 | .panel.panel-default 2 | .panel-body.market-ticker 3 | = render partial: 'shared/market/ticker' 4 | .panel-body.market-chart 5 | -------------------------------------------------------------------------------- /app/views/shared/market/_market_sel.html.slim: -------------------------------------------------------------------------------- 1 | - if Market.all.size > 1 2 | .market-selector 3 | - Market.all.each do |market| 4 | = link_to market.name, market_path(market.id), class: (current_market.name == market.name) ? 'btn btn-primary' : 'btn btn-default' 5 | -------------------------------------------------------------------------------- /app/views/simple_captcha/_simple_captcha.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.admin_notification_content', email: @author_email)%> 3 |
4 | 5 |6 | <%=link_to @ticket_url, @ticket_url %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/ticket_mailer/author_notification.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.thanks_for_submit_ticket') %> 3 |
4 | 5 |6 | <%= link_to @ticket_url, @ticket_url %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/token_mailer/activation.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".click_to_verify") %> 3 |
4 | 5 |6 | <%= link_to @token_url, @token_url %> 7 |
8 | 9 |
10 | <%= t(".unable_to_click") %>
11 |
12 | <%= t(".link_expire") %>
13 |
2 | <%= t(".follow_the_link") %> 3 |
4 | 5 |6 | <%= link_to @token_url, @token_url%> 7 |
8 | -------------------------------------------------------------------------------- /app/views/two_factors/index.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @two_factor, url: two_factor_path(@two_factor.class.to_s.demodulize.downcase) do |f| 2 | 3 | = two_factor_tag(current_user) 4 | 5 | = f.button :wrapped, t('.verify'), cancel: settings_path 6 | -------------------------------------------------------------------------------- /app/views/verify/google_auths/edit.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for @google_auth, as: 'google_auth', url: verify_google_auth_path, method: :delete do |f| 2 | 3 | .two-factor-auth-container 4 | .form-group.string.required 5 | = render partial: 'shared/two_factor_app' 6 | 7 | = f.button :wrapped, t('.submit'), cancel: settings_path 8 | 9 | = content_for :guide do 10 | p.text-warning = t('.warning') 11 | -------------------------------------------------------------------------------- /app/views/withdraw_mailer/done.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.content', currency: @withdraw.currency_text) %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/withdraw_mailer/processing.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.content', currency: @withdraw.currency_text) %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/withdraw_mailer/submitted.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t('.content', currency: @withdraw.currency_text) %> 3 |
4 | 5 |6 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/withdraw_mailer/withdraw_state.html.erb: -------------------------------------------------------------------------------- 1 |2 | <%= t(".your_state") %> 3 | <%= @withdraw.aasm_state %> 4 |
5 | 6 |7 | <%= raw t("mailer.please_contact", contact_mail: ENV['SUPPORT_MAIL']) %> 8 |
9 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/init_config: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'fileutils' 4 | 5 | Dir.glob("config/*.yml.example").each do |example_file| 6 | target_file = example_file[0..-9] 7 | 8 | if File.exist? target_file 9 | puts "Ignore the #{target_file}" 10 | else 11 | FileUtils.cp example_file, target_file 12 | puts "cp #{example_file} #{target_file}" 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'rspec' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rspec-core', 'rspec') 17 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Peatio::Application 5 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /config/daemons.yml: -------------------------------------------------------------------------------- 1 | dir_mode: script 2 | dir: ../../log 3 | multiple: false 4 | backtrace: true 5 | monitor: false 6 | ontop: false 7 | log_output: true 8 | -------------------------------------------------------------------------------- /config/database.yml.example: -------------------------------------------------------------------------------- 1 | development: &defaults 2 | adapter: mysql2 3 | encoding: utf8 4 | database: peatio_development 5 | username: root 6 | password: 7 | pool: 10 8 | reconnect: true 9 | 10 | test: 11 | <<: *defaults 12 | database: peatio_test 13 | 14 | production: 15 | <<: *defaults 16 | database: peatio_production 17 | -------------------------------------------------------------------------------- /config/deposit_channels.yml: -------------------------------------------------------------------------------- 1 | - id: 200 2 | key: satoshi 3 | currency: btc 4 | sort_order: 1 5 | min_confirm: 1 6 | max_confirm: 3 7 | - id: 600 8 | key: ether 9 | currency: eth 10 | min_confirm: 1 11 | max_confirm: 6 -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Peatio::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/initializers/activerecord.rb: -------------------------------------------------------------------------------- 1 | module ActiveModel 2 | module Translation 3 | alias :han :human_attribute_name 4 | end 5 | end 6 | 7 | ActiveRecord::Base.extend ActiveHash::Associations::ActiveRecordExtensions 8 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/carrierwave.rb: -------------------------------------------------------------------------------- 1 | CarrierWave.configure do |config| 2 | config.storage = :file 3 | config.cache_dir = "#{Rails.root}/tmp/uploads" 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/check_env.rb: -------------------------------------------------------------------------------- 1 | environments = %w( 2 | PUSHER_APP 3 | PUSHER_KEY 4 | PUSHER_SECRET 5 | ) 6 | 7 | environments.select! do |key| 8 | ENV[key] =~ /^YOUR/ 9 | end 10 | 11 | unless environments.empty? 12 | puts "====================== WARNING ======================" 13 | puts " please check below config in config/application.yml" 14 | puts "" 15 | environments.each do |key| puts " #{key}" end 16 | puts "=====================================================" 17 | raise "config missing" 18 | end 19 | -------------------------------------------------------------------------------- /config/initializers/datagrid/filters/date_time_filter.rb: -------------------------------------------------------------------------------- 1 | class Datagrid::Filters::DateTimeFilter < Datagrid::Filters::BaseFilter 2 | def parse(value) 3 | if value.respond_to?(:utc) 4 | value = value.utc 5 | end 6 | 7 | if value.is_a?(String) 8 | return value 9 | else 10 | return value.to_s(:db) 11 | end 12 | end 13 | end 14 | 15 | 16 | -------------------------------------------------------------------------------- /config/initializers/date_time_format.rb: -------------------------------------------------------------------------------- 1 | Date::DATE_FORMATS[:short] = '%m-%d' 2 | Time::DATE_FORMATS[:default] = "%Y-%m-%d %H:%M:%S" 3 | -------------------------------------------------------------------------------- /config/initializers/dirty_ext.rb: -------------------------------------------------------------------------------- 1 | module ActiveModel 2 | module Dirty 3 | def changes_attributes 4 | HashWithIndifferentAccess[changed.map { |attr| [attr, __send__(attr)] }] 5 | end 6 | 7 | def changes_attributes_as_json 8 | ca, json = changes_attributes, self.as_json 9 | json.each do |key, value| 10 | ca[key.to_s] = value if ca.key?(key) 11 | end 12 | ca 13 | end 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password, :pin] 5 | -------------------------------------------------------------------------------- /config/initializers/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | Kaminari.configure do |config| 2 | config.default_per_page = 10 3 | # config.max_per_page = nil 4 | # config.window = 4 5 | # config.outer_window = 0 6 | # config.left = 0 7 | # config.right = 0 8 | # config.page_method_name = :page 9 | # config.param_name = :page 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/mysql2_adapter.rb: -------------------------------------------------------------------------------- 1 | class ActiveRecord::ConnectionAdapters::Mysql2Adapter 2 | NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY" 3 | end 4 | -------------------------------------------------------------------------------- /config/initializers/pusher.rb: -------------------------------------------------------------------------------- 1 | Pusher.app_id = ENV['PUSHER_APP'] 2 | Pusher.key = ENV['PUSHER_KEY'] 3 | Pusher.secret = ENV['PUSHER_SECRET'] 4 | Pusher.host = ENV['PUSHER_HOST'] || 'api.pusherapp.com' 5 | Pusher.port = ENV['PUSHER_PORT'].present? ? ENV['PUSHER_PORT'].to_i : 80 6 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | Peatio::Application.config.secret_key_base = '4adeecaaba6c4a5474d9c8d7893dd1f4243abdcd58187d8e628d3cf0be1855b5f0b780f63de790e8eb3fde4ba032b4d183ce623ed321c296382d7946826fcc5e' 2 | -------------------------------------------------------------------------------- /config/initializers/withdraw_blacklist.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/config/initializers/withdraw_blacklist.rb -------------------------------------------------------------------------------- /config/locales/client.de.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | de: 7 | js: 8 | brand: Peatio 9 | funds: 10 | deposit: Einzahlen 11 | withdraw: Auszahlen 12 | -------------------------------------------------------------------------------- /config/locales/client.zh-TW.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | zh-TW: 7 | js: 8 | brand: 貔貅 9 | submit: 提交 10 | funds: 11 | deposit: 充值 12 | withdraw: 提现 13 | deposit_cny: 14 | title: 人民币充值 15 | -------------------------------------------------------------------------------- /config/locales/custom/client.en.yml: -------------------------------------------------------------------------------- 1 | # Put your customized locale translations here. 2 | 3 | en: 4 | js: 5 | brand: Peatio 6 | -------------------------------------------------------------------------------- /config/locales/custom/client.zh-CN.yml: -------------------------------------------------------------------------------- 1 | # Put your customized locale translations here. 2 | 3 | zh-CN: 4 | js: 5 | brand: Peatio 6 | -------------------------------------------------------------------------------- /config/locales/custom/server.en.yml: -------------------------------------------------------------------------------- 1 | # Put your customized locale translations here. 2 | 3 | en: 4 | -------------------------------------------------------------------------------- /config/locales/custom/server.zh-CN.yml: -------------------------------------------------------------------------------- 1 | # Put your customized locale translations here. 2 | 3 | zh-CN: 4 | -------------------------------------------------------------------------------- /config/locales/server.de.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | de: 7 | view_on_github: View on Github 8 | tags: 9 | vip: VIP 10 | admin: Admin 11 | -------------------------------------------------------------------------------- /config/locales/server.el.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | el: 7 | activerecord: 8 | models: 9 | trade: Συναλλαγές 10 | order: Εντολές 11 | order_bid: Προσφορά 12 | -------------------------------------------------------------------------------- /config/locales/server.it.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | it: 7 | gon: 8 | brand: Peatio Exchange 9 | -------------------------------------------------------------------------------- /config/locales/server.zh-TW.yml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Never edit this file. It will be overwritten when translations are pulled from Transifex. 4 | # 5 | 6 | zh-TW: 7 | view_on_github: 到 Github 上查看 8 | slogan: 首家开源数字加密货币交易所 9 | tags: 10 | vip: VIP 11 | admin: 管理员 12 | all: 全部 13 | -------------------------------------------------------------------------------- /config/logrotate.conf: -------------------------------------------------------------------------------- 1 | /home/deploy/peatio/shared/log/*.log { 2 | su deploy deploy 3 | daily 4 | missingok 5 | rotate 30 6 | compress 7 | delaycompress 8 | copytruncate 9 | create 0644 deploy deploy 10 | 11 | } 12 | 13 | /home/deploy/peatio/shared/log/*.output { 14 | su deploy deploy 15 | daily 16 | missingok 17 | rotate 30 18 | compress 19 | delaycompress 20 | copytruncate 21 | create 0644 deploy deploy 22 | 23 | } 24 | -------------------------------------------------------------------------------- /config/maintenance.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" == "off" ]; then 4 | echo "switch off maintenance mode" 5 | ln -sf /home/deploy/peatio/shared/config/nginx.conf /etc/nginx/conf.d/peatio.conf 6 | service nginx reload 7 | else 8 | echo "switch on maintenance mode" 9 | ln -sf /home/deploy/peatio/shared/config/nginx_maintenance.conf /etc/nginx/conf.d/peatio.conf 10 | service nginx reload 11 | fi 12 | -------------------------------------------------------------------------------- /config/markets.yml.example: -------------------------------------------------------------------------------- 1 | - id: ethbtc 2 | code: 5 3 | name: ETH/BTC 4 | base_unit: eth 5 | quote_unit: btc 6 | #price_group_fixed: 1 # aggregate price levels in orderbook 7 | bid: {fee: 0, currency: btc, fixed: 4} 8 | ask: {fee: 0, currency: eth, fixed: 4} 9 | sort_order: 1 10 | #visible: false # default to true 11 | -------------------------------------------------------------------------------- /config/member_tags.yml: -------------------------------------------------------------------------------- 1 | - id: 1 2 | key: vip 3 | - id: 2 4 | key: hero 5 | 6 | -------------------------------------------------------------------------------- /config/nginx_maintenance.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default; 3 | server_name _; 4 | 5 | root /home/deploy/peatio/current/public; 6 | 7 | location / { 8 | index 502.html; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /config/slack.yml.example: -------------------------------------------------------------------------------- 1 | staging: &defaults 2 | payload: 3 | channel: '#peatio' 4 | username: minabot 5 | token: ~ 6 | hook_url: https://peatio.slack.com/services/hooks/incoming-webhook?token= 7 | 8 | production: 9 | <<: *defaults 10 | -------------------------------------------------------------------------------- /config/withdraw_channels.yml: -------------------------------------------------------------------------------- 1 | - id: 200 2 | key: satoshi 3 | currency: btc 4 | fixed: 8 5 | fee: 0.0005 6 | inuse: true 7 | type: WithdrawChannelSatoshi 8 | - id: 400 9 | key: bank 10 | currency: cny 11 | fixed: 2 12 | fee_max: 0 13 | min: 100 14 | max: 50000 15 | fee: 0.003 16 | proportion: true 17 | inuse: true 18 | type: WithdrawChannelBank 19 | - id: 500 20 | key: ether 21 | currency: eth 22 | min_confirm: 1 23 | max_confirm: 6 24 | inuse: true 25 | fixed: 8 26 | fee: 0.0005 27 | type: WithdrawChannelEthereum 28 | -------------------------------------------------------------------------------- /db/migrate/20130901010953_create_orders.rb: -------------------------------------------------------------------------------- 1 | class CreateOrders < ActiveRecord::Migration 2 | def change 3 | create_table :orders do |t| 4 | t.string :bid 5 | t.string :ask 6 | t.string :currency 7 | t.decimal :price, :precision => 32, :scale => 16 8 | t.decimal :volume, :precision => 32, :scale => 16 9 | t.decimal :origin_volume, :precision => 32, :scale => 16 10 | t.string :state 11 | t.datetime :done_at 12 | t.string :type 13 | t.integer :member_id 14 | t.timestamps 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20130904215802_add_is_active_to_two_factors.rb: -------------------------------------------------------------------------------- 1 | class AddIsActiveToTwoFactors < ActiveRecord::Migration 2 | def change 3 | add_column :two_factors, :is_active, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130905025823_fix_account_id_by_reset_pin.rb: -------------------------------------------------------------------------------- 1 | class FixAccountIdByResetPin < ActiveRecord::Migration 2 | def change 3 | rename_column :reset_pins, :account_id, :member_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130905132250_add_balance_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddBalanceToAccountVersions < ActiveRecord::Migration 2 | def change 3 | add_column :account_versions, :balance, :decimal, :precision => 32, :scale => 16 4 | add_column :account_versions, :amount, :decimal, :precision => 32, :scale => 16 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20130906073020_create_payment_addresses.rb: -------------------------------------------------------------------------------- 1 | class CreatePaymentAddresses < ActiveRecord::Migration 2 | def change 3 | create_table :payment_addresses do |t| 4 | t.integer :account_id 5 | t.string :address 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20130906073931_create_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class CreatePaymentTransactions < ActiveRecord::Migration 2 | def change 3 | create_table :payment_transactions do |t| 4 | t.string :txid 5 | t.decimal :amount, :precision => 32, :scale => 16 6 | t.integer :confirmations 7 | t.string :address 8 | t.string :state 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20130907110146_create_withdraws.rb: -------------------------------------------------------------------------------- 1 | class CreateWithdraws < ActiveRecord::Migration 2 | def change 3 | create_table :withdraws do |t| 4 | t.integer :account_id 5 | t.decimal :amount, :precision => 32, :scale => 16 6 | t.string :payment_way 7 | t.string :payment_to 8 | t.string :state 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20130907124647_create_deposits.rb: -------------------------------------------------------------------------------- 1 | class CreateDeposits < ActiveRecord::Migration 2 | def change 3 | create_table :deposits do |t| 4 | t.integer :account_id 5 | t.decimal :amount, :precision => 32, :scale => 16 6 | t.string :payment_way 7 | t.string :payment_id 8 | t.string :state 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20130912144526_add_receive_at_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class AddReceiveAtToPaymentTransactions < ActiveRecord::Migration 2 | def change 3 | add_column :payment_transactions, :receive_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130915150504_add_payment_id_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddPaymentIdToWithdraws < ActiveRecord::Migration 2 | def change 3 | add_column :withdraws, :payment_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130918143551_add_ref_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddRefToAccountVersions < ActiveRecord::Migration 2 | def change 3 | add_column :account_versions, :ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130919091853_add_sn_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddSnToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :sn, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130925165804_change_to_enumerize_in_trades.rb: -------------------------------------------------------------------------------- 1 | class ChangeToEnumerizeInTrades < ActiveRecord::Migration 2 | def up 3 | change_column :trades, :trend, :integer 4 | change_column :trades, :currency, :integer 5 | end 6 | 7 | def down 8 | change_column :trades, :currency, :string 9 | change_column :trades, :trend, :boolean 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130925171856_change_to_enumerize_in_accounts.rb: -------------------------------------------------------------------------------- 1 | class ChangeToEnumerizeInAccounts < ActiveRecord::Migration 2 | def up 3 | change_column :accounts, :currency, :integer 4 | end 5 | 6 | def down 7 | change_column :accounts, :currency, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20130925175113_change_to_enumerize_in_deposits.rb: -------------------------------------------------------------------------------- 1 | class ChangeToEnumerizeInDeposits < ActiveRecord::Migration 2 | def up 3 | change_column :deposits, :payment_way, :integer 4 | change_column :deposits, :state, :integer 5 | end 6 | 7 | def down 8 | change_column :deposits, :payment_way, :string 9 | change_column :deposits, :state, :string 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130926011813_change_to_enumerize_in_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class ChangeToEnumerizeInPaymentTransactions < ActiveRecord::Migration 2 | def up 3 | change_column :payment_transactions, :state, :integer 4 | end 5 | 6 | def down 7 | change_column :payment_transactions, :state, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20130926014845_change_to_enumerize_in_withdraws.rb: -------------------------------------------------------------------------------- 1 | class ChangeToEnumerizeInWithdraws < ActiveRecord::Migration 2 | def up 3 | change_column :withdraws, :payment_way, :integer 4 | change_column :withdraws, :state, :integer 5 | end 6 | 7 | def down 8 | change_column :withdraws, :payment_way, :string 9 | change_column :withdraws, :state, :string 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130926170008_change_ref_to_text_in_account_versions.rb: -------------------------------------------------------------------------------- 1 | class ChangeRefToTextInAccountVersions < ActiveRecord::Migration 2 | def change 3 | change_column :account_versions, :ref, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130928113620_delete_table_account_versions.rb: -------------------------------------------------------------------------------- 1 | class DeleteTableAccountVersions < ActiveRecord::Migration 2 | def up 3 | drop_table :account_versions 4 | end 5 | 6 | def down 7 | raise ActiveRecord::IrreversibleMigration 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20130928122042_rename_account_logs_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class RenameAccountLogsToAccountVersions < ActiveRecord::Migration 2 | def change 3 | rename_table :account_logs, :account_versions 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20130928165236_add_alipay_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddAlipayToMembers < ActiveRecord::Migration 2 | def up 3 | add_column :identities, :pin_digest, :string 4 | remove_column :members, :pin_digest 5 | end 6 | 7 | def down 8 | remove_column :identities, :pin_digest 9 | add_column :members, :pin_digest, :string 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130928190156_rename_member_id_to_identity_id.rb: -------------------------------------------------------------------------------- 1 | class RenameMemberIdToIdentityId < ActiveRecord::Migration 2 | def up 3 | rename_column :reset_pins, :member_id, :identity_id 4 | end 5 | 6 | def down 7 | rename_column :reset_pins, :identity_id, :member_id 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20130928194048_add_alipay_address_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddAlipayAddressToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :alipay, :string 4 | add_column :members, :state, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20130929012418_create_invitations.rb: -------------------------------------------------------------------------------- 1 | class CreateInvitations < ActiveRecord::Migration 2 | def change 3 | create_table :invitations do |t| 4 | t.boolean :is_used 5 | t.string :token 6 | t.string :email 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130930183833_migrate_withdraw_addresses.rb: -------------------------------------------------------------------------------- 1 | class MigrateWithdrawAddresses < ActiveRecord::Migration 2 | def up 3 | change_table :members do |t| 4 | t.remove :alipay 5 | end 6 | end 7 | 8 | def down 9 | raise ActiveRecord::IrreversibleMigration 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20131001103847_add_deleted_at_to_withdraw_addresses.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToWithdrawAddresses < ActiveRecord::Migration 2 | def change 3 | add_column :withdraw_addresses, :deleted_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20131002012809_add_fee_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddFeeToWithdraws < ActiveRecord::Migration 2 | def change 3 | add_column :withdraws, :member_id, :integer, :after => :account_id 4 | add_column :withdraws, :currency, :integer, :after => :member_id 5 | add_column :withdraws, :fee, :decimal, :precision => 32, :scale => 16, :after => :amount 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20131002190141_rebuild_deposits.rb: -------------------------------------------------------------------------------- 1 | class RebuildDeposits < ActiveRecord::Migration 2 | def change 3 | change_table :deposits do |t| 4 | t.integer :member_id, :after => :account_id 5 | t.integer :currency, :after => :member_id 6 | t.datetime :done_at 7 | t.rename :payment_way, :category 8 | t.rename :payment_id, :tx_id 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20131003003357_add_address_to_deposits.rb: -------------------------------------------------------------------------------- 1 | class AddAddressToDeposits < ActiveRecord::Migration 2 | def change 3 | change_table :deposits do |t| 4 | t.string :address, :after => :amount 5 | t.string :address_label, :after => :address 6 | t.rename :category, :address_type 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20131003021225_rename_txid_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class RenameTxidToPaymentTransactions < ActiveRecord::Migration 2 | def up 3 | change_table :payment_transactions do |t| 4 | t.datetime :dont_at 5 | end 6 | end 7 | 8 | def down 9 | change_table :payment_transactions do |t| 10 | t.remove :dont_at 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20131006183340_create_tokens.rb: -------------------------------------------------------------------------------- 1 | class CreateTokens < ActiveRecord::Migration 2 | def up 3 | create_table :tokens do |t| 4 | t.string :token 5 | t.datetime :expire_at 6 | t.integer :identity_id 7 | t.boolean :is_used 8 | t.string :type 9 | 10 | t.timestamps 11 | end 12 | 13 | add_index :tokens, [:type, :token, :expire_at, :is_used] 14 | end 15 | 16 | def down 17 | drop_table :tokens 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20131009132505_create_documents.rb: -------------------------------------------------------------------------------- 1 | class CreateDocuments < ActiveRecord::Migration 2 | def change 3 | create_table :documents do |t| 4 | t.string :key 5 | t.string :title 6 | t.text :body 7 | t.boolean :is_auth 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20131022035138_add_in_out_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddInOutToAccounts < ActiveRecord::Migration 2 | def change 3 | add_column :accounts, :in, :decimal, :precision => 32, :scale => 16 4 | add_column :accounts, :out, :decimal, :precision => 32, :scale => 16 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20131027012836_change_in_out_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class ChangeInOutToAccounts < ActiveRecord::Migration 2 | def up 3 | change_column :accounts, :in, :decimal, :precision => 32, :scale => 16 4 | change_column :accounts, :out, :decimal, :precision => 32, :scale => 16 5 | end 6 | 7 | def down 8 | change_column :accounts, :in, :decimal, :precision => 32, :scale => 16 9 | change_column :accounts, :out, :decimal, :precision => 32, :scale => 16 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20131110214254_add_currency_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class AddCurrencyToPaymentTransactions < ActiveRecord::Migration 2 | def change 3 | add_column :payment_transactions, :currency, :integer 4 | end 5 | end 6 | 7 | -------------------------------------------------------------------------------- /db/migrate/20131130190923_remove_pin_digest_from_identities.rb: -------------------------------------------------------------------------------- 1 | class RemovePinDigestFromIdentities < ActiveRecord::Migration 2 | def up 3 | remove_column :identities, :pin_digest 4 | end 5 | 6 | def down 7 | add_column :identities, :pin_digest, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20131201011127_drop_reset_pins.rb: -------------------------------------------------------------------------------- 1 | class DropResetPins < ActiveRecord::Migration 2 | def up 3 | drop_table :reset_pins 4 | end 5 | 6 | def down 7 | create_table :reset_pins do |t| 8 | t.string :email 9 | t.string :token 10 | t.datetime :expire_at 11 | t.integer :identity_id 12 | t.boolean :is_used 13 | 14 | t.timestamps 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20131204020953_add_currency_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddCurrencyToAccountVersions < ActiveRecord::Migration 2 | def up 3 | add_column :account_versions, :currency, :integer 4 | remove_column :account_versions, :detail 5 | end 6 | 7 | def down 8 | raise ActiveRecord::IrreversibleMigration 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20131208012814_fix_payment_address_currency.rb: -------------------------------------------------------------------------------- 1 | class FixPaymentAddressCurrency < ActiveRecord::Migration 2 | def change 3 | add_column :payment_addresses, :currency, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20131224162832_add_sn_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddSnToWithdraws < ActiveRecord::Migration 2 | def change 3 | add_column :withdraws, :sn, :string, after: :id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140101175408_add_fee_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddFeeToAccountVersions < ActiveRecord::Migration 2 | def change 3 | add_column :account_versions, :fee, :decimal, precision: 32, scale: 16, after: :locked 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140102024125_add_fun_to_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddFunToAccountVersions < ActiveRecord::Migration 2 | def change 3 | add_column :account_versions, :fun, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140105034746_drop_reset_passwords.rb: -------------------------------------------------------------------------------- 1 | class DropResetPasswords < ActiveRecord::Migration 2 | def up 3 | if ActiveRecord::Base.connection.table_exists? :reset_passwords 4 | drop_table :reset_passwords 5 | end 6 | end 7 | 8 | def down 9 | raise ActiveRecord::IrreversibleMigration 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140302094520_rename_identity_id_to_member_id.rb: -------------------------------------------------------------------------------- 1 | class RenameIdentityIdToMemberId < ActiveRecord::Migration 2 | def change 3 | change_table :tokens do |t| 4 | t.rename :identity_id, :member_id 5 | end 6 | 7 | change_table :two_factors do |t| 8 | t.rename :identity_id, :member_id 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140302161905_create_authentications.rb: -------------------------------------------------------------------------------- 1 | class CreateAuthentications < ActiveRecord::Migration 2 | def change 3 | create_table :authentications do |t| 4 | t.string :provider 5 | t.string :uid 6 | t.string :token 7 | t.string :secret 8 | t.integer :member_id 9 | 10 | t.timestamps 11 | end 12 | 13 | add_index :authentications, :member_id 14 | add_index :authentications, [:provider, :uid] 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20140303060739_add_activated_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddActivatedToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :activated, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140303080054_rename_is_active_to_activated.rb: -------------------------------------------------------------------------------- 1 | class RenameIsActiveToActivated < ActiveRecord::Migration 2 | def change 3 | change_table :two_factors do |t| 4 | t.rename :is_active, :activated 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140304015055_create_documents_translations.rb: -------------------------------------------------------------------------------- 1 | class CreateDocumentsTranslations < ActiveRecord::Migration 2 | def up 3 | Document.create_translation_table!( 4 | { :title => :string, :body => :text }, 5 | { :migrate_data => true } 6 | ) 7 | end 8 | 9 | def down 10 | Document.drop_translation_table! :migrate_data => true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140306020939_create_id_documents.rb: -------------------------------------------------------------------------------- 1 | class CreateIdDocuments < ActiveRecord::Migration 2 | def change 3 | create_table :id_documents do |t| 4 | t.integer :category 5 | t.string :name 6 | t.string :sn 7 | t.integer :member_id 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140306021833_add_verified_to_id_documents.rb: -------------------------------------------------------------------------------- 1 | class AddVerifiedToIdDocuments < ActiveRecord::Migration 2 | def change 3 | add_column :id_documents, :verified, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140312061206_add_aasm_state_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddAasmStateToWithdraws < ActiveRecord::Migration 2 | def change 3 | add_column :withdraws, :aasm_state, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140312071704_add_sum_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddSumToWithdraws < ActiveRecord::Migration 2 | def change 3 | add_column :withdraws, :sum, :decimal, precision: 32, scale: 16 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140319022202_add_partial_tree_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddPartialTreeToAccounts < ActiveRecord::Migration 2 | def change 3 | add_column :accounts, :partial_tree, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140319022302_create_proofs.rb: -------------------------------------------------------------------------------- 1 | class CreateProofs < ActiveRecord::Migration 2 | def change 3 | create_table :proofs do |t| 4 | t.string :root 5 | t.integer :currency 6 | t.boolean :ready, default: false 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140320142701_create_versions.rb: -------------------------------------------------------------------------------- 1 | class CreateVersions < ActiveRecord::Migration 2 | def change 3 | create_table :versions do |t| 4 | t.string :item_type, :null => false 5 | t.integer :item_id, :null => false 6 | t.string :event, :null => false 7 | t.string :whodunnit 8 | t.text :object 9 | t.datetime :created_at 10 | end 11 | add_index :versions, [:item_type, :item_id] 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20140324060148_rename_withdraw_addresses_to_fund_sources.rb: -------------------------------------------------------------------------------- 1 | class RenameWithdrawAddressesToFundSources < ActiveRecord::Migration 2 | def change 3 | rename_table :withdraw_addresses, :fund_sources 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140326170234_change_deposits.rb: -------------------------------------------------------------------------------- 1 | class ChangeDeposits < ActiveRecord::Migration 2 | def change 3 | rename_column :deposits, :address, :fund_source_uid 4 | rename_column :deposits, :address_label, :fund_source_extra 5 | rename_column :deposits, :address_type, :channel_id 6 | rename_column :deposits, :tx_id, :txid 7 | add_column :deposits, :fee, :decimal, :precision => 32, :scale => 16, :after => :amount 8 | add_column :deposits, :aasm_state, :string, :after => :state 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140326191837_add_deposit_id_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class AddDepositIdToPaymentTransactions < ActiveRecord::Migration 2 | def change 3 | add_column :payment_transactions, :aasm_state, :string, :after => :state 4 | add_column :payment_transactions, :channel_id, :integer, :after => :aasm_state 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140327044440_change_withdraws.rb: -------------------------------------------------------------------------------- 1 | class ChangeWithdraws < ActiveRecord::Migration 2 | def change 3 | rename_column :withdraws, :withdraw_channel_id, :channel_id 4 | rename_column :withdraws, :tx_id, :txid 5 | rename_column :withdraws, :fund_source_uid, :fund_uid 6 | rename_column :withdraws, :fund_source_extra, :fund_extra 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20140327062025_add_memo_and_remove_fund_source_to_deposits.rb: -------------------------------------------------------------------------------- 1 | class AddMemoAndRemoveFundSourceToDeposits < ActiveRecord::Migration 2 | def change 3 | add_column :deposits, :memo, :string 4 | rename_column :deposits, :fund_source_uid, :fund_uid 5 | rename_column :deposits, :fund_source_extra, :fund_extra 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140327065708_rename_fund_sources_category_to_channel_id.rb: -------------------------------------------------------------------------------- 1 | class RenameFundSourcesCategoryToChannelId < ActiveRecord::Migration 2 | def change 3 | rename_column :fund_sources, :category, :channel_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140327105217_remove_fund_sources_account_id.rb: -------------------------------------------------------------------------------- 1 | class RemoveFundSourcesAccountId < ActiveRecord::Migration 2 | def change 3 | remove_column :fund_sources, :account_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140328101707_add_type_to_deposits.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToDeposits < ActiveRecord::Migration 2 | def change 3 | add_column :deposits, :type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140329070543_remove_channel_id.rb: -------------------------------------------------------------------------------- 1 | class RemoveChannelId < ActiveRecord::Migration 2 | def change 3 | remove_column :deposits, :channel_id 4 | remove_column :payment_transactions, :channel_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140331084541_fund_sources_is_locked_default_to_false.rb: -------------------------------------------------------------------------------- 1 | class FundSourcesIsLockedDefaultToFalse < ActiveRecord::Migration 2 | def change 3 | change_column_default :fund_sources, :is_locked, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140402043033_create_partial_trees.rb: -------------------------------------------------------------------------------- 1 | class CreatePartialTrees < ActiveRecord::Migration 2 | def up 3 | create_table :partial_trees do |t| 4 | t.integer :proof_id, null: false 5 | t.integer :account_id, null: false 6 | t.text :json, null: false 7 | 8 | t.timestamps 9 | end 10 | 11 | remove_column :accounts, :partial_tree 12 | 13 | Proof.delete_all 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140403031847_create_api_tokens.rb: -------------------------------------------------------------------------------- 1 | class CreateAPITokens < ActiveRecord::Migration 2 | def change 3 | create_table :api_tokens do |t| 4 | t.integer :member_id, null: false 5 | t.string :access_key, null: false, limit: 50 6 | t.string :secret_key, null: false, limit: 50 7 | 8 | t.timestamps 9 | end 10 | 11 | add_index :api_tokens, :access_key, unique: true 12 | add_index :api_tokens, :secret_key, unique: true 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20140403070840_add_type_to_withdraws.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToWithdraws < ActiveRecord::Migration 2 | def up 3 | add_column :withdraws, :type, :string 4 | 5 | Withdraw.all.each do |withdraw| 6 | type = withdraw.currency == 'btc' ? 'Withdraws::Satoshi' : 'Withdraws::Bank' 7 | withdraw.update_column :type, type 8 | end 9 | end 10 | 11 | def down 12 | remove_column :withdraws, :type 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20140404074816_add_currency_index_to_trades.rb: -------------------------------------------------------------------------------- 1 | class AddCurrencyIndexToTrades < ActiveRecord::Migration 2 | def change 3 | add_index :trades, :currency 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140404101823_add_ask_member_id_and_bid_member_id_to_trades.rb: -------------------------------------------------------------------------------- 1 | class AddAskMemberIdAndBidMemberIdToTrades < ActiveRecord::Migration 2 | def change 3 | add_column :trades, :ask_member_id, :integer 4 | add_column :trades, :bid_member_id, :integer 5 | 6 | add_index :trades, :ask_member_id 7 | add_index :trades, :bid_member_id 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20140405053744_remove_withdraws_state_and_channel_id.rb: -------------------------------------------------------------------------------- 1 | class RemoveWithdrawsStateAndChannelId < ActiveRecord::Migration 2 | def change 3 | remove_column :withdraws, :channel_id 4 | remove_column :withdraws, :state 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140407011310_add_source_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddSourceToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :source, :string, null: false 4 | Order.update_all(source: 'Web') 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140416143239_add_country_code_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddCountryCodeToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :country_code, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140416143352_add_phone_number_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddPhoneNumberToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :phone_number, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140416151403_add_phone_number_verified_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddPhoneNumberVerifiedToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :phone_number_verified, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140416194209_remove_table_invitations.rb: -------------------------------------------------------------------------------- 1 | class RemoveTableInvitations < ActiveRecord::Migration 2 | def change 3 | drop_table :invitations 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140416194300_remove_table_members_trades.rb: -------------------------------------------------------------------------------- 1 | class RemoveTableMembersTrades < ActiveRecord::Migration 2 | def change 3 | drop_table :members_trades 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140418082715_add_sum_to_proofs.rb: -------------------------------------------------------------------------------- 1 | class AddSumToProofs < ActiveRecord::Migration 2 | def change 3 | add_column :proofs, :sum, :string 4 | add_column :partial_trees, :sum, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140421061712_add_index_on_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnAccounts < ActiveRecord::Migration 2 | def change 3 | add_index :accounts, [:member_id, :currency] 4 | add_index :accounts, :member_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140421080408_add_type_to_two_factors.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToTwoFactors < ActiveRecord::Migration 2 | def change 3 | add_column :two_factors, :type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140428203350_add_desc_and_keyword_to_documents.rb: -------------------------------------------------------------------------------- 1 | class AddDescAndKeywordToDocuments < ActiveRecord::Migration 2 | def change 3 | add_column :documents, :desc, :text 4 | add_column :documents, :keywords, :text 5 | 6 | add_column :document_translations, :desc, :text 7 | add_column :document_translations, :keywords, :text 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20140507120249_add_addresses_to_proofs.rb: -------------------------------------------------------------------------------- 1 | class AddAddressesToProofs < ActiveRecord::Migration 2 | def change 3 | add_column :proofs, :addresses, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140524014413_add_ord_type_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddOrdTypeToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :ord_type, :string, limit: 10 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140530133210_add_locked_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddLockedToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :locked, :decimal, precision: 32, scale: 16 4 | add_column :orders, :origin_locked, :decimal, precision: 32, scale: 16 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140531054739_add_used_funds_to_trades.rb: -------------------------------------------------------------------------------- 1 | class AddUsedFundsToTrades < ActiveRecord::Migration 2 | def change 3 | add_column :trades, :funds, :decimal, precision: 32, scale: 16 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140618004355_add_displayname_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddDisplaynameToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :display_name, :string, after: :name 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140702035833_add_balance_to_proofs.rb: -------------------------------------------------------------------------------- 1 | class AddBalanceToProofs < ActiveRecord::Migration 2 | def change 3 | add_column :proofs, :balance, :string, limit: 30 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140703065321_add_order_id_indices_to_trades.rb: -------------------------------------------------------------------------------- 1 | class AddOrderIdIndicesToTrades < ActiveRecord::Migration 2 | def change 3 | add_index :trades, :ask_id 4 | add_index :trades, :bid_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140703070953_add_funds_received_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddFundsReceivedToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :funds_received, :decimal, precision: 32, scale: 16, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140709084906_create_tickets.rb: -------------------------------------------------------------------------------- 1 | class CreateTickets < ActiveRecord::Migration 2 | def change 3 | create_table :tickets do |t| 4 | t.string :title 5 | t.text :content 6 | t.string :aasm_state 7 | t.integer :author_id 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140709085158_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration 2 | def change 3 | create_table :comments do |t| 4 | t.text :content 5 | t.integer :author_id 6 | t.integer :ticket_id 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140712030803_add_disabled_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddDisabledToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :disabled, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140714143823_unread_migration.rb: -------------------------------------------------------------------------------- 1 | class UnreadMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :read_marks, :force => true do |t| 4 | t.integer :readable_id 5 | t.integer :member_id, :null => false 6 | t.string :readable_type, :null => false, :limit => 20 7 | t.datetime :timestamp 8 | end 9 | 10 | add_index :read_marks, [:member_id] 11 | add_index :read_marks, [:readable_type, :readable_id] 12 | 13 | end 14 | 15 | def self.down 16 | drop_table :read_marks 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20140715002401_add_more_fields_to_id_documents_table.rb: -------------------------------------------------------------------------------- 1 | class AddMoreFieldsToIdDocumentsTable < ActiveRecord::Migration 2 | def change 3 | add_column :id_documents, :birth_date, :date 4 | add_column :id_documents, :address, :text 5 | add_column :id_documents, :city, :string 6 | add_column :id_documents, :country, :string 7 | add_column :id_documents, :zipcode, :string 8 | add_column :id_documents, :id_bill_type, :integer 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140715040545_remove_name_field_from_members_table.rb: -------------------------------------------------------------------------------- 1 | class RemoveNameFieldFromMembersTable < ActiveRecord::Migration 2 | def up 3 | remove_column :members, :name 4 | end 5 | 6 | def down 7 | add_column :members, :name, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20140715083857_add_aasm_state_to_id_document.rb: -------------------------------------------------------------------------------- 1 | class AddAasmStateToIdDocument < ActiveRecord::Migration 2 | def change 3 | add_column :id_documents, :aasm_state, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140717033231_add_assets_table.rb: -------------------------------------------------------------------------------- 1 | class AddAssetsTable < ActiveRecord::Migration 2 | def change 3 | create_table :assets do |t| 4 | t.string :type 5 | t.integer :attachable_id 6 | t.string :attachable_type 7 | t.string :file 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140718134132_rename_id_documents_column_category_to_id_document_type.rb: -------------------------------------------------------------------------------- 1 | class RenameIdDocumentsColumnCategoryToIdDocumentType < ActiveRecord::Migration 2 | def change 3 | rename_column :id_documents, :category, :id_document_type 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140718141345_rename_id_documents_column_from_sn_to_id_document_number.rb: -------------------------------------------------------------------------------- 1 | class RenameIdDocumentsColumnFromSnToIdDocumentNumber < ActiveRecord::Migration 2 | def change 3 | rename_column :id_documents, :sn, :id_document_number 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140721125900_remove_column_verified_from_id_documents.rb: -------------------------------------------------------------------------------- 1 | class RemoveColumnVerifiedFromIdDocuments < ActiveRecord::Migration 2 | def change 3 | remove_column :id_documents, :verified 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140724033014_add_trusted_ip_list_to_api_tokens.rb: -------------------------------------------------------------------------------- 1 | class AddTrustedIpListToAPITokens < ActiveRecord::Migration 2 | def change 3 | add_column :api_tokens, :trusted_ip_list, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140803202610_remove_channel_id_from_fund_sources.rb: -------------------------------------------------------------------------------- 1 | class RemoveChannelIdFromFundSources < ActiveRecord::Migration 2 | def change 3 | remove_column :fund_sources, :channel_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140804002557_add_api_disabled_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddAPIDisabledToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :api_disabled, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140804151249_change_default_of_withdrao_fee.rb: -------------------------------------------------------------------------------- 1 | class ChangeDefaultOfWithdraoFee < ActiveRecord::Migration 2 | def change 3 | change_column :withdraws, :sum, :decimal, precision: 32, scale: 16, default: 0, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140806141035_add_index_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToOrders < ActiveRecord::Migration 2 | def change 3 | add_index :orders, :member_id, using: :btree 4 | add_index :orders, [:currency, :state], using: :btree 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140806141419_add_index_to_trades.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToTrades < ActiveRecord::Migration 2 | def change 3 | add_index :trades, :created_at, using: :btree 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140819085359_add_index_to_order_state.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToOrderState < ActiveRecord::Migration 2 | def change 3 | add_index :orders, :state 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140819090417_add_index_on_orders_member_id_and_state.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnOrdersMemberIdAndState < ActiveRecord::Migration 2 | def change 3 | add_index :orders, [:member_id, :state] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140826083906_add_label_to_api_token.rb: -------------------------------------------------------------------------------- 1 | class AddLabelToAPIToken < ActiveRecord::Migration 2 | def change 3 | add_column :api_tokens, :label, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140826093508_add_refreshed_at_to_two_factors.rb: -------------------------------------------------------------------------------- 1 | class AddRefreshedAtToTwoFactors < ActiveRecord::Migration 2 | def change 3 | add_column :two_factors, :refreshed_at, :timestamp 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140902112641_create_simple_captcha_data.rb: -------------------------------------------------------------------------------- 1 | class CreateSimpleCaptchaData < ActiveRecord::Migration 2 | def self.up 3 | create_table :simple_captcha_data do |t| 4 | t.string :key, :limit => 40 5 | t.string :value, :limit => 6 6 | t.timestamps 7 | end 8 | 9 | add_index :simple_captcha_data, :key, :name => "idx_key" 10 | end 11 | 12 | def self.down 13 | drop_table :simple_captcha_data 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140920062130_add_type_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToPaymentTransactions < ActiveRecord::Migration 2 | def up 3 | add_column :payment_transactions, :type, :string, limit: 60 4 | PaymentTransaction.update_all type: 'PaymentTransaction::Default' 5 | add_index :payment_transactions, :type 6 | end 7 | 8 | def down 9 | remove_index :payment_transactions, :type 10 | remove_column :payment_transactions, :type 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20141002075102_add_tx_out_to_payment_transactions.rb: -------------------------------------------------------------------------------- 1 | class AddTxOutToPaymentTransactions < ActiveRecord::Migration 2 | def change 3 | add_column :payment_transactions, :txout, :integer 4 | add_index :payment_transactions, [:txid, :txout] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141003040822_add_payment_transaction_id_to_deposits.rb: -------------------------------------------------------------------------------- 1 | class AddPaymentTransactionIdToDeposits < ActiveRecord::Migration 2 | def change 3 | add_column :deposits, :payment_transaction_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141003061259_add_txout_to_deposits.rb: -------------------------------------------------------------------------------- 1 | class AddTxoutToDeposits < ActiveRecord::Migration 2 | def change 3 | add_column :deposits, :txout, :integer 4 | add_index :deposits, [:txid, :txout] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141010083930_remove_phone_number_verified_from_members.rb: -------------------------------------------------------------------------------- 1 | class RemovePhoneNumberVerifiedFromMembers < ActiveRecord::Migration 2 | def change 3 | remove_column :members, :phone_number_verified 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141012124243_set_token_is_used_to_false_as_default.rb: -------------------------------------------------------------------------------- 1 | class SetTokenIsUsedToFalseAsDefault < ActiveRecord::Migration 2 | def change 3 | change_column :tokens, :is_used, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141014085101_add_nickname_to_members.rb: -------------------------------------------------------------------------------- 1 | class AddNicknameToMembers < ActiveRecord::Migration 2 | def change 3 | add_column :members, :nickname, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141015034040_add_nickname_to_authentications.rb: -------------------------------------------------------------------------------- 1 | class AddNicknameToAuthentications < ActiveRecord::Migration 2 | def change 3 | add_column :authentications, :nickname, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141105090746_add_oauth_columns_to_api_tokens.rb: -------------------------------------------------------------------------------- 1 | class AddOauthColumnsToAPITokens < ActiveRecord::Migration 2 | def change 3 | add_column :api_tokens, :oauth_access_token_id, :integer 4 | add_column :api_tokens, :expire_at, :datetime 5 | add_column :api_tokens, :scopes, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141107031140_add_deleted_at_to_api_tokens_and_oauth_tokens.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToAPITokensAndOauthTokens < ActiveRecord::Migration 2 | def change 3 | add_column :api_tokens, :deleted_at, :datetime 4 | add_column :oauth_access_tokens, :deleted_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141203042029_rename_deposits_memo_to_confirmations.rb: -------------------------------------------------------------------------------- 1 | class RenameDepositsMemoToConfirmations < ActiveRecord::Migration 2 | def up 3 | rename_column :deposits, :memo, :confirmations 4 | end 5 | 6 | def down 7 | rename_column :deposits, :confirmations, :memo 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20141216120736_add_trades_count_to_orders.rb: -------------------------------------------------------------------------------- 1 | class AddTradesCountToOrders < ActiveRecord::Migration 2 | def change 3 | add_column :orders, :trades_count, :integer, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150117151634_add_signup_histories.rb: -------------------------------------------------------------------------------- 1 | class AddSignupHistories < ActiveRecord::Migration 2 | def change 3 | create_table :signup_histories do |t| 4 | t.references :member, index: true 5 | t.string :ip 6 | t.string :accept_language 7 | t.string :ua 8 | t.datetime :created_at 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150205011423_add_account_id_index_on_account_versions.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdIndexOnAccountVersions < ActiveRecord::Migration 2 | def change 3 | add_index :account_versions, :account_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150405053726_add_default_withdraw_fund_source_id_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddDefaultWithdrawFundSourceIdToAccounts < ActiveRecord::Migration 2 | def change 3 | add_column :accounts, :default_withdraw_fund_source_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /doc/docker/bin/base.sh: -------------------------------------------------------------------------------- 1 | docker run -d --name redis dockerfile/redis 2 | docker run -d --name dbmaster -v /dbdata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=ROOT_PASSWORD -e MYSQL_USER=DATABASE_USER -e MYSQL_PASSWORD=PASSWORD -e MYSQL_DATABASE=DATABSE_NAME mysql 3 | docker run -d --name rabbitmq dockerfile/rabbitmq 4 | -------------------------------------------------------------------------------- /doc/docker/bin/webapp.sh: -------------------------------------------------------------------------------- 1 | # build Dockerfile to image peatio:base first !!! 2 | docker run -d --name webapp \ 3 | -p 80:80 -p 18080:18080 -p 443:443 \ 4 | --link rabbitmq:rabbitmq \ 5 | --link dbmaster:dbmaster \ 6 | --link redis:redis \ 7 | peatio:base /sbin/my_init --enable-insecure-key 8 | 9 | docker-bash webapp bash -lc 'cd /home/app/peatio/; git pull;' 10 | docker-bash webapp bash -lc 'cd /home/app/peatio/; RAILS_ENV=production ./bin/rake db:migrate;' 11 | docker-bash webapp bash -lc 'cd /home/app/peatio/; RAILS_ENV=production ./bin/rake assets:precompile;' 12 | -------------------------------------------------------------------------------- /doc/docker/conf/nginx-peatio-env.conf: -------------------------------------------------------------------------------- 1 | env DBMASTER_PORT_3306_TCP_ADDR; 2 | env DBMASTER_ENV_MYSQL_DATABASE; 3 | env DBMASTER_ENV_MYSQL_USER; 4 | env DBMASTER_ENV_MYSQL_PASSWORD; 5 | env REDIS_PORT; 6 | env RABBIMQ_PORT_5672_TCP_PORT; 7 | env RABBIMQ_PORT_5672_TCP_ADDR; 8 | -------------------------------------------------------------------------------- /doc/docker/conf/rails-database.yml: -------------------------------------------------------------------------------- 1 | production: 2 | adapter: mysql2 3 | encoding: utf8 4 | host: <%= ENV['DBMASTER_PORT_3306_TCP_ADDR'] %> 5 | database: <%= ENV['DBMASTER_ENV_MYSQL_DATABASE'] %> 6 | username: <%= ENV['DBMASTER_ENV_MYSQL_USER'] %> 7 | password: <%= ENV['DBMASTER_ENV_MYSQL_PASSWORD'] %> 8 | pool: 10 9 | reconnect: true 10 | -------------------------------------------------------------------------------- /eth/filter.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=filter 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=ubuntu 8 | ExecStart=/usr/bin/ruby /home/ubuntu/service.rb 9 | Restart=on-failure 10 | 11 | [Install] 12 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /eth/geth.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum go client 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/usr/bin/geth --verbosity 3 --rpc --light --rpcaddr=0.0.0.0 --rpcport=8545 --rpcapi eth,personal,net,web3,db 7 | 8 | [Install] 9 | WantedBy=default.target 10 | -------------------------------------------------------------------------------- /eth/restart.cgi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Content-type: text/html" 3 | echo "" 4 | 5 | sudo service filter restart 6 | 7 | -------------------------------------------------------------------------------- /eth/service.rb: -------------------------------------------------------------------------------- 1 | require 'web3' 2 | w3 = Web3.new 3 | while true 4 | accounts = w3.eth_accounts 5 | bn = w3.eth_blockNumber - 5 6 | block = w3.eth_getBlockByNumber('0x' + bn.to_s(16)) 7 | for tx in block["transactions"] 8 | if accounts.include? tx["to"] 9 | puts tx 10 | postData = Net::HTTP.post_form(URI.parse('https://yourwebsite.com/webhooks/eth'), {'type'=>'transaction', 'hash'=>tx["hash"]}) 11 | sleep 5 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /eth/total.cgi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Content-type: text/html" 3 | echo "" 4 | 5 | TOT=`geth attach rpc:http://127.0.0.1:8545 --exec 'loadScript("/var/www/total.js"); totBal() ;' | head -n 1` 6 | echo $TOT 7 | exit 0 8 | 9 | -------------------------------------------------------------------------------- /eth/total.js: -------------------------------------------------------------------------------- 1 | function totBal(){ 2 | var i = 0; 3 | var bal1 = 0; 4 | var bal2 = 0; 5 | eth.accounts.forEach( function(e){ 6 | bal1 = parseInt(eth.getBalance(e)); 7 | bal2 += parseInt(bal1); 8 | }); 9 | console.log(web3.fromWei(bal2, "ether")); 10 | }; 11 | -------------------------------------------------------------------------------- /lib/aasm/locking.rb: -------------------------------------------------------------------------------- 1 | module AASM::Locking 2 | def aasm_write_state(state) 3 | lock! 4 | super(state) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algobasket/PeatioCryptoExchange/4c75c7a4104f0db93f43a75c74016e6476c76307/lib/assets/.gitkeep -------------------------------------------------------------------------------- /lib/benchmark/amqp_mock.rb: -------------------------------------------------------------------------------- 1 | class AMQPQueue 2 | class <3 | {{"funds.withdraw_coin.intro" | t}} 4 |
5 | 6 |3 | {{"funds.withdraw_coin.intro" | t}} 4 |
5 | 6 |