Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add dao coin limit order transaction (deso-protocol#307)
* Add DAO Coin Limit Order network skeleton. (deso-protocol#239) * Add DAO Coin Limit Order constants. (deso-protocol#240) * Add DAO Coin Limit Order mempool skeleton. (deso-protocol#243) * Add DAO Coin Limit Order mempool skeleton. * Restore removed imports. * Side-step unused var error. * Add DAO Coin Limit Order blockchain skeleton. (deso-protocol#242) * Add DAO Coin Limit Order blockchain skeleton. * Restore removed imports. * Add DAO Coin Limit Order block view skeleton. (deso-protocol#241) * Add DAO Coin Limit Order block view skeleton. * Restore removed import. * Side-step unused var error. * Add DAO Coin Limit Order block view flush skeleton. (deso-protocol#244) * Add DAO coin limit order db prefixes. (deso-protocol#245) * Mf/add dao coin limit order key builders (deso-protocol#246) * Add DAO coin limit order key builders. * Use uint32s for enums. * Remove unnecessary line. * Mf/add dao coin limit order db utils (deso-protocol#247) * Add DAO coin limit order db utils. * Add FromBytes skeleton method. * Fix FromBytes operation happens in-place. * Mf/add dao coin limit order postgres skeleton (deso-protocol#248) * Add DAO coin limit order postgres skeleton. * Fix spacing/tabs. * Fix method call capitalization. * Convert uint256 types to strings. * Add DAO coin limit order network metadata. (deso-protocol#249) * Revert DAO coin limit order enums to uint8s. (deso-protocol#250) * Add DAO coin limit order connect transaction logic. (deso-protocol#259) * Mf/add dao coin limit order txn testing (deso-protocol#263) * Switch DAO coin order limit quantity to pointer. (deso-protocol#265) * Add more DAO coin limit order testing scenarios. (deso-protocol#267) * Convert DAO coin limit order price from BigFloat to Uint256. (deso-protocol#266) * Convert DAO coin price to uint256. * Complete conversion of DAO limit order price to uint256. * Use Lt, Gt instead of Cmp. * Start inverting price comparison logic. * add function to calculate total cost of an order (deso-protocol#268) * add function to calculate total cost of an order * Remove Conditional from DBGetMatchingDAOCoinBidOrders that didn't apply, Fix IsBetterAskThan and IsBetterBidThan (deso-protocol#269) * add check that order is better than last seen order when getting next orders to fill, fix txn metadata for m1's txn in test * use total cost calculating function to accurately get total cost of orders in blockchain.go, set prefixKey correctly for DBGetMatchingDAOCoinAskOrders Co-authored-by: Lazy Nina <[email protected]> * Mf/track dao coin limit order utxos (deso-protocol#270) * Track DAO coin limit order UTXOs. * Add disconnect logic. * Fix failing test. * Update lib/block_view_dao_coin_limit_order.go * Add DAO coin limit order postgres structs. (deso-protocol#271) * Add DAO coin limit order postgres structs. * Update dao coin limit order postgres migration. * Fill out LeftPaddedHexToUint256. * Add DAO coin limit order postgres tests. (deso-protocol#273) * Remove logging before flags error. (deso-protocol#274) * Fix DAO coin down migration. (deso-protocol#275) * Fix some postgres testing issues. (deso-protocol#277) * Add additional DAO coin limit order test and resolve bugs it surfaces. (deso-protocol#278) * Add additional DAO coin limit order testing. * Refactor block view to use db adapter for DAO coin limit orders. * Set up multi-order test. * Give m0 more initial in testing. * Fix failing txn spend amt test. * Fix updating order's quantity bug. * Add helper function to query for all orders. * Fix by transactor PKID prefix bug. * Mf/better dao coin limit order var naming (deso-protocol#279) * Refactor DAO coin limit order variable naming. * Rename order to matchingOrder. * Test DAO coin limit order total cost doesnt overflow validation. (deso-protocol#280) * Mf/allow dao coin limit order cancellations (deso-protocol#281) * Allow DAO coin limit order cancellations. * Fix failing postgres test. * Add more comments. * Add failing test to show no transactorPKID in index bug. * Update helper utils to new order schema. * Checkpoint. Store progress updating connect logic. * Another checkpoint. Stash progress in connect logic. * Commit checkpoint. Updated all of block view. * Start rebuilding tests. * Checkpoint. Continue updating tests. * Add back endpoint to query open orders by transactor PKID. * Add function to get all limit orders for a DAO coin pair. * Clean up postgres. * Convert price from uint256 to big.Float. * Add uint256 ScaledPrice field. * Continue turning back-on more tests. * Fix more tests. * Checkpoint. Continue fighting tests. * Continue fixing tests. * Fix last two tests. * Revised a lot of things, but mainly _connect logic. Let's have a meeting to discuss. * Convert PKID vars to PublicKeys. * Start fixing tests. * Fix tests by removing reflect.DeepEqual. * Switch buying and selling DAO coins back to PKIDs. * Fix a few more failing tests. * Must compare transactor buying qty to matching selling qty. * Continue fixing tests. * Get cancellation tests passing. * Only update orders within the same block height. * Fix small postgres bug. * Ln/dao coin limit order txindex (deso-protocol#283) * initial check in for txindex for dao coin limit orders * Use new struct to track fulfilled orders * update naming convention * Mf/add safe math uint256 utils (deso-protocol#285) * Add SafeMathUint256 utils. * Convert some DAO coin limit order math to safe math. * Save me some whitespace. * Mf/add safe math uint64 utils (deso-protocol#287) * Add SafeMathUint256 utils. * Convert some DAO coin limit order math to safe math. * Save me some whitespace. * Add SafeMathUint64 utils. * Update DAOCoinLimitOrderMetadata type so it can be serialized to json (deso-protocol#286) * Update DAOCoinLimitOrderMetadata type so it can be serialized to json * Re-autoformat comments * Address feedback on sorting slices * Address feedback in connect transaction function * Mf/add dao coin transfer restriction validations (deso-protocol#288) * Add DAO coin limit order transfer restriction validations. * Make a bit cleaner. * Keep full error message. * Add UTXO view API DAO coin limit order getters. (deso-protocol#290) * Add UTXO view API DAO coin limit order getters. * Make merging database and UTXO values more consistent. * Only compute order map key once. * Ln/dao coin limit order disconnect (deso-protocol#289) * Add temporary postgres DAO coin limit order solution. (deso-protocol#292) * Initial check in for spending limits on DAO Coin Limit Orders (deso-protocol#293) * Initial check in for spending limits on DAO Coin Limit Orders * add comments, rename key to DAOCoinLimitOrderLimitKey, initialize map in copy, add tests for spending limit on dao coin limit orders * Add additional DAO coin limit order tests. (deso-protocol#291) * Ln/dao coin limit order cancellation validations (deso-protocol#294) * Add additional DAO coin limit order tests. * fix infinite loop with last seen order, fix validations around cancellations, update tests Co-authored-by: mattfoley8 <[email protected]> * Address fixmes: add sanity checks and comments. Add isDeleted checks and new RuleErrors (deso-protocol#295) * Ln/dao coin limit order loop till filled (deso-protocol#296) * Loop until order is filled, fix db utils for getting next order, add more tests, fix copy DAOCoinLimitOrderEntry to not return error * leave comment in test for diamondhands * add balance checks in latest test * Diamondhands touch-ups * Add postgres CI whitelisted testing. (deso-protocol#298) * Add postgres CI whitelisted testing. * Run migrations before testing. * Map postgres port to localhost. * Empty commit to test caching dependencies. * Test migration rollbacks as well. * Add newline at EOF. * Mf/add additional dao coin order book tests (deso-protocol#299) * Add additional DAO coin order book tests. * Dont say bid/ask. * Add go-fmt to CI. (deso-protocol#300) * Add go-fmt to CI. * Fix failing gofmt error. * Address DH fixmes (deso-protocol#301) * Add another test. (deso-protocol#302) * Fix inputs from transactor to account for fee AND DESO spent purchasing DAO Coins, fix postgres, and add FeeNanos to txn metadata (deso-protocol#303) * Fix inputs from transactor to account for fee AND DESO spent purchasing DAO Coins, fix postgres, and add FeeNanos to txn metadata * Clone quantity to be safe * go fmt blockchain.go * always write utxo ops to badger (deso-protocol#304) * always write utxo ops to badger * run disconnect for pg * fix table name for dao coin limit order metadata * Add local postgres testing setup. (deso-protocol#305) * Make derived key txn construction accept a spending limit hex, not object (deso-protocol#297) (deso-protocol#306) * Make derived key txn construction accept a spending limit hex, not object * Update lib/block_view_derived_key.go * add exists declaration back. Co-authored-by: Lazy Nina <[email protected]> Co-authored-by: diamondhands0 <[email protected]> * Add fee nanos to the to bytes and from bytes logic for DAO Coin Limit Orders (deso-protocol#308) * Error if matching own order. (deso-protocol#309) * Make API getter functions public (deso-protocol#310) * Mf/add operation type column (deso-protocol#311) * Rename quantity to buy -> quantity to fill. * Checkpoint passing tests. * Get postgres tests working. * Add helper function and tests. * Continue adding tests for operation type quantity math. * Complete BID-BID calculation logic. * Build out ask-ask case. * Use named return values instead of a struct. * Allow for param specifying different transactor quantity to fill. * Implement logic in db_utils. * Refactor calculate test into own test. * Update blockchain.go w/ new quantity calculation. * Throw error if updating order w/ different operation type. * Update connection logic. * Fix failing derived key test. * Document off-by-one bug. * Add check on FeeNanos in DAO Coin Limit Order connect logic * Check for overflow before mutliplying fee nanos * revert changes to UpdateGlobalParams txn construction * Update w/ PR review feedback. * Make price calculators var naming a bit more consistent. * Remove DAO prefix from filled order struct qty fields. * Empty commit to trigger CI. * Fix off-by-one bug. * Fix floating point issues in tests, and implement fixed-point conversion scheme * Some touch-ups to the order matching logic. * Add a FIXME for an ultimate sanity-check in _connectDAOCoinLimitOrder * Add money printer prevention validation. * WIP - fix prevBalances, but sanity-check fails * Fix prevBalances bug and fix sanity-check after * Resolve merge conflicts. * Fix tests with a workaround on fee computation * diamondhands holy tidy pass * Fix failing postgres test. Co-authored-by: lazynina <[email protected]> Co-authored-by: diamondhands <[email protected]> * Add DAO coin limit order blockheight validation. (deso-protocol#314) * Add DAO coin limit order blockheight validation. * Empty commit to retrigger CI. * Set DAO coin limit order block height in derived key test. * Fix get next orders to fill qty check. (deso-protocol#315) * Add some cosmetic updates. (deso-protocol#316) * don't return error from functions that don't generate errors (deso-protocol#318) * TotalInput and TotalOutput should consider inputs and outputs to/from bidders and difference should equal fee (deso-protocol#317) * TotalInput and TotalOutput should consider inputs and outputs to/from bidders and difference should equal fee * Update lib/block_view_dao_coin_limit_order.go Co-authored-by: Matt Foley <[email protected]> * Update lib/block_view_dao_coin_limit_order.go Co-authored-by: Matt Foley <[email protected]> Co-authored-by: Matt Foley <[email protected]> * Test submitting ASK order and matching existing BID. (deso-protocol#319) Co-authored-by: Lazy Nina <[email protected]> Co-authored-by: diamondhands <[email protected]> Co-authored-by: iamsofonias <[email protected]> Co-authored-by: diamondhands0 <[email protected]> Co-authored-by: lazynina <[email protected]>
- Loading branch information