{"id":13525807,"url":"https://github.com/weichain/galactic-bridge-icp","last_synced_at":"2025-04-01T05:32:26.752Z","repository":{"id":237560197,"uuid":"758064690","full_name":"weichain/galactic-bridge-icp","owner":"weichain","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-28T11:13:54.000Z","size":283,"stargazers_count":5,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-02T10:34:02.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weichain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-15T14:57:12.000Z","updated_at":"2024-09-03T17:19:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"eec45369-3fc4-4321-b781-cb12b2c1c23c","html_url":"https://github.com/weichain/galactic-bridge-icp","commit_stats":null,"previous_names":["weichain/galactic-bridge-icp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weichain%2Fgalactic-bridge-icp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weichain%2Fgalactic-bridge-icp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weichain%2Fgalactic-bridge-icp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weichain%2Fgalactic-bridge-icp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weichain","download_url":"https://codeload.github.com/weichain/galactic-bridge-icp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246591746,"owners_count":20801984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:22.334Z","updated_at":"2025-04-01T05:32:26.427Z","avatar_url":"https://github.com/weichain.png","language":"Rust","funding_links":[],"categories":["Chain Fusion"],"sub_categories":["Solana"],"readme":"# galactic_bridge_icp\n\n## Deployment\nDeploys ledger and minter\n\n```bash\ndfx start --background\n\n./scripts/export.sh\n./scripts/deploy.sh --all\n```\n\n## (Re)Generating candid file (minter.did)\n```bash\n./scripts/did.sh\n```\n\n# Flow examples\n\n## Sol to gSol\n```\n┌────┐ ┌───────────────┐           ┌──────────┐┌──────────┐\n│User│ │Solana Contract│           │  Minter  ││  Ledger  │\n└─┬──┘ └───────┬───────┘           └────┬─────┘└─────┬────┘\n  │            │                        │            │\n  │   deposit  │                        │            │\n  │───────────\u003e│                        │            │\n  │            │   scraps transactions  │            │\n  │            │\u003c───────────────────────│            │\n  │            │                        │ on deposit │\n  │            │                        │ mint asset │\n  │            │                        │───────────\u003e│\n  │            │                        │            │\n┌─┴──┐ ┌───────┴───────┐           ┌────┴─────┐┌─────┴────┐\n│User│ │Solana Contract│           │  Minter  ││  Ledger  │\n└────┘ └───────────────┘           └──────────┘└──────────┘\n```\n\n## gSol to Sol\n```\n ┌───────────────┐ ┌────┐             ┌──────────┐┌──────────┐\n │Solana Contract│ │User│             │  Minter  ││  Ledger  │\n └─┬─────────────┘ └─┬──┘             └────┬─────┘└─────┬────┘\n   │                 │                     │            │\n   │                 │ give \"icrc2_approve\" to minter   │\n   │                 │─────────────────────────────────\u003e│\n   │                 │                     │            │\n   │                 │ burn                │            │\n   │                 │────────────────────\u003e│transfer_from\n   │                 │                     │───────────\u003e│\n   │                 │ generate coupon     │            │\n   │                 │\u003c────────────────────│            │\n   │  withdraw       │                     │            │\n   │\u003c────────────────│                     │            │\n   │                 │                     │            │\n ┌─┴─────────────┐ ┌─┴──┐             ┌────┴─────┐┌─────┴────┐\n │Solana Contract│ │User│             │  Minter  ││  Ledger  │\n └───────────────┘ └────┘             └──────────┘└──────────┘\n```\nCoupon holds message(address to receive asset, amount, etc.), signature and public address and is used to release SOL from solana contract\n\n\n# Help\n\n## get_ledger_id\n\n```bash\ndfx canister call minter get_ledger_id\n```\n\n## get_address\nReturns Threshold ECDSA address (\"ecdsa_public_key\") in 3 formats:\n1) compressed public key (size: 33 bytes, generated from icp)\n2) uncompressed public key (size: 64 bytes, generated from compressed version via \"libsecp256k1\" library)\n\n```bash\ndfx canister call minter get_address\n```\n\n## withdraw\nWithdraw burns gsol and provides a coupon\n\n```bash\ndfx canister call ledger icrc1_balance_of \"(record {\n  owner = principal \\\"$USER_PRINCIPAL\\\"\n})\"\ndfx canister call ledger icrc1_total_supply\n\ndfx canister call ledger icrc2_approve \"(record {\n  spender = record { owner = principal \\\"$(dfx canister id minter)\\\" };\n  amount = 100_000_000;\n})\" --identity $USER_PRINCIPAL_NAME\n\n# provide solana address and amount\ndfx canister call minter withdraw \"(\\\"HS6NTv6GBVSLct8dsimRWRvjczJTAgfgDJt8VpR8wtGm\\\", 100_000)\" --identity $USER_PRINCIPAL_NAME\n```\n\nCoupon Example:\n```rust\n{\n    /// The recovery ID (y parity) for signature\n    recovery_id = opt (0 : nat8);\n    /// The hexadecimal representation of the ICP public key in non compressed format.\n    icp_public_key_hex = \"04de48381e1b54e2463cafdcafc3aaf7d99b1c512a16ac60e6415514d07ab78d6010b31fc919cc196b82ede54859f1d9cd69258f83b5d5bb146a77f326b9a723ab\";\n    /// The message associated with the coupon.\n    /// This message typically contains details about the withdrawal event.\n    message = \"{\"from_icp_address\":\"svq52-4c5cd-olo3w-r6b37-jizpw-kixdx-uarhl-nolu3-gcikk-nza7z-yae\",\"to_sol_address\":\"8nZLXraZUARNmU3P8PKbJMS7NYs7aEyw6d1aQx1km3t2\",\"amount\":100000,\"burn_id\":2,\"burn_timestamp\":1711616761296437000,\"icp_burn_block_index\":106}\";\n    /// The signature of the coupon.\n    signature_hex = \"ac30c685a756feafbe9e34939054fb8e7b0879039f18eb536a06a12483f0f8d25f4e6fc29cf5fbb9742d0e9fff39dbf3bbc3adf3b56477adb614417c4157168a\";\n    /// The hash of the message associated with the coupon.\n    message_hash = \"8278c60c27f95ccb2b0956c4b7ed9ef90e1ec67d3d8cf88cec39632d3f0d4bf0\";\n}\n```\nNo matter who executes the withdrawal process on the Solana side, the asset will be reimbursed to the Solana address provided during the minter canister call.\n\n## get_withdraw_info\n```bash\ndfx canister call minter get_withdraw_info  --identity $USER_PRINCIPAL_NAME\n```\n\n## get_state\n\n```bash\ndfx canister call minter get_state --identity=\"$OWNER_PRINCIPAL_NAME\"\n```\n\n## get_storage\n\n```bash\ndfx canister call minter get_storage --identity=\"$OWNER_PRINCIPAL_NAME\"\n```\n\n## get_active_tasks\n\n```bash\ndfx canister call minter get_active_tasks --identity=\"$OWNER_PRINCIPAL_NAME\"\n```\n\n# Known Issues\n1) Solana Testnet and Devnet do not retain transactions and transaction signatures for an extended period. This can lead to\n   issues in the Solana parser, such as encountering existing signatures without corresponding transaction data. Currently,\n   any parsing issue encountered is retried up to 100 times before being dropped. It may be beneficial to implement a mechanism\n   with progressively longer retry periods for improved handling of such issues.\".\n2) Solana RPC provider free version has a request limit. At this point batching for transaction calls is not possible on mainnet!\n   Each call is duplicated 13 times for each node on the subnet.\n\n## MAINNET PUBLIC KEY - test_key_1\n\n\"02449d7bbca9446df12f0f929c088edfec7223c339f5d98cb5b4055572a36c94f0\"\n\"04449d7bbca9446df12f0f929c088edfec7223c339f5d98cb5b4055572a36c94f0888809b30f7a499fcc0c2292c682fb3d7adc7656ef0d6d3f689a15ebee9c23cc\"\n\n## MAINNET PUBLIC KEY - key_1\n\n\"03c1ab9735077d400d7e992087ed3e09721ecd25d2238f5b6d0ec5f899aff090db\"\n\"04c1ab9735077d400d7e992087ed3e09721ecd25d2238f5b6d0ec5f899aff090db0f3c5b976ca2305440f31367e3b5c51cb58413de5962714ea41015812ed5069f\"\n\n## LATEST SOLANA INITIAL SIGNATURE\ndhCUjkhdmEw18r1uNVxKanMyEXYmdcp56UBUmLXkgnPU8QFoHJYKy4UMrHLHk7oxUWXc13gvcL11ivCNJADaMJN\n\n## SOLANA CONTRACT ADDRESS\nAAJL4DeXnWBNRowWjvpkAgwtAACpz6NfaA1T2p8Hrpy","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweichain%2Fgalactic-bridge-icp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweichain%2Fgalactic-bridge-icp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweichain%2Fgalactic-bridge-icp/lists"}