Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:KomodoPlatform/komodo-defi-framework…
Browse files Browse the repository at this point in the history
… into get-peer-rpc
  • Loading branch information
onur-ozkan committed Sep 24, 2024
2 parents 5605a00 + 5c324f2 commit 0d46b36
Show file tree
Hide file tree
Showing 74 changed files with 4,321 additions and 3,709 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:

- name: Test
run: |
wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.sh | bash
wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/v0.8.1/zcutil/fetch-params-alt.sh | bash
cargo test --test 'docker_tests_main' --features run-docker-tests --no-fail-fast
wasm:
Expand Down
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ opt-level = 3
strip = true
codegen-units = 1
# lto = true
panic = "abort"

[profile.test]
# required to avoid a long running process of librustcash additional chain validation that is enabled with debug assertions
debug-assertions = false
panic = 'unwind'

[profile.dev]
opt-level = 0
Expand All @@ -74,4 +70,4 @@ incremental = true
codegen-units = 256

[profile.release.package.mocktopus]
opt-level = 1 # TODO: MIR fails on optimizing this dependency, remove that..
opt-level = 1 # TODO: MIR fails on optimizing this dependency, remove that..
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<img src="https://img.shields.io/github/downloads/komodoplatform/komodo-defi-framework/total" alt="downloads">
</a>
<a href="https://github.com/komodoplatform/komodo-defi-framework/">
<img src="https://img.shields.io/github/last-commit/komodoplatform/komodo-defi-framework" alt="last commit">
<img src="https://img.shields.io/github/last-commit/komodoplatform/komodo-defi-framework/dev" alt="last commit">
</a>
<a href="https://github.com/komodoplatform/komodo-defi-framework/pulse" alt="Activity">
<img src="https://img.shields.io/github/commit-activity/m/komodoplatform/komodo-defi-framework" />
<img src="https://img.shields.io/github/commit-activity/m/komodoplatform/komodo-defi-framework/dev" />
</a>
<br/>
<a href="https://github.com/komodoplatform/komodo-defi-framework/issues">
Expand Down Expand Up @@ -48,7 +48,7 @@

## What is the Komodo DeFi Framework?

The Komodo DeFi Framework is open-source [atomic-swap](https://komodoplatform.com/en/academy/atomic-swaps/) software for seamless, decentralised, peer to peer trading between almost every blockchain asset in existence. This software works with propagation of orderbooks and swap states through the [libp2p](https://libp2p.io/) protocol and uses [Hash Time Lock Contracts (HTLCs)](https://en.bitcoinwiki.org/wiki/Hashed_Timelock_Contracts) for ensuring that the two parties in a swap either mutually complete a trade, or funds return to thier original owner.
The Komodo DeFi Framework is open-source [atomic-swap](https://komodoplatform.com/en/academy/atomic-swaps/) software for seamless, decentralized, peer to peer trading between almost every blockchain asset in existence. This software works with propagation of orderbooks and swap states through the [libp2p](https://libp2p.io/) protocol and uses [Hash Time Lock Contracts (HTLCs)](https://en.bitcoinwiki.org/wiki/Hashed_Timelock_Contracts) for ensuring that the two parties in a swap either mutually complete a trade, or funds return to thier original owner.

There is no 3rd party intermediary, no proxy tokens, and at all times users remain in sole possession of their private keys.

Expand Down Expand Up @@ -172,7 +172,7 @@ Refer to the [Komodo Developer Docs](https://developers.komodoplatform.com/basic

## Project structure

[mm2src](mm2src) - Rust code, contains some parts ported from C `as is` (e.g. `lp_ordermatch`) to reach the most essential/error prone code. Some other modules/crates are reimplemented from scratch.
[mm2src](mm2src) - Rust code, contains some parts ported from C `as is` (e.g. `lp_ordermatch`) to reach the most essential/error-prone code. Some other modules/crates are reimplemented from scratch.


## Additional docs for developers
Expand All @@ -185,8 +185,8 @@ Refer to the [Komodo Developer Docs](https://developers.komodoplatform.com/basic

## Disclaimer

This repository contains the `work in progress` code of the brand new Komodo DeFi Framework (kdf) built mainly on Rust.
The current state can be considered as a alpha version.
This repository contains the `work in progress` code of the brand-new Komodo DeFi Framework (kdf) built mainly on Rust.
The current state can be considered as an alpha version.

**<b>WARNING: Use with test coins only or with assets which value does not exceed an amount you are willing to lose. This is alpha stage software! </b>**

Expand Down
4 changes: 4 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[disallowed-methods]]
path = "futures::future::Future::wait"
replacement = "common::block_on_f01"
reason = "Use the default KDF async executor."
11 changes: 8 additions & 3 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ enable-solana = [
]
enable-sia = [
"dep:reqwest",
"blake2b_simd"
"dep:blake2b_simd",
"dep:sia-rust"
]
default = []
run-docker-tests = []
Expand All @@ -41,13 +42,14 @@ byteorder = "1.3"
bytes = "0.4"
cfg-if = "1.0"
chain = { path = "../mm2_bitcoin/chain" }
chrono = { version = "0.4.23", "features" = ["serde"] }
common = { path = "../common" }
cosmrs = { version = "0.14.0", default-features = false }
crossbeam = "0.8"
crypto = { path = "../crypto" }
db_common = { path = "../db_common" }
derive_more = "0.99"
ed25519-dalek = "1.0.1"
ed25519-dalek = { version = "1.0.1", features = ["serde"] }
enum_derives = { path = "../derives/enum_derives" }
ethabi = { version = "17.0.0" }
ethcore-transaction = { git = "https://github.com/KomodoPlatform/mm2-parity-ethereum.git", rev = "mm2-v2.1.1" }
Expand All @@ -69,13 +71,14 @@ jsonrpc-core = "18.0.0"
keys = { path = "../mm2_bitcoin/keys" }
lazy_static = "1.4"
libc = "0.2"
nom = "6.1.2"
mm2_core = { path = "../mm2_core" }
mm2_err_handle = { path = "../mm2_err_handle" }
mm2_event_stream = { path = "../mm2_event_stream" }
mm2_git = { path = "../mm2_git" }
mm2_io = { path = "../mm2_io" }
mm2_metrics = { path = "../mm2_metrics" }
mm2_net = { path = "../mm2_net" }
mm2_net = { path = "../mm2_net", features = ["p2p"] }
mm2_number = { path = "../mm2_number"}
mm2_rpc = { path = "../mm2_rpc" }
mm2_state_machine = { path = "../mm2_state_machine" }
Expand All @@ -101,8 +104,10 @@ ser_error_derive = { path = "../derives/ser_error_derive" }
serde = "1.0"
serde_derive = "1.0"
serde_json = { version = "1", features = ["preserve_order", "raw_value"] }
serde_with = "1.14.0"
serialization = { path = "../mm2_bitcoin/serialization" }
serialization_derive = { path = "../mm2_bitcoin/serialization_derive" }
sia-rust = { git = "https://github.com/KomodoPlatform/sia-rust", rev = "9f188b80b3213bcb604e7619275251ce08fae808", optional = true }
spv_validation = { path = "../mm2_bitcoin/spv_validation" }
sha2 = "0.10"
sha3 = "0.9"
Expand Down
20 changes: 15 additions & 5 deletions mm2src/coins/coin_errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::eth::nft_swap_v2::errors::{Erc721FunctionError, HtlcParamsError, PaymentStatusErr, PrepareTxDataError};
use crate::eth::eth_swap_v2::{PaymentStatusErr, ValidatePaymentV2Err};
use crate::eth::nft_swap_v2::errors::{Erc721FunctionError, HtlcParamsError, PrepareTxDataError};
use crate::eth::{EthAssocTypesError, EthNftAssocTypesError, Web3RpcError};
use crate::{utxo::rpc_clients::UtxoRpcError, NumConversError, UnexpectedDerivationMethod};
use enum_derives::EnumFromStringify;
Expand Down Expand Up @@ -50,6 +51,7 @@ pub enum ValidatePaymentError {
TimelockOverflow(TryFromIntError),
#[display(fmt = "Nft Protocol is not supported yet!")]
NftProtocolNotSupported,
InvalidData(String),
}

impl From<SPVError> for ValidatePaymentError {
Expand Down Expand Up @@ -84,9 +86,8 @@ impl From<PaymentStatusErr> for ValidatePaymentError {
fn from(err: PaymentStatusErr) -> Self {
match err {
PaymentStatusErr::Transport(e) => Self::Transport(e),
PaymentStatusErr::AbiError(e)
| PaymentStatusErr::Internal(e)
| PaymentStatusErr::TxDeserializationError(e) => Self::InternalError(e),
PaymentStatusErr::ABIError(e) | PaymentStatusErr::Internal(e) => Self::InternalError(e),
PaymentStatusErr::InvalidData(e) => Self::InvalidData(e),
}
}
}
Expand All @@ -95,7 +96,16 @@ impl From<HtlcParamsError> for ValidatePaymentError {
fn from(err: HtlcParamsError) -> Self {
match err {
HtlcParamsError::WrongPaymentTx(e) => ValidatePaymentError::WrongPaymentTx(e),
HtlcParamsError::TxDeserializationError(e) => ValidatePaymentError::TxDeserializationError(e),
HtlcParamsError::ABIError(e) | HtlcParamsError::InvalidData(e) => ValidatePaymentError::InvalidData(e),
}
}
}

impl From<ValidatePaymentV2Err> for ValidatePaymentError {
fn from(err: ValidatePaymentV2Err) -> Self {
match err {
ValidatePaymentV2Err::UnexpectedPaymentState(e) => ValidatePaymentError::UnexpectedPaymentState(e),
ValidatePaymentV2Err::WrongPaymentTx(e) => ValidatePaymentError::WrongPaymentTx(e),
}
}
}
Expand Down
Loading

0 comments on commit 0d46b36

Please sign in to comment.