Releases: Privex/cryptotoken-converter
v1.5.0 - Telos support + fixes
- Re-factored EOSMixin, EOSLoader, and EOSManager to use the new static attributes
chain
,chain_type
, andchain_coin
- allowing for painless
sub-classing for EOS forks.- Moved URL generation code out of EOSMixin.url into EOSMixin._make_url to allow for other methods to generate URLs
- Added
replace_eos
method for replacing the Cleos instance, e.g. when a new RPC URL needs to be used - Adjusted many methods to use
chain
chain_type
andchain_coin
instead of hard coded 'eos' / 'EOS' to make sub-classing for forks easier - Added
current_rpc
attribute, enabling the ability to check what RPC is currently being used by the Cleos instance
- Created Telos handler and enabled it by default. Mostly stub code which just sets the chain/chain_type/chain_coin so the EOS handler uses it correctly
- Improved the EOSLoader list_txs so that it can change the RPC for different tokens if needed
- Added
enabled=True
to all handler__init__
files, to prevent handlers trying to load disabled coins and erroring - Changed
dotenv.read_dotenv
todotenv.load_env
(apparently a different dotenv package is being used now?)
Version 1.2 - Support for sending/receiving Bitshares assets
Thanks to @bt-cryptomancer we now have support for Bitshares assets using the new Bitshares coin handler. (PR: #4 Bitshares coin handler v1)
This release has now been tagged to the stable
branch.
Bitshares
- Ability to send tokens on the Bitshares network
- Ability to receive tokens on the Bitshares network
- Automatic decryption of memos using the
CryptoKeyPair
system, as long as the privatememo
key for thebitshares
network is entered. - RPC node selection using the
.env
variableBITSHARES_RPC_NODE
. The recommended node as of today iswss://bitshares.openledger.info/ws
- Works with the Coin Pair system for automated conversion between a pair of coins (on the same, or different networks).
Minor Fixes
- Bumped Django version for security
- Removed strict
==
for some packages inrequirements.txt
to ensure they stay up to date - Fixed bug with
SteemEngineManager
health check, now checks if the get_token result is None and shows an appropriate error in the Coin Health admin dashboard.
Support for issuing EOS tokens + clean up / fixes
EOS Improvements / Feature additions
- Added
issue
to EOSManager for issuing EOS tokens - Added customised
send_or_issue
to EOSManager, ensuring tokens are issued to our own account first, and then sent to the end user - Refactored parts of
EOSManager.send
into:get_privkey
- Find and decrypt a private key for a given account, optionally filtering by key typevalidate_amount
- Validate and sanitise EOS amounts (4 DP), and optionally check we have enough balancebuild_tx
- Builds an EOS contract transaction, finds private key forsender
, signs it, and broadcasts it.
- Fixed bug with
EOSMixin.eos_settings
- EOSManager previously would not respect RPC node settings from the database
as it wouldn't load theEOS
coin if another token symbol was selected. EOSManager.address_valid
now takes multiple addresses (instead of just one) as positional argumentsEOSManager.address_valid_ex
throws AccountNotFound instead of a boolean response, allowing you to know which account
isn't valid, and reduce dependence onif x.address_valid(y)
- instead just using try/except.
Other fixes / improvements
- Moved SteemManager's
self.asset
andself.precision
into properties. They were causing slowdowns due to constantly
querying for assets and their precision every time the manager class was reloaded. - Added customised send_or_issue (copied from EOSManager) to
SteemEngineManager
which issues the token to the issuer
before sending, instead of issuing directly to the user (some problems with issuing directly, including the lack of memos...) - Improved comments including more PyDoc comment blocks.
- General cleanup, including removing some old code that was commented out
Support for EOS deposits / withdrawals + encrypted private key storage
EOS Support - Deposits and Withdrawals
- Created EOS coin handler (enabled by default)
- EOSMixin - contains shared code between loader/manager such as the
Cleos
instance,
default contracts etc. - EOSLoader - Loads
actions
for a given EOS account, cleans them into Deposit format,
support for EOS tokens - EOSManager - For sending EOS, username validation and checking account balances
(uses new private key store functionality)
- EOSMixin - contains shared code between loader/manager such as the
- Added requirement for
libeospy
by EOS NYC, used for interacting with EOS nodes - EOS node settings can be configured from database using a Coin with the symbol
EOS
- Tokens can be added by setting the coin type to "EOS Token" from admin
- Tokens without a default in
EOSMixin
MUST have a settings JSON containing the EOS
contract account, e.g.{"contract": "eosio.token"}
- If no node is configured, uses https://eos.greymass.com:443 by default
Encrypted private key storage in the database
- CryptoKeyPair model for storing public/private keys in the database, for coins without a decent wallet API
- Private keys are encrypted with AES-128 using Fernet when a CryptoKeyPair is saved
- Admin page for adding new key pair's, private keys are only shown in encrypted form from the panel
- Management command for generating a new encryption key
General Cleanup and improvements
- Copied a lot of the BitcoinMixin code into SettingsMixin and generic-ified it for use in all
coin handlers.- SettingsMixin allows for both coin loaders and managers to easily access their Coin's
settings, as well as automatically merging in any settings from settings.COIND_RPC
(can be disabled by overridinguse_coind_settings
from child class) - TODO: BitcoinMixin should now extend SettingsMixin and only override the methods/attributes
it needs to.
- SettingsMixin allows for both coin loaders and managers to easily access their Coin's
- The
load_txs
command now has a--coins
option, so you can scan only specified coins,
e.g../manage.py load_txs --coins LTC,EOS
- Added new exception
MissingTokenMetadata
for coin handlers that require metadata such as an account
to send/receive from, or custom settings like a contract - Refactored coin handler exceptions so they all extend
CoinHandlerException
for blanket catching all
coin handler specific exceptions - The shared
Steem
instance now has call retries capped at 5 attempts, and a lower timeout of
20s (instead of default 60s). This will help prevent any permanent hanging caused by bad nodes. - Various other small cleanups and fixes
Support for STEEM/SBD, Steem forks, plus various reliability improvements
Full change list:
-
Created Steem coin handler
SteemManager
supports sending, balance checking (plus memo balances), health checks,
customizable RPC nodes per coin (possibly works with Steem forks), and account validationSteemLoader
loads transfer history for a Coin's Steem account, properly parses STEEM/SBD
amounts with no floating point problems, filters out transactions from ourselves etc.- Dynamic coin support, using new coin type "Steem Network" (
steembase
), which may allow
certain Steem forks such as GOLOS, Whaleshares to work out of the box.
-
Reliability fixes for transaction scanning
- Memo's can now be up to 1000 chars (prev. 255) in the DB
- Address's can now be up to 255 chars (prev. 100) in the DB
- Each Deposit is now inserted with a sub-transaction, fixing a potential issue where one bad
transaction would cause all added Deposits to be rolled back and rejected. commands.load_txs
now uses Loader's defaulttx_count
instead of statically set to 1000
-
Steem coin handler is now enabled by default
-
All handler classes now set Decimal to use
ROUND_DOWN
for safety. -
Fixed
Coin
config table for Bitcoin handler in documentation -
Added Steem coin handler to docs, which explains configuration options, with example for the
custom JSON field settings, and various usage info. -
Various other small fixes and improvements
Ability to notify via email when hot wallets are low, destination memo support, convert_coins refactoring, plus more
-
Add example env file with the most common env options
-
Added
notify_low_funds
,funds_low
andlast_notified
to Coin model -
Added new deposit status
mapped
- meaning we know the destination details
but it has not been converted yet, and could still fail -
Add email configuration to settings, with new env vars
-
Notify ADMINS if a deposit failed to convert due to low wallet balance
-
Refactored
convert_coins.py
to be two stages (so that low balance email
can semi-accurately tell you how many deposits are stuck)- First stage, deposits are validated, e.g. do they have a valid deposit
address, or a memo for us to map it to a conversion? - Second stage, validated deposits are converted, and conversion object created
- First stage, deposits are validated, e.g. do they have a valid deposit
-
Cache get_token request in
SteemEngineLoader
to prevent spamming API for
same token for every single deposit. -
Ignore deposits from
market
inSteemEngineLoader
-
Text after the destination address in a deposit memo should now be used for
the destination memo -
Clean up logging - commented out un-necessary debug logging, and don't use
spammylog.exception
when we know why the exception happened (e.g. coin daemon dead) -
Probably various small fixes and comment cleanup
steemengine/settings.py is now a Python module, split logging into web and crons, plus reliability improvements to Coin Handlers
Updates since Version 1.0.2:
Commits: 54399be8
12834ca
ee69b41
71d5908
- NEW PACKAGE - Django-CORS is now used to enable cross-origin requests for the REST API
- Two new
.env
settings -CORS_ORIGIN_ALLOW_ALL
andCORS_ORIGIN_WHITELIST
(by default, all cross-origin requests are allowed, whitelist is disabled)
- Two new
Commit: fcc39e5
-
steemengine/settings.py
is now a modulesteemengine/settings/*.py
to help separate core Django settings, from the app's own settings- All settings module files have a docstring at the start, describing what
.env
vars are
used by them, their default, and what they actually do. - The settings module has been properly added to the documentation (
docs
folder).
- All settings module files have a docstring at the start, describing what
-
Logs are now split between
logs/web
andlogs/crons
to make it easier
to track where an error occurred. -
Various small changes to the default logging setup and settings
-
Fixed
has_loader
function in payments.coin_handlers -
Reliability improvements to Coin Handlers:
-
New base exception:
DeadAPIError
- for informing the calling code that
a necessary API is not functioning it should skip this loader/manager. -
decorators.retry_on_error
now allows a list of exceptionsfail_on
to be specified, if a listed exception is thrown by the wrapped function,
retry_on_error will stop retrying and re-raise the caught exception immediately. -
BitcoinLoader makes use of the new
fail_on
list, connection errors are now caught
and thrown asDeadAPIError
, avoiding wasted time re-trying an obviously dead daemon.
-
Commit: e6d53b37
post-release quick bug fix for default logger
Hyperlinked Coin Pair API, privex footer on API, plus API root for browsing
- Added Privex footer to DRF API browser
- Created API index at /api/ for browsing the API
- Coin Pair API (/api/pairs) now returns
from_coin
/to_coin
as hyperlinks- If you only care about the symbol, it still returns the symbols, but as from/to_coin_symbol
- Updated API docs for /api/pairs
View status of Coin's via the admin panel, plus various small changes
-
Add
health
function to coin_handlers.base.BaseManager - if children don't implement it,
it defaults to a list of symbols, with status "Health data not supported".
Child classes are able to customise the table columns to fit their specific needs. -
Implemented
health
method for both SteemEngineManager and BitcoinManager -
Created a "Coin Handler Health/Status" admin panel view, which lists health/status
information about each coin in the database, using thehealth
method of it's
Manager class. -
Created a "clear caches" view, allowing admin's to clear the Django cache backend. Currently
only used by the Coin Handler status view. -
Override Django admin's base_site.html and index.html
- Changed admin title to CryptoToken Converter Admin
- Added a custom pages table, with a link to "Coin Handler Health/Status"
-
Extended Django admin site class to add custom URLs
-
Better comments for settings.py, with some general clean-up of the file.