Skip to content

Commit

Permalink
Merge branch 'main' into primata/contract-pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Primata committed Oct 16, 2024
2 parents b39861f + 903594f commit 370f9c2
Show file tree
Hide file tree
Showing 56 changed files with 4,511 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
[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
[submodule "protocol-units/tokens/mock/testnet/imola/mevm/lib/openzeppelin-contracts"]
path = protocol-units/tokens/mock/testnet/imola/mevm/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "protocol-units/settlement/mcr/contracts/lib/safe-smart-account"]
path = protocol-units/settlement/mcr/contracts/lib/safe-smart-account
url = https://github.com/safe-global/safe-smart-account
Expand Down
87 changes: 87 additions & 0 deletions protocol-units/tokens/mock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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`

### Imola (MEVM)

#### Mintable Tokens

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

- Faucet: `0x4A6af60286C778514AFB95639B0A74a0adC24711`
- USDC: `0xaFE0732F985659986Cc3f27AeF76f419BAae5Cde`
- USDT: `0x846B2EaEC7D9A21cf073F4dDa79C6aEa0919c867`
- WBTC: `0x852d5ecB513f8F1928539AaF7217F7e6E0Bfdaa3`
- WETH: `0x4114E6516413c5BA631002A0cF95E828714F8f18`

#### Wrapped Tokens

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

- WMOVE: `0xc02df8710Be33901D11A7E2D49B6c841e12B6f76`

### Imola (SUI)

#### Mintable Tokens

Package ID: `0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711`

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

- WBTC: `0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711::wbtc::WBTC`
- Treasury Cap Object ID: `0xd2c1127a16494f9df5b6f973baebd78e093d66b3c06463c4e930c8545a9b6df2`
- WETH: `0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711::weth::WETH`
- Treasury Cap Object ID: `0xe02ba3510a9240ba970aed72e0c6188989c3e6d6bd316edfa12bd04da8ebf675`
- USDC: `0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711::usdc::USDC`
- Treasury Cap Object ID: `0x6bad1a88caef6f9ea56680cd31315b2cfeb6018b105471320407559042e6d067`
- USDT: `0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711::usdt::USDT`
- Treasury Cap Object ID: `0x8cacf2fd727720db5fc11006786fbcf69408decda4611921da791cc8ed844878`

## 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/tokens/mock/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/tokens/mock/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/tokens/mock/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/tokens/mock/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/tokens/mock/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

0 comments on commit 370f9c2

Please sign in to comment.