From c465667ec13ba21bc6b7d8f1d948ae5598c77923 Mon Sep 17 00:00:00 2001 From: bexan Date: Fri, 20 Sep 2024 07:03:35 +0200 Subject: [PATCH] feat(sana): store price when saving a sale event (#461) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description 1. store price of sale ## What type of PR is this? (check all applicable) - [ ] 🍕 Feature (`feat:`) - [ ] 🐛 Bug Fix (`fix:`) - [ ] 📝 Documentation Update (`docs:`) - [ ] 🎨 Style (`style:`) - [ ] 🧑‍💻 Code Refactor (`refactor:`) - [ ] 🔥 Performance Improvements (`perf:`) - [ ] ✅ Test (`test:`) - [ ] 🤖 Build (`build:`) - [ ] 🔁 CI (`ci:`) - [ ] 📦 Chore (`chore:`) - [ ] ⏩ Revert (`revert:`) - [ ] 🚀 Breaking Changes (`BREAKING CHANGE:`) ## Related Tickets & Documents ## Added tests? - [ ] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help ## Added to documentation? - [ ] 📜 README.md - [ ] 📓 Documentation - [ ] 🙅 no documentation needed ## [optional] Are there any post-deployment tasks we need to perform? ## [optional] What gif best describes this PR or how it makes you feel? ### PR Title and Description Guidelines: - Ensure your PR title follows semantic versioning standards. This helps automate releases and changelogs. - Use types like `feat:`, `fix:`, `chore:`, `BREAKING CHANGE:` etc. in your PR title. - Your PR title will be used as a commit message when merging. Make sure it adheres to [Conventional Commits standards](https://www.conventionalcommits.org/). ## Closing Issues --- crates/sana/src/storage/sqlx/default_storage.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/sana/src/storage/sqlx/default_storage.rs b/crates/sana/src/storage/sqlx/default_storage.rs index 434c222e..34725c2f 100644 --- a/crates/sana/src/storage/sqlx/default_storage.rs +++ b/crates/sana/src/storage/sqlx/default_storage.rs @@ -268,8 +268,8 @@ impl Storage for PostgresStorage { return Ok(()); } - let q = "INSERT INTO token_event (token_event_id, contract_address, chain_id, token_id, token_id_hex, event_type, block_timestamp, transaction_hash, to_address, from_address) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) ON CONFLICT (token_event_id) DO NOTHING"; + let q = "INSERT INTO token_event (token_event_id, contract_address, chain_id, token_id, token_id_hex, event_type, block_timestamp, transaction_hash, to_address, from_address, amount) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) ON CONFLICT (token_event_id) DO NOTHING"; let event_type = self.to_title_case(&event.event_type.to_string().to_lowercase()); @@ -284,6 +284,7 @@ impl Storage for PostgresStorage { .bind(event.transaction_hash.clone()) .bind(event.to_address.clone()) .bind(event.from_address.clone()) + .bind(event.price.clone()) .execute(&self.pool) .await?;