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

Marco/mp 1027 template design merchanttokenfactory contract #9

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
98 changes: 49 additions & 49 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: test

on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci
FOUNDRY_FUZZ_RUNS: 1024
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 131072
BASE_KEY: ${{ secrets.BASE_KEY }}
BASE_SEPOLIA_KEY: ${{ secrets.BASE_SEPOLIA_KEY }}
SEPOLIA_KEY: ${{ secrets.SEPOLIA_KEY }}
OP_KEY: ${{ secrets.OP_KEY }}
POLYGON_KEY: ${{ secrets.POLYGON_KEY }}
FOUNDRY_PROFILE: ci
FOUNDRY_FUZZ_RUNS: 1024
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 131072
BASE_KEY: ${{ secrets.BASE_KEY }}
BASE_SEPOLIA_KEY: ${{ secrets.BASE_SEPOLIA_KEY }}
SEPOLIA_KEY: ${{ secrets.SEPOLIA_KEY }}
OP_KEY: ${{ secrets.OP_KEY }}
POLYGON_KEY: ${{ secrets.POLYGON_KEY }}

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 test -vvv --rpc-url "https://base-mainnet.g.alchemy.com/v2/$BASE_KEY"
# - name: 🍴 🔵 🐬
# run: forge test -vvv --rpc-url "https://base-sepolia.g.alchemy.com/v2/$BASE_SEPOLIA_KEY"
- name: 🍴 🐬
run: forge test -vvv --rpc-url "https://eth-sepolia.g.alchemy.com/v2/$SEPOLIA_KEY"
- name: 🍴 🔴
run: forge test -vvv --rpc-url "https://opt-mainnet.g.alchemy.com/v2/$OP_KEY"
- name: 🍴 🟣
run: forge test -vvv --rpc-url "https://polygon-mainnet.g.alchemy.com/v2/$POLYGON_KEY"

id: test
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 --via-ir
id: build

- name: 🍴 🔵
run: forge test -vvv --via-ir --rpc-url "https://base-mainnet.g.alchemy.com/v2/$BASE_KEY"
# - name: 🍴 🔵 🐬
# run: forge test -vvv --rpc-url "https://base-sepolia.g.alchemy.com/v2/$BASE_SEPOLIA_KEY"
- name: 🍴 🐬
run: forge test -vvv --via-ir --rpc-url "https://eth-sepolia.g.alchemy.com/v2/$SEPOLIA_KEY"
- name: 🍴 🔴
run: forge test -vvv --via-ir --rpc-url "https://opt-mainnet.g.alchemy.com/v2/$OP_KEY"
- name: 🍴 🟣
run: forge test -vvv --via-ir --rpc-url "https://polygon-mainnet.g.alchemy.com/v2/$POLYGON_KEY"

id: test
21 changes: 21 additions & 0 deletions script/DeployMetalToken.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

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

contract DeployMetalToken is Script {
function run() public {
_run(0x35b284dB8fC11319B0EcE4d5164710B33727FE16);
}

function _run(address _factory) public returns (InstantLiquidityToken) {
vm.broadcast();
MetalToken factory = MetalToken(_factory);
InstantLiquidityToken token = factory.deployToken("", "", 1000_000_000, address(123), 0, 0, 0, 0);

console.log("token", address(token));

return token;
}
}
21 changes: 21 additions & 0 deletions script/DeployMetalTokenFactory.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Script, console} from "forge-std/Script.sol";
import {METAL_TOKEN_SALT} from "../src/Constants.sol";
import {MetalToken} from "../src/MetalToken.sol";

contract DeployMetalToken is Script {
function run() public returns (MetalToken) {
return _run(msg.sender);
}

function _run(address _owner) public returns (MetalToken) {
vm.broadcast();
MetalToken metalToken = new MetalToken{salt: METAL_TOKEN_SALT}(_owner);

console.log("MetalToken", address(metalToken));

return metalToken;
}
}
1 change: 1 addition & 0 deletions src/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bytes32 constant TOKEN_FACTORY_SALT = keccak256("TOKEN_FACTORY_V3");
bytes32 constant TOKEN_FACTORYV2_SALT = keccak256("TOKEN_FACTORY_AIRDROP_VARIANT");
bytes32 constant METAL_FUN_FACTORY_SALT = keccak256("METAL_FUN_FACTORY");
bytes32 constant METAL_FUN_FACTORY_V2_SALT = keccak256("METAL_FUN_FACTORY_V2");
bytes32 constant METAL_TOKEN_SALT = keccak256("METAL_TOKEN");
Loading
Loading