{"id":27742589,"url":"https://github.com/astarnetwork/ink-xvm-sdk","last_synced_at":"2025-07-10T16:09:30.067Z","repository":{"id":103304073,"uuid":"539348579","full_name":"AstarNetwork/ink-xvm-sdk","owner":"AstarNetwork","description":"The Ink! smart contract SDK for XVM interface.","archived":false,"fork":false,"pushed_at":"2024-05-10T12:24:21.000Z","size":98,"stargazers_count":28,"open_issues_count":1,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-28T16:57:33.699Z","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/AstarNetwork.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,"zenodo":null}},"created_at":"2022-09-21T06:55:51.000Z","updated_at":"2024-09-03T21:47:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"48afaba7-2c5e-481e-b196-8c34f26dfefe","html_url":"https://github.com/AstarNetwork/ink-xvm-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AstarNetwork/ink-xvm-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fink-xvm-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fink-xvm-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fink-xvm-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fink-xvm-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstarNetwork","download_url":"https://codeload.github.com/AstarNetwork/ink-xvm-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fink-xvm-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264604999,"owners_count":23635981,"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":"2025-04-28T16:43:40.823Z","updated_at":"2025-07-10T16:09:29.728Z","avatar_url":"https://github.com/AstarNetwork.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ink! XVM SDK\n\nThis repository contains examples contracts using XVM to call EVM from ink! needed to use XVM from WASM contracts.\nIt contains an implementation of XVM chain-extension to use in your contracts.\nAs well as ink! contracts SDK that implements XVM chain-extension to be used as is.\n\n## Contracts SDK\n\n#### PSP22 Wrapper\n\nThis implementation is a wrapper of an underlying `ERC20` on EVM. Interact with native substrate addresses.\nAs it implements wrapper pattern it has `deposit` \u0026 `withdraw` function and can be used as a bridgeless solution between WASM VM \u0026 EVM.\nIt implements `PSP22` standard, thus can be used in any DEX/wallet supporting it.\nPlease have a look at the tests that describe the flow to use `deposit` and `withdraw`.\n\n#### PSP34 Wrapper\n\nThis implementation is a wrapper of an underlying `ERC721` on EVM. Interact with substrate native substrate addresses.\nAs it implements wrapper pattern it has `deposit` \u0026 `withdraw` function and can be used as a bridgeless solution between WASM VM \u0026 EVM.\nIt implements `PSP34` standard, and thus can be used in any DEX/wallet supporting it.\n\n## Library\n\n#### XVM environment\n\nImplementation of XVM chain extension added to a custom `XvmDefaultEnvironment`.\n\n1. Import the crate in your Cargo.toml\n2. Add it to your contract in ink! macro `#[ink::contract(env = xvm_sdk::XvmDefaultEnvironment)]`.\n3. In your contract use it with `self.env().extension().xvm_call(..args)`.\n\n#### XVM Builder\n\nThis crate exposes `Xvm` struct that implements xvm_call with chain-extension builder from ink_env.\nIt makes it compatible with other custom environment like openbrush.\nHave a look at PSP22 Wrapper for an example.\n\n1. Import the crate in your Cargo.toml\n2. Import struct in your contract use `use xvm_helper::*;`\n3. Use it with `XvmErc20::transfer(..args)`\n\n## Usage\n\n##### Try it!\n\n1. Clone the repo\n2. Run `yarn`\n3. Build ink! contracts `yarn build:ink`\n\n**To run on local node:**\nEnsure you have a local node running with `./target/release/astar-collator --dev -lruntime::contracts=debug -l=runtime=debug,xvm=trace --enable-evm-rpcp` (to have XVM and ink! logs).     \nThen run `yarn test`.\n\n**To run on Shibuya:**\nCreate a .env file from .env.example and fill it with your credentials:\nAdd your Shibuya EVM private key in `ACCOUNT_PRIVATE_KEY_EVM`\nAnd your Shibuya Substrate passphrase in `SUBSTRATE_MNEMO`.\nThen run `yarn test:shibuya`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fink-xvm-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastarnetwork%2Fink-xvm-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fink-xvm-sdk/lists"}