https://github.com/starkware-libs/usdc-migration
https://github.com/starkware-libs/usdc-migration
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/starkware-libs/usdc-migration
- Owner: starkware-libs
- License: apache-2.0
- Created: 2025-10-20T10:04:29.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-12-04T09:10:37.000Z (7 months ago)
- Last Synced: 2025-12-10T07:50:45.996Z (6 months ago)
- Language: Cairo
- Size: 566 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Security: docs/SECURITY.md
Awesome Lists containing this project
README
[](LICENSE)
# Token Migration Contract
## Content
- [Overview](#overview)
- [API Reference](#api-reference)
- [Dependencies](#dependencies)
- [Getting help](#getting-help)
- [Build and Test](#build-and-test)
- [Audit](#audit)
- [Security](#security)
## Overview
This contract aims to aid starknet users in migrating their USDC.e tokens into USDC without having to withdraw them on L1 themselves.
## API Reference
### View Functions
- `get_legacy_token() -> ContractAddress` - Get the `ContractAddress` of the legacy token.
- `get_new_token() -> ContractAddress` - Get the `ContractAddress` of the new token.
- `is_swap_to_legacy_allowed() -> bool` - Check if exchanging new tokens for legacy tokens (reverse migration) is allowed.
### Migration Functions
- `swap_to_new(amount: u256)` - Exchange legacy tokens for new ones (1:1 ratio).
- Precondition: sufficient allowance for the legacy token.
- `swap_to_legacy(amount: u256)` - Exchange new tokens for legacy ones (1:1 ratio).
- Precondition: sufficient allowance for the new token.
## Dependencies
- Cairo dependencies such as [Scarb](https://docs.swmansion.com/scarb/) and [Starknet foundry](https://foundry-rs.github.io/starknet-foundry/index.html) - install using [starkup](https://github.com/software-mansion/starkup).
## Getting help
Reach out to the maintainer at any of the following:
- [GitHub Discussions](discussions)
- Contact options listed on this [GitHub profile](https://github.com/starkware-libs)
## Build and Test
Build the contracts from the repo root:
```bash
scarb --release build
```
To run the tests, execute:
```bash
scarb test
```
## Audit
Find the latest audit report in [docs/audit](docs/audit).
## Security
This repo follows good practices of security, but 100% security cannot be assured. This repo is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md).