Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock Tokens Initial Scope #212

Merged
merged 16 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@
[submodule "protocol-units/settlement/mcr/contracts/lib/murky"]
path = protocol-units/settlement/mcr/contracts/lib/murky
url = https://github.com/dmfxyz/murky
[submodule "protocol-units/mock-assets/testnet/suzuka/mevm/lib/forge-std"]
path = protocol-units/mock-assets/testnet/suzuka/mevm/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "protocol-units/mock-assets/testnet/suzuka/mevm/lib/openzeppelin-contracts"]
path = protocol-units/mock-assets/testnet/suzuka/mevm/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
58 changes: 58 additions & 0 deletions protocol-units/mock-assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Mock Tokens


## Introduction
<!-- Provide an introduction to mock tokens and their purpose in the movement networks -->

## Testnets

### Suzuka (APTOS)

#### Faucet Tokens

Faucet Address: `0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f`

The following tokens can be minted through the faucet once per hour by calling `mint` and using the provided coin types as parameter:

- USDC: `0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f::tokens::USDC`
- USDT: `0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f::tokens::USDT`
- WBTC: `0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f::tokens::WBTC`
- WETH: `0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f::tokens::WETH`

#### Bridge Tokens

The following tokens can only be minted by using the Bridge Service by sending ETH from Holesky:

- MOVETH

## Devnets

### M1 (MEVM)

#### Mintable Tokens

The following tokens can be minted through their own contract once per hour by calling the mint function:

- USDC: `0xdfd318a689EF63833C4e9ab6Da17F0d5e3010013`
- USDT: `0x3150DC83cc9985f2433E546e725C9B5E6feb2E8c`
- WBTC: `0x8507bC108d0e8b8bd404d04084692B118B4F8332`
- WETH: `0x56c035c3f0e8e11fA34F79aaEf6a28A4cc8e31a8`

#### Wrapped Tokens

The following tokens cam be minted by depositing the network native asset (MOVE) to it:

- WMOVE: `0xBcD2b1D0263b7735138fBCAd05Df7f08dD5F73DA`

### M2 (SUI)

#### Mintable Tokens

Package ID: `0x457abead7283c8af79b0902e71decf173f88624fe8dd2e76be97b6132c39e9c9`

The following tokens can be minted through their own module once per hour by calling the mint function or mint_and_transfer:

- BTC: `0x457abead7283c8af79b0902e71decf173f88624fe8dd2e76be97b6132c39e9c9::wbtc::WBTC`
- ETH: `0x457abead7283c8af79b0902e71decf173f88624fe8dd2e76be97b6132c39e9c9::weth::WETH`
- USDC: `0x457abead7283c8af79b0902e71decf173f88624fe8dd2e76be97b6132c39e9c9::usdc::USDC`
- USDT: `0x457abead7283c8af79b0902e71decf173f88624fe8dd2e76be97b6132c39e9c9::usdt::USDT`
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test

on: workflow_dispatch

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
15 changes: 15 additions & 0 deletions protocol-units/mock-assets/devnet/m1/mevm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
lib/
66 changes: 66 additions & 0 deletions protocol-units/mock-assets/devnet/m1/mevm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions protocol-units/mock-assets/devnet/m1/mevm/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]

solc = "0.8.24"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
35 changes: 35 additions & 0 deletions protocol-units/mock-assets/devnet/m1/mevm/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script, console} from "forge-std/Script.sol";
import {MockToken} from "../src/MockToken.sol";
import {WETH10} from "../src/WETH10.sol";
import "forge-std/console.sol";

contract DeployScript is Script {
MockToken public usdc;
MockToken public usdt;
MockToken public wbtc;
MockToken public weth;
WETH10 public wmove;

function run() public {
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));

uint256 dexs = 5;

usdc = new MockToken("Circle", "USDC", 6, 1000000 * dexs, 60000, 3600);
usdt = new MockToken("Tether", "USDT", 6, 1000000 * dexs, 60000, 3600);
wbtc = new MockToken("Bitcoin", "WBTC", 8, 17 * dexs, 1, 3600);
weth = new MockToken("Ethereum", "WETH", 8, 340 * dexs, 20, 3600);
wmove = new WETH10();

console.log("USDC:", address(usdc));
console.log("USDT:", address(usdt));
console.log("WBTC", address(wbtc));
console.log("WETH", address(weth));
console.log("WMOVE", address(wmove));

vm.stopBroadcast();
}
}
31 changes: 31 additions & 0 deletions protocol-units/mock-assets/devnet/m1/mevm/src/MockToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MockToken is ERC20 {
uint256 public amount;
uint256 public timeLimit;
uint8 internal decimals_;
mapping(address => uint256) public requests;

constructor(string memory name, string memory symbol, uint8 _decimals, uint256 _premint, uint256 _amount, uint256 _timeLimit)
public
ERC20(name, symbol)
{
amount = _amount;
timeLimit = _timeLimit;
decimals_ = _decimals;
_mint(msg.sender, _premint * 10**decimals_);
}

function decimals() public view override returns (uint8) {
return decimals_;
}

function mint() public {
require(requests[msg.sender] + timeLimit < block.timestamp, "Request is too soon");
requests[msg.sender] = block.timestamp;
_mint(msg.sender, amount*10**decimals_);
}
}
Loading