{"id":27742590,"url":"https://github.com/astarnetwork/evm-xcm-examples","last_synced_at":"2025-04-28T16:43:44.287Z","repository":{"id":188454527,"uuid":"678756623","full_name":"AstarNetwork/EVM-XCM-Examples","owner":"AstarNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-09T08:16:14.000Z","size":199,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T01:58:39.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-15T09:54:34.000Z","updated_at":"2023-08-17T08:48:48.000Z","dependencies_parsed_at":"2023-08-15T12:30:10.460Z","dependency_job_id":null,"html_url":"https://github.com/AstarNetwork/EVM-XCM-Examples","commit_stats":null,"previous_names":["astarnetwork/evm-xcm-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2FEVM-XCM-Examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2FEVM-XCM-Examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2FEVM-XCM-Examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2FEVM-XCM-Examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstarNetwork","download_url":"https://codeload.github.com/AstarNetwork/EVM-XCM-Examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251347823,"owners_count":21575158,"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:43.670Z","updated_at":"2025-04-28T16:43:44.274Z","avatar_url":"https://github.com/AstarNetwork.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EVM XCM - Patterns\n\nWelcome to the EVM-XCM Examples repository! This repository contains examples demonstrating solidity contracts using XCM precompiles on Astar network.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [Contributing](#contributing)\n\n## Introduction\n\nThe EVM-XCM Examples repository provides code implementation, set up scripts and integrations tests showcasing how to use XCM precompiles in solidity contracts in Astar.\nThere is one example for each precompile function. Each example is compose by:\n\n- a set up script (in `./scripts/assetsSetUp.ts`)\n- a solidity implementation (in `./contracts/**example**`)\n- integration tests (in `./tests/**example.ts**`)\n\nThe goal is to provide a **simple and easy to understand** examples for each precompile function. The examples are not meant to be used in production but to help developers to understand how to use XCM precompiles in Astar.\n\n## Getting Started\n\nTo get started with these examples, follow these steps:\n\n### 1. Set up zombie-net\n\nPlease download those binaries for your OS and copy then in `./zombie-net`\n\n- [Polkadot](https://github.com/paritytech/polkadot/releases/tag/v0.9.43) - For non linux user. Download source code and compile it with `cargo build --release`\n- [Zombie net binary](https://github.com/paritytech/zombienet/releases/tag/v1.3.62)\n- [Astar](https://github.com/AstarNetwork/Astar/releases/tag/v5.20.0)\n\n**1.2** please **rename binaries**:\n`polakdot`\n`astar-collator`\n`zombienet`\n\n**1.3** Please make the binaries **executable**:\n\n```bash\nchmod +x ./polkadot ./astar-collator ./zombienet\n```\n\n**1.4** Run zombie-net with the command:\n\n```bash\n./zombienet -p native spawn multi.toml\n```\n\n### 2. Run scripts - Set up the environment\n\nThe examples rely on a Shibuya and Shiden parachain with an open HRMP channel. an asset TST (id = 1) is created in both parachain. Location is registerd as Shibuya.\nFirst ensure **zombienet is running**\n\n```bash\nyarn\nyarn setup\n```\n\n### 3. Run the tests\n\n```bash\nyarn transfer\nyarn withdraw\nyarn native\n```\n\n## Examples\n\nAll examples use XCM precompiles that use xToken pallet.\n\n### Transfer asset\n\nThis example will transfer asset id = 1 owned by alith (EVM H160 address of Alice) from Shibuya to Shiden using xToken `transfer`.\nThe contract can be found in `./contracts/transfer-assets/assetTransfer.sol`. Integrations tests are in the file `./test/transferAssets.ts`.\n\n### Withdraw asset\n\nAfter having transferred asset id = 1 form reserve to another parachain, we will call withdraw to transfer back the asset to reserve. This example will transfer asset id = 1 owned by alith from Shiden to Shibuya using xToken `transfer_multiasset`.\nThe contract can be found in `./contracts/withdraw-assets/withdrawAsset.sol`. Integrations tests are in the file `./test/withdrawAssets.ts`.\n\n### Transfer Native token\n\nThis example will transfer native Shibuya token to a wrapped Shibuya token in Shiden using xToken `transfer_multiasset`.\nThe contract can be found in `./contracts/transfer-native/transferNative.sol`. Integrations tests are in the file `./test/transferNative.ts`.\n\n## Contributing\n\nContributions to this repository are welcome! If you have an example or tutorial related to EVM and XCM that you'd like to add, please follow these steps:\n\n1. Fork this repository.\n2. Create a new branch, commit, and open a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fevm-xcm-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastarnetwork%2Fevm-xcm-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fevm-xcm-examples/lists"}