In case the wallet sync fails, we replace the value with `None` to
indicate to the UI that we don't have an up-to-date wallet information.
In case the sync works again at some point, we will replace it with
`Some` again.
Making this optional also allows us to start up the system without
syncing the wallet, a step towards https://github.com/itchysats/itchysats/discussions/753.
796: Introduce short-lived `rollover_taker::Actor` r=luckysori a=luckysori
Very similar to the other ones we've done.
Things to consider:
- Shall we consolidate the usage of "rollover" over "roll over" across the entire codebase? I don't think I have been able to stay consistent even in this PR :(
- I've added an `OrderId` to the `wire::MakerToTaker::ConfirmRollOver` message, because the maker could be talking about more than one rollover.
- The `taker_cfd::Actor` no longer handles the raw `wire::MakerToTaker` enumeration of messages 🎉 After creating all these short-lived actors it only needs to handle a dedicated `CurrentOrder` message originating from the maker.
- Error handling is worth reviewing in detail as I've messed that up in previous related PRs.
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
802: Settle CFDs every 2h r=bonomat a=bonomat
Temporarily reduce the settlement interval to 2h to accelerate testing.
Co-authored-by: bonomat <philipp@hoenisch.at>
789: Simplify wallet actor r=thomaseizinger a=thomaseizinger
We don't need to `Clone` the wallet actor ever so we can remove this
custom derive which allows us to also drop the `Arc<Mutex>` of the
`bdk::Wallet`, thus simplifying all of the handlers quite a bit.
We also add `&mut` to all handlers. Even though not strictly necessary
(because they are processed by `xtra-productivity`), it is more correct
to write `&mut self` because that is what the macro will output anyway.
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
795: Allow projection actor to retrieve latest Cfd state itself from DB r=klochowicz a=klochowicz
Instead of retrieving Cfds inside Cfd actors, send a msg that they changed and
retrieve them by the projection actor itself.
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
This should prevent accidential double-spends of our own inputs
when doing concurrent contract setups or other interactions of the
wallet.
We only store these in-memory, thus a simple restart of the application
will "unlock" a UTXO in case it was previously marked used but the
transaction never made it to the blockchain for whatever reason.
Resolves#790.
We don't need to `Clone` the wallet actor ever so we can remove this
custom derive which allows us to also drop the `Arc<Mutex>` of the
`bdk::Wallet`, thus simplifying all of the handlers quite a bit.
We also add `&mut` to all handlers. Even though not strictly necessary
(because they are processed by `xtra-productivity`), it is more correct
to write `&mut self` because that is what the macro will output anyway.
786: Introduce `cargo dev-maker` and `cargo dev-taker` aliases for easier local development r=thomaseizinger a=thomaseizinger
We have some duplication of how to run the development maker and taker locally.
Use cargo aliases to clean up this duplication and make it easier to run them outside of the `start_all.sh` script.
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
792: Update README r=klochowicz a=klochowicz
Refer to the commits' descriptions for more info
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
794: Release version 0.2.0 r=da-kami a=itchymax
Hi `@da-kami!`
This PR was created in response to a manual trigger of the release workflow here: https://github.com/itchysats/itchysats/actions/runs/1533991015.
I've bumped the versions in the manifest files in this commit: 88f64a0bba.
Merging this PR will create a GitHub release and publish the library to crates.io!
Co-authored-by: itchymax <itchymax@protonmail.com>
747: Bump bdk from 0.13.0 to 0.14.0 r=thomaseizinger a=dependabot[bot]
Bumps [bdk](https://github.com/bitcoindevkit/bdk) from 0.13.0 to 0.14.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/bitcoindevkit/bdk/releases">bdk's releases</a>.</em></p>
<blockquote>
<h2>Release 0.14.0</h2>
<p>Notable changes in this release include adding a new method to <code>TxBuilder</code> to embed data in a transaction vai <code>OP_RETURN</code> and updating the <code>Database</code> trait to store the last sync timestamp and block height. Other internal improvements include a change in the <code>keys</code> module dependencies from <code>tiny-bip39</code> to using <code>rust-bip39</code>, renaming <code>ConfirmationTime</code> to <code>BlockTime</code> to more clearly describe the data that struct contains, and using a borrowed transaction when broadcasting. And finally we have updated our integration test framework to verify support for <strong>sending to</strong> Taproot addresses 🥕 ! See below for all the details:</p>
<h2>What's Changed</h2>
<ul>
<li>Fix/ci update 1.56 by <a href="https://github.com/afilini"><code>`@afilini</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/454">bitcoindevkit/bdk#454</a></li>
<li>Borrow instead of moving transaction when broadcasting by <a href="https://github.com/klochowicz"><code>`@klochowicz</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/452">bitcoindevkit/bdk#452</a></li>
<li>Release/0.13.0 by <a href="https://github.com/notmandatory"><code>`@notmandatory</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/453">bitcoindevkit/bdk#453</a></li>
<li>Use rust-bip39 instead of tiny-bip39 by <a href="https://github.com/rajarshimaitra"><code>`@rajarshimaitra</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/462">bitcoindevkit/bdk#462</a></li>
<li>Update codecov@v2 by <a href="https://github.com/rajarshimaitra"><code>`@rajarshimaitra</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/458">bitcoindevkit/bdk#458</a></li>
<li>Post bip39 updates by <a href="https://github.com/rajarshimaitra"><code>`@rajarshimaitra</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/464">bitcoindevkit/bdk#464</a></li>
<li>Add data as output (via OP_RETURN) by <a href="https://github.com/RCasatta"><code>`@RCasatta</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/460">bitcoindevkit/bdk#460</a></li>
<li>Store the last sync time and block height by <a href="https://github.com/afilini"><code>`@afilini</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/459">bitcoindevkit/bdk#459</a></li>
<li>[test] add tests to verify support for sending to bech32m address by <a href="https://github.com/sandipndev"><code>`@sandipndev</code></a>` in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/402">bitcoindevkit/bdk#402</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/klochowicz"><code>`@klochowicz</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/452">bitcoindevkit/bdk#452</a></li>
<li><a href="https://github.com/sandipndev"><code>`@sandipndev</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/bitcoindevkit/bdk/pull/402">bitcoindevkit/bdk#402</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/bitcoindevkit/bdk/compare/v0.13.0...v0.14.0">https://github.com/bitcoindevkit/bdk/compare/v0.13.0...v0.14.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/bitcoindevkit/bdk/blob/v0.14.0/CHANGELOG.md">bdk's changelog</a>.</em></p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c175dd2aae"><code>c175dd2</code></a> Bump version to 0.14.0</li>
<li><a href="6b1cbcc4b7"><code>6b1cbcc</code></a> Bump version to 0.14.0-rc.1</li>
<li><a href="afa1ab4ff8"><code>afa1ab4</code></a> Fix blockchain_tests::test_send_to_bech32m_addr</li>
<li><a href="632422a3ab"><code>632422a</code></a> Added wallet blockchain test to send to Bech32m address</li>
<li><a href="54f61d17f2"><code>54f61d1</code></a> Added a wallet unit test to send to a Bech32m address</li>
<li><a href="5830226216"><code>5830226</code></a> [database] Wrap <code>BlockTime</code> in another struct to allow adding more</li>
<li><a href="2c77329333"><code>2c77329</code></a> Rename <code>ConfirmationTime</code> to <code>BlockTime</code></li>
<li><a href="3e5bb077ac"><code>3e5bb07</code></a> Update CHANGELOG.md</li>
<li><a href="7c06f52a07"><code>7c06f52</code></a> [wallet] Store the block height and timestamp after syncing</li>
<li><a href="12e51b3c06"><code>12e51b3</code></a> [wallet] Expose an immutable reference to a wallet's database</li>
<li>Additional commits viewable in <a href="https://github.com/bitcoindevkit/bdk/compare/v0.13.0...v0.14.0">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=bdk&package-manager=cargo&previous-version=0.13.0&new-version=0.14.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
784: Bump rust_decimal_macros from 1.17.0 to 1.18.0 r=thomaseizinger a=dependabot[bot]
Bumps [rust_decimal_macros](https://github.com/paupino/rust-decimal) from 1.17.0 to 1.18.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="6766bafb3a"><code>6766baf</code></a> Version 1.18.0 (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/447">#447</a>)</li>
<li><a href="b4e72bccc0"><code>b4e72bc</code></a> Add MySQL support for Diesel (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/446">#446</a>)</li>
<li><a href="2f2d0fbe46"><code>2f2d0fb</code></a> Fixes integer handling in Decimal::to_f64 by expanding range (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/443">#443</a>)</li>
<li><a href="9b6a1cefe0"><code>9b6a1ce</code></a> Add support for Rocket forms (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/445">#445</a>)</li>
<li>See full diff in <a href="https://github.com/paupino/rust-decimal/compare/1.17.0...1.18.0">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rust_decimal_macros&package-manager=cargo&previous-version=1.17.0&new-version=1.18.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
788: Upgrade to Rust 1.57 r=thomaseizinger a=thomaseizinger
The clippy version included with 1.57 flagged several problems:
1. Multiple fields were never read, removed those.
2. The `Default` impl on `Tasks` could be derived.
3. A redundant closure
4. A large enum variant
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
The clippy version included with 1.57 flagged several problems:
1. Multiple fields were never read, removed those.
2. The `Default` impl on `Tasks` could be derived.
3. A redundant closure
4. A large enum variant
- Remove dummy transaction and txid (use the transactions received in the
messages instead
- extract helpers for quote and price to prevent misalignments in tests
- extend contract setup to finish at Open state of the cfd
783: Remove unnecessary default arguments r=thomaseizinger a=thomaseizinger
This is legacy, we don't want any defaults here.
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
765: Setup maker actor r=luckysori a=luckysori
Tests are still failing, but I think it's close, so take a look if you can.
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
782: Use `xtra-productivty` for `TakeOffer` r=thomaseizinger a=thomaseizinger
This reduces one layer of indirection.
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Bitmex only allows buy/sell orders in increments of 100 USD. In order to
simplify the hedging calculation for the maker we keep quantity the same
as Bitmex.
777: Bump rust_decimal from 1.17.0 to 1.18.0 r=bonomat a=dependabot[bot]
Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.17.0 to 1.18.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="6766bafb3a"><code>6766baf</code></a> Version 1.18.0 (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/447">#447</a>)</li>
<li><a href="b4e72bccc0"><code>b4e72bc</code></a> Add MySQL support for Diesel (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/446">#446</a>)</li>
<li><a href="2f2d0fbe46"><code>2f2d0fb</code></a> Fixes integer handling in Decimal::to_f64 by expanding range (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/443">#443</a>)</li>
<li><a href="9b6a1cefe0"><code>9b6a1ce</code></a> Add support for Rocket forms (<a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/445">#445</a>)</li>
<li>See full diff in <a href="https://github.com/paupino/rust-decimal/compare/1.17.0...1.18.0">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rust_decimal&package-manager=cargo&previous-version=1.17.0&new-version=1.18.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
778: Bump reqwest from 0.11.6 to 0.11.7 r=bonomat a=dependabot[bot]
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.6 to 0.11.7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/releases">reqwest's releases</a>.</em></p>
<blockquote>
<h2>v0.11.7</h2>
<ul>
<li>Add <code>blocking::ClientBuilder::resolve()</code> option, matching the async builder.</li>
<li>Implement <code>From<tokio::fs::File></code> for <code>Body</code>.</li>
<li>Fix <code>blocking</code> request-scoped timeout applying to bodies as well.</li>
<li>(wasm) Fix request bodies using multipart vs formdata.</li>
<li>Update internal <code>rustls</code> to 0.20.</li>
</ul>
<h2>New Contributors ❤️</h2>
<ul>
<li><a href="https://github.com/jeschkies"><code>`@jeschkies</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/pull/1362">seanmonstar/reqwest#1362</a></li>
<li><a href="https://github.com/niuhuan"><code>`@niuhuan</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/pull/1384">seanmonstar/reqwest#1384</a></li>
<li><a href="https://github.com/BiagioFesta"><code>`@BiagioFesta</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/pull/1388">seanmonstar/reqwest#1388</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md">reqwest's changelog</a>.</em></p>
<blockquote>
<h2>v0.11.7</h2>
<ul>
<li>Add <code>blocking::ClientBuilder::resolve()</code> option, matching the async builder.</li>
<li>Implement <code>From<tokio::fs::File></code> for <code>Body</code>.</li>
<li>Fix <code>blocking</code> request-scoped timeout applying to bodies as well.</li>
<li>(wasm) Fix request bodies using multipart vs formdata.</li>
<li>Update internal <code>rustls</code> to 0.20.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="17890f8c2f"><code>17890f8</code></a> v0.11.7</li>
<li><a href="d73d961166"><code>d73d961</code></a> fix blocking client to use request timeout for response body (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1395">#1395</a>)</li>
<li><a href="8b37ae4b15"><code>8b37ae4</code></a> Support to rustls 0.20 (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1388">#1388</a>)</li>
<li><a href="8fe22c4885"><code>8fe22c4</code></a> Remove direct dependency on the time crate (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1390">#1390</a>)</li>
<li><a href="161d731892"><code>161d731</code></a> add resolve to blocking client (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1384">#1384</a>)</li>
<li><a href="0ef1a2ea78"><code>0ef1a2e</code></a> wasm: fix standalone/multipart body conversion to JsValue (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1364">#1364</a>)</li>
<li><a href="ab49de875e"><code>ab49de8</code></a> Body from tokio::fs::File (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1360">#1360</a>)</li>
<li><a href="be8ab7b951"><code>be8ab7b</code></a> docs: provide basic auth example (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1362">#1362</a>)</li>
<li>See full diff in <a href="https://github.com/seanmonstar/reqwest/compare/v0.11.6...v0.11.7">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=reqwest&package-manager=cargo&previous-version=0.11.6&new-version=0.11.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>