An open API service indexing awesome lists of open source software.

https://github.com/starkware-libs/usdc-migration


https://github.com/starkware-libs/usdc-migration

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          


Starknet Logo

[![License: Apache2.0](https://img.shields.io/badge/License-Apache2.0-green.svg)](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).