Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noqcks/swap-wrapped-tokens
A brownie script to wrap and unwrap tokens.
https://github.com/noqcks/swap-wrapped-tokens
Last synced: 20 days ago
JSON representation
A brownie script to wrap and unwrap tokens.
- Host: GitHub
- URL: https://github.com/noqcks/swap-wrapped-tokens
- Owner: noqcks
- Created: 2021-06-09T03:02:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-23T21:44:41.000Z (over 1 year ago)
- Last Synced: 2024-10-11T16:12:54.189Z (3 months ago)
- Language: Solidity
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swap Wrapped Tokens
This repo contains scripts to swap wrapped tokens using brownie.
The [WETH contract](https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) provides an interface that allows us to convert WETH to ETH
and vice versa.This should work for other wrapped tokens too, like WMATIC.
## Setup
1. `touch .env`
2. add you private key `export PRIVATE_KEY=0x...`
3. add your [infura](https://infura.io/) key `export WEB3_INFURA_PROJECT_ID=...`
4. `source .env`## Script
The conversion script is located at `scripts/wrapper.py`
You only need to modify the const `AMOUNT` at the top of the file to your preference.
## Convert WETH to ETH
We are minting ETH from WETH.
Example
```
brownie run scripts/wrapper.py --network kovan get_eth
```## Convert ETH to WETH
We are minting WETH from ETH.
Example
```
brownie run scripts/wrapper.py --network kovan get_weth
```