Commit Graph

58 Commits

Author SHA1 Message Date
sairajzero
c8b70e3fec APIs for getSink and getConvertValues
- floExchangeAPI.getSink: resolves an active sink id (for a service, default: exchange)
- services can be listed in floExchangeAPI.serviceList

- floExchangeAPI.getConvertValues: resolves the available convert values
2022-11-15 03:29:23 +05:30
sairajzero
178fcf4ce2 Update database module
- Updated database module so that other modules can use it directly by require()
- use path module where-ever needed
- Fixed: public directory not viewed in browser when opening the link
2022-11-12 04:30:25 +05:30
sairajzero
a7747a2ecf Bug fix
- Fixed: Bob's fund data not read from blockchain
- Fixed: incorrect senders list passed to readData from blockchain
- Fixed: when data is not saved in DB correctly, do not update LastTx, hence in next refresh, it might get resolved
- Fixed: bugs in Blockchain bonds closing and bob's fund closing
- Merged parse.main and parse.end in Bob's fund module
2022-10-26 04:55:50 +05:30
sairajzero
76339f1621 Optimization and Bug fix
- Renamed all `status` columns to `r_status`
- r_status uses INT instead of VARCHAR
- status-codes are used instead of strings
- Codes for status and modes can be found at floExchangeAPI.processCode
- Merged DepositCoin, WithdrawCoin, DepositToken, WithdrawToken into VaultTransactions so that all deposit/withdraw transactions can be viewed in order
- Updated relevant SQL syntaxes for the above
- Converted all multi-valued placeholders in SQL queries to array based placeholders
- Fixed minor bugs
2022-10-20 04:23:35 +05:30
sairajzero
0381c44733 Convert fund management
- Added Withdrawal of convert fund
- Convert fund is moved to a different table (ConvertFund)
- Added APIs for withdraw fund
- Changed add-convert-fund to deposit-convert-fund
- Fixed minor bugs
2022-10-19 21:26:11 +05:30
sairajzero
fde297fb44 Convert feature add-ons
- Reject request when not enough fund is available to convert.
- MIN_FUND  is the minimum fund that should be reserved.
- Add funds for conversion via adminID

- Added: Refund feature
- Automate a refund on currency when convertToCoin request is made when fund is insufficient
- ConvertFrom now accepts an non-broadcasted tx_hex from user and broadcast it when convert fund is available. (if convert fund is insufficient, then tx is not broadcasted)
2022-10-18 04:45:55 +05:30
sairajzero
29bedbdcc8 Bug fixes
- Fixed: refreshData for bobs-fund and blockchain-bonds not been invoked
- Fixed: DB assignment for conversion, bonds and bobs-fund
2022-10-11 17:12:30 +05:30
sairajzero
8a82a0b675 Close Bobs-Fund feature
- Adding feature to close bobs' fund investment upon user requests
- Added: API for the same
2022-10-11 03:15:34 +05:30
sairajzero
7c99f41e48 API for close-blockchain-bonds 2022-10-10 19:23:20 +05:30
sairajzero
fef11b4712 moving conversion.js into service folder 2022-10-09 23:08:48 +05:30
sairajzero
a193291bd7 APIs for coin-convert feature 2022-10-07 23:02:59 +05:30
sairajzero
1e8f2c17e7 Fix: invoking 'collectAndCall' for withdraws 2022-09-26 01:34:26 +05:30
sairajzero
dd232c5a71 Fixes: sinkID and sinkPrivKey usage 2022-09-25 02:28:08 +05:30
sairajzero
166778e7f8 get-transact API
- Get user's deposit and withdraw history (private request: ie, requires signing)
- Update floTokenAPI
2022-05-25 03:55:55 +05:30
sairajzero
a77f7d77d6 Error codes
- Added error codes for floExchangeAPI
2022-05-12 01:40:31 +05:30
sairajzero
54470b42d7 get-rates API improved
- get-rates API will now give a countDown timer
- this will be time at which next price update will happen unless a trade occurs
- Update: _constants.js for previous update
2022-05-07 00:03:36 +05:30
sairajzero
d3c5682994 Improved Triggers for coupling process
- moved periodic-process start/stop to market.js
- price.getRates() will update price only when updatePrice is true (ie, regular fn call wont update price unnecessarily)
- Trigger coupling for asset on successful order placement
- Return (or wait) if a coupling instance is running for asset
- Reset timeout when price is updated and/or trade has happened.
- Next coupling instance will be set for timeout upon completion of one instance
- Stop all coupling instances on app pause (i.e., node is not master)
2022-05-06 23:43:44 +05:30
sairajzero
d44531211a Bug Fix: list buy/sell giving error
Fixed: only_full_group_by error return by SQL statement
2022-05-04 15:16:18 +05:30
sairajzero
55bd121021 API for ordered list for sell/buy
- The API for Listing sell/buy orders now returns ordered list of the queue (approx).
- list-buyorders, list-sellorders and list-trades API now accepts optional GET parameter 'asset'.
  . If passed, then orders/trades of only given asset will be returned.
  . If asset is not passed, then returns all asset by default as before.
- list buy/sell order API return max of 100 best orders
- list trade API return max of 1000 recent trades
2022-05-02 22:53:57 +05:30
sairajzero
f9551c856d Updating sell-requirement
- Users can only sell when enough sell-chips (for asset) are available.
- sell-chips are obtained by
  . buying assets
  . receiving asset from distributor
  . deposit (FLO only) as launch-seller (maximum of 1 million)
- Updated coupling for the requirement
- Improved getBestSeller and getBestBuyer: Directly fetch from SQL query
- Removed group.js (moved required functions to market.js)
- Updated SQL schema
2022-04-17 03:44:34 +05:30
sairajzero
9caf3fc9ec Distributor feature and Balance structure change
- Distributor feature allows to mark floIDs as distributors for certain asset.
- Added 2 APIs: add-distributor, remove-distributor
- Changing structure for token balance in exchange system. (requirement for new rule update).
2022-04-13 01:06:01 +05:30
sairajzero
6451f02546 rate-history API 2022-03-30 05:38:55 +05:30
sairajzero
fa46e1132f Bug fix: getRate for an asset not working 2022-03-29 15:53:01 +05:30
sairajzero
ef0599d915 get-balance API
Added: get-balance API to fetch total balance
- accepts 2 parameters: floID and token. Requires atleast one of them for the API to work
/get-balance?floID=<floID>&token=<token> : responses balance of a specific token for a floID
/get-balance?floID=<floID> : responses all token balance for a floID
/get-balance?token=<token> : reponses balance of a specific token for every floID

Note (optional): in GET request
- floID=<floID> can be replaced with addr=<floID>
- token=<token> can be replaced with asset=<asset>
Both responses the same result as above
2022-03-18 00:50:39 +05:30
sairajzero
eed495ab83 Bug fixes
- Fixed: transferToken not processed by server
- blockchainReCheck stops and adds itself to Timeout callback when sinkID is not loaded (uses MINI_PERIOD_INTERVAL = PERIOD_INTERVAL/10 for timeout ms)
- Fixed: confirmDepositFLO - asset attribute missing in SQL syntax
- When sinkID is not loaded, cancel check for confirmDepositFLO and confirmDepositToken
- Fixed: Incorrect receiver (sinkID) bug in confirmDepositFLO.checkTx
- Uncommented loaded, received, retrived sink logs
- Changed (SQL schema) sign field in RequestLog table to VARCHAR(160)
- Fixed: minor syntax errors and typos bugs
2022-03-17 03:06:00 +05:30
sairajzero
eeb3c70a10 Optimised request.js code 2022-03-16 02:11:36 +05:30
sairajzero
1823a46a98 Transfer transactions now support one-to-many
- receiver parameter now requires an object in the format
{floID1: amount1, floID2: amount2 ...}
- Transaction hash (id) for both trade and transfer transactions are now generated using SHA of JSON-string object
- Updated schema for one-to-many TransferTransactions
2022-03-16 00:33:22 +05:30
sairajzero
f59c6b3f2a Removing need for user registration
- Users can directly login or request without the need for user registration.
- Users can sign the requests either directly with own privateKey or by using a proxy
- Request's timestamp will be checked for Sign expiry.
- Request's sign will be checked for duplication.
- Cash table update will try to insert if record is not there
- Request Log table will also store a boolean value for sign by proxy or not
- Updated the SQL schema for the above changes.
2022-03-15 04:06:43 +05:30
sairajzero
3296b16710 Get transaction details
- Transaction details can be fetched using the following API
/get-transaction?txid=<txid>
- Get rates now accepts parameter 'asset' (optional) to return rate of particular asset.
/get-rates?asset=<asset>
/get-rates
- Get transactions (trade) API is changed to the following
/list-trades
2022-03-12 03:31:01 +05:30
sairajzero
0520791696 Adding transfer token feature
Transfer tokens
- Added transferToken: Users can directly transfer tokens (including FLO) to other registered users.
- Updated schema changes for the above requirement.
- Trade transactions and transfer transactions will generate a txid (using SHA256).

Other changes
- changed all signing type to lowercase
2022-03-12 02:25:31 +05:30
sairajzero
4434ad6b3e Support for SQL version 5.7 2022-02-18 22:23:17 +05:30
sairajzero
4416ab5ad3 Adding Blockchain refresh interval
- Added blockchain refresh interval
- Updating some constants
- Disabled various console.debug
2022-02-18 19:24:09 +05:30
sairajzero
15d36eb088 All Constants moved to _constants.js 2022-02-17 23:52:31 +05:30
sairajzero
a06c5b4c7b Backup Sync improvements
- Removed: Immutable table-type (Previously immutable tables are now considered as mutable tables in backup feature)
- Backup sync-data from master are temporally cached and then processed after receiving all sync-data
- Backup sync-data from cache are now processed in ordered manner (to prevent foreign key constrain error, repeated data, re-adding a deleted data)
- Updated SQL Schema
2022-02-08 06:26:03 +05:30
sairajzero
ab3df761b0 Bug fixes
- Fixed: SQL schema asset foreign key incorrectly referenced
- Fixed: initial rate of asset not loading correctly from DB
- Fixed: get-rate API returning [object Object] instead of rates
- Fixed: Bug where transaction-loop happens with 0 quantity
- Improved: spendAsset to use assets NULL/Non-NULL base correctly
- Fixed: minor typos, syntax errors and SQL query errors

User-pages:
- Added: UI fields for assets in Buy/Sell orders
- Updated: UI display of correct asset in listing orders and transactions
- Updated: localStorage keys are prefixed 'exchange-'
- Fixed: Rates and Balance amount not displayed correctly

Others:
- Added: temporary code for tracing output lines in set_globals.js (commented out by default)
2022-02-07 03:12:20 +05:30
sairajzero
048ab0667b Multi asset: initial price and other improvements
- Read blockchain for asset's initial price
- Transfer all tokens to new sink on master transfer

Other Improvements:
- Slave: close existing backup sync when master WS closes
- Updated SQL schema, updated SQL syntax as required
2022-02-05 20:23:36 +05:30
sairajzero
df69ee0f7b Multi-asset: User API 2022-02-04 02:54:05 +05:30
sairajzero
dbad25044a Multi-asset price.js 2022-02-03 05:46:26 +05:30
sairajzero
67c31d79a9 Multiple asset support
2 types of property:
1. Cash - main/central currency used for trading
2. Asset - (FLO/tokens) Can be brought or sold in the exchange market .

- Allow multiple tokens to act as asset in addition to FLO.
- Changes required for the above in deposits, withdraws, placing orders
- some code optimization in market.js
- Updated SQL schema
2022-02-02 04:17:47 +05:30
sairajzero
512dc3bcbc Automatically reload user page upon incorrect server
- Upon receiving responseError INCORRECT_SERVER_ERROR, reload the client page.
(Triggered mainly when master is changed).
- Fixed some minor syntax bugs
2022-01-26 21:46:19 +05:30
sairajzero
827bdcd793 Use sinkID for deposits
- Send Sink ID to users on get-account request
- In user page, store sink ID and use it for deposit FLO/Rupee
2022-01-26 16:08:30 +05:30
sairajzero
2c35c545e8 Bug fixes (client side)
Fixed Client page bugs:
- Fixed minor bugs in client side pages
- client page to use floGlobals.js
- moved KBucket.js to public (as its need by client page too).
Fixed Server Bugs:
- Added Access-Control-Allow-Origin to response headers
- Fixed: trustedIDs not loaded
- Fixed minor bugs (syntax errors)
2022-01-25 01:28:22 +05:30
sairajzero
9760710c18 Check session expiry on each request 2022-01-20 05:35:48 +05:30
sairajzero
348cc989c9 Custom session for distributed servers
- Adding custom session login for the distributed server system.
- Added Sessions table to backup
2022-01-18 05:11:34 +05:30
sairajzero
0b70f099b0 Update App Server
- Use App server port for Websocket Server.
- pause/resume serving and market when node acts as slave/master respectively.
2021-12-30 06:49:48 +05:30
sairajzero
946087481a Move transaction process to coupling.js 2021-12-06 20:55:35 +05:30
sairajzero
d3b27348ee Bug fix
- Fixed various bugs in the last update
- Added 'use strict'; to multiple files to prevent undeclared variables
2021-12-03 20:09:40 +05:30
sairajzero
5ac3316008 Allow trusted IDs to add/rm user tags via API 2021-11-18 15:58:40 +05:30
sairajzero
a7bab7ed6e Backup DB feature 2021-10-15 22:54:15 +05:30
sairajzero
8a014405f4 display current rate
Display FLO-INR rate in client page
2021-09-25 22:16:06 +05:30