Skip to content

Commit

Permalink
refactor: splitting omni-connector into multiple smaller connectors (#48
Browse files Browse the repository at this point in the history
)

* refactor: scratch implementation of refactored version of sdk

* refactor: made solana-connector rely on near-connector

* chore: removed useless lib.rs files

Since we can directly set path for a lib file, then there's no need to create a lib file just to import a module

* fix: manually synced with main branch

* fix: resolved issues after merge

* chore: scratch implementation of bridge-clients

* Implement a few near<->evm operations (#52)

* feat: added wormhole support

Made an abstraction for init&fin transfer as well

* chore: bumped spl crates version

* feat: support for multiple evm chains

* chore: added abstract method for calling `sign_transfer` on NEAR chain

* chore: added abstract method for calling `claim_fee` on NEAR chain

* chore: added abstract method for calling `sign_claim_fee` on NEAR chain

* feat: synced with latest omni-types

* feat: added `get_required_storage_deposit` method on NEAR chain

* fix: static analysis

* feat: added `get_token_id` method on NEAR chain

* feat: support multiple OmniAddress variants

* feat: added `get_native_token_id` method on NEAR chain

* feat: finished abstraction (#54)

* feat: finished abstraction

* feat: included solana into omni abstraction

* feat: made solana's fields optional

This can be useful if user won't use full potential of bridge-client, but only some methods which don't require all fields like wormhole or keypair

* chore: provided a bit more consistency between different bridge clients

* chore: addressed some clippy warnings

* chore: updated some crates

* chore: decreased attached gas

* chore: moved attached gas/deposit to consts

---------

Co-authored-by: kiseln <[email protected]>
Co-authored-by: Ivan Frolov <[email protected]>
Co-authored-by: Ivan Frolov <[email protected]>
  • Loading branch information
4 people authored Dec 9, 2024
1 parent dd5c419 commit a98ba59
Show file tree
Hide file tree
Showing 29 changed files with 3,960 additions and 2,797 deletions.
2,904 changes: 1,663 additions & 1,241 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ members = [
"bridge-sdk/connectors/bridge-connector-common",
"bridge-sdk/connectors/fast-bridge",
"bridge-sdk/connectors/omni-connector",
"bridge-sdk/solana-bridge-client",
"bridge-sdk/bridge-clients/solana-bridge-client",
"bridge-sdk/bridge-clients/near-bridge-client",
"bridge-sdk/bridge-clients/evm-bridge-client",
"bridge-sdk/bridge-clients/wormhole-bridge-client",
]

[workspace.dependencies]
sha3 = "0.10.8"
sha2 = "0.10.8"
borsh = "1.5.1"
thiserror = "1.0.61"
thiserror = "2.0.3"
ethers = "2.0.14"
ethers-core = "2.0.14"
ethereum-types = "0.14.1"
Expand All @@ -42,12 +45,12 @@ tracing-subscriber = "0.3"
base64 = "0.22"
near-token = "0.3"
near-contract-standards = "5.5"
omni-types = { git = "https://github.com/near-one/omni-bridge", package = "omni-types", rev = "303ca7bc7cdb39c4a356b65b10221259a632ac54" }
omni-types = { git = "https://github.com/near-one/omni-bridge", package = "omni-types", rev = "11ffdb63706ceba175f7581585bd837aad9f1559" }
solana-sdk = "2.0.13"
solana-client = "2.0.13"
spl-token = "6.0.0"
spl-associated-token-account = "5.0.1"
mpl-token-metadata = "4.1.2"
spl-token = "7.0.0"
spl-associated-token-account = "6.0.0"
mpl-token-metadata = "5.1.0"

[patch.crates-io.curve25519-dalek]
git = "https://github.com/solana-labs/curve25519-dalek.git"
Expand Down
7 changes: 5 additions & 2 deletions bridge-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ serde_json.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
omni-types.workspace = true
solana-client.workspace = true
solana-sdk.workspace = true
nep141-connector = { path = "../bridge-sdk/connectors/nep141-connector" }
eth-connector = { path = "../bridge-sdk/connectors/eth-connector" }
omni-connector = { path = "../bridge-sdk/connectors/omni-connector" }
fast-bridge = { path = "../bridge-sdk/connectors/fast-bridge" }
solana-connector = { path = "../bridge-sdk/connectors/solana-connector" }
omni-connector = { path = "../bridge-sdk/connectors/omni-connector" }
near-bridge-client = { path = "../bridge-sdk/bridge-clients/near-bridge-client" }
evm-bridge-client = { path = "../bridge-sdk/bridge-clients/evm-bridge-client" }
solana-bridge-client = { path = "../bridge-sdk/bridge-clients/solana-bridge-client" }
50 changes: 38 additions & 12 deletions bridge-cli/src/defaults.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
/// Mainnet
pub const NEAR_RPC_MAINNET: &str = "https://rpc.mainnet.near.org/";
pub const ETH_RPC_MAINNET: &str = "https://eth.llamarpc.com";
pub const ETH_CHAIN_ID_MAINNET: u64 = 1;
pub const TOKEN_LOCKER_ID_MAINNET: &str = "ft-locker.bridge.near";
pub const BRIDGE_TOKEN_FACTORY_ADDRESS_MAINNET: &str = "0x252e87862A3A720287E7fd527cE6e8d0738427A2";
pub const NEAR_TOKEN_LOCKER_ID_MAINNET: &str = "omni-locker.near";
pub const NEAR_LIGHT_CLIENT_ETH_ADDRESS_MAINNET: &str =
"0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873";

pub const ETH_RPC_MAINNET: &str = "https://eth.llamarpc.com";
pub const ETH_CHAIN_ID_MAINNET: u64 = 1;
pub const ETH_BRIDGE_TOKEN_FACTORY_ADDRESS_MAINNET: &str =
"0x252e87862A3A720287E7fd527cE6e8d0738427A2";
pub const ETH_CONNECTOR_ACCOUNT_ID_MAINNET: &str = "aurora";
pub const ETH_CUSTODIAN_ADDRESS_MAINNET: &str = "0x6BFaD42cFC4EfC96f529D786D643Ff4A8B89FA52";
pub const FAST_BRIDGE_ACCOUNT_ID_MAINNET: &str = "fast.bridge.near";
pub const FAST_BRIDGE_ADDRESS_MAINNET: &str = "0xC5E985976d9b521904AD96306356ECA0fE4F3a1f";

pub const BASE_RPC_MAINNET: &str = "";
pub const BASE_CHAIN_ID_MAINNET: u64 = 8453;
pub const BASE_BRIDGE_TOKEN_FACTORY_ADDRESS_MAINNET: &str = "";

pub const ARB_RPC_MAINNET: &str = "";
pub const ARB_CHAIN_ID_MAINNET: u64 = 42161;
pub const ARB_BRIDGE_TOKEN_FACTORY_ADDRESS_MAINNET: &str = "";

pub const SOLANA_RPC_MAINNET: &str = "https://api.mainnet-beta.solana.com";
pub const SOLANA_BRIDGE_ADDRESS_MAINNET: &str = "";
pub const SOLANA_WORMHOLE_ADDRESS_MAINNET: &str = "";

pub const FAST_BRIDGE_ACCOUNT_ID_MAINNET: &str = "fast.bridge.near";
pub const FAST_BRIDGE_ADDRESS_MAINNET: &str = "0xC5E985976d9b521904AD96306356ECA0fE4F3a1f";

/// Testnet
pub const NEAR_RPC_TESTNET: &str = "https://rpc.testnet.near.org/";
pub const ETH_RPC_TESTNET: &str = "https://ethereum-sepolia.blockpi.network/v1/rpc/public";
pub const ETH_CHAIN_ID_TESTNET: u64 = 11155111;
pub const TOKEN_LOCKER_ID_TESTNET: &str = "ft-locker.sepolia.testnet";
pub const BRIDGE_TOKEN_FACTORY_ADDRESS_TESTNET: &str = "0xa9108f7F83Fb661e611991116D526fCa1a9585ab";
pub const NEAR_TOKEN_LOCKER_ID_TESTNET: &str = "omni-locker.testnet";
pub const NEAR_LIGHT_CLIENT_ETH_ADDRESS_TESTNET: &str =
"0x202cdf10bfa45a3d2190901373edd864f071d707";

pub const ETH_RPC_TESTNET: &str = "https://ethereum-sepolia.blockpi.network/v1/rpc/public";
pub const ETH_CHAIN_ID_TESTNET: u64 = 11155111;
pub const ETH_BRIDGE_TOKEN_FACTORY_ADDRESS_TESTNET: &str =
"0xa9108f7F83Fb661e611991116D526fCa1a9585ab";
pub const ETH_CONNECTOR_ACCOUNT_ID_TESTNET: &str = "aurora";
pub const ETH_CUSTODIAN_ADDRESS_TESTNET: &str = "0xe0320b199863D7f6D5bBa62741aACB312110DEf7";
pub const FAST_BRIDGE_ACCOUNT_ID_TESTNET: &str = "fastbridge.testnet";
pub const FAST_BRIDGE_ADDRESS_TESTNET: &str = "0x0B2C4871C9bAD795746C05c1539A8B1f26c26357";

pub const BASE_RPC_TESTNET: &str = "https://base-sepolia.blockpi.network/v1/rpc/public";
pub const BASE_CHAIN_ID_TESTNET: u64 = 84532;
pub const BASE_BRIDGE_TOKEN_FACTORY_ADDRESS_TESTNET: &str =
"0x0C981337fFe39a555d3A40dbb32f21aD0eF33FFA";

pub const ARB_RPC_TESTNET: &str = "https://arbitrum-sepolia.blockpi.network/v1/rpc/public";
pub const ARB_CHAIN_ID_TESTNET: u64 = 421614;
pub const ARB_BRIDGE_TOKEN_FACTORY_ADDRESS_TESTNET: &str =
"0xd565f7CcE0FA1bB8DBe73FCDA281390d545f6200";

pub const SOLANA_RPC_TESTNET: &str = "https://api.devnet.solana.com";
pub const SOLANA_BRIDGE_ADDRESS_TESTNET: &str = "";
pub const SOLANA_WORMHOLE_ADDRESS_TESTNET: &str = "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5";

pub const FAST_BRIDGE_ACCOUNT_ID_TESTNET: &str = "fastbridge.testnet";
pub const FAST_BRIDGE_ADDRESS_TESTNET: &str = "0x0B2C4871C9bAD795746C05c1539A8B1f26c26357";
Loading

0 comments on commit a98ba59

Please sign in to comment.