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

feat: ✨ TokenFactoryV3 #7

Merged
merged 17 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:

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 }}
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "lib/gaslitedrop"]
path = lib/gaslitedrop
url = https://github.com/PopPunkLLC/gaslitedrop
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
75 changes: 75 additions & 0 deletions broadcast/DeployMetalFunFactory.s.sol/8453/run-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"transactions": [
{
"hash": "0x9f9bfc693d7588aba11898b537fa1254bd242ada52593435c65ae46563dac673",
"transactionType": "CREATE2",
"contractName": "MetalFunFactory",
"contractAddress": "0x773fd11afefbcbc7ef98fc51030d99c9f5605904",
"function": null,
"arguments": [
"0x71e1BB6EA5B84E9Aa55691a1E86223d250a18F8F"
],
"transaction": {
"from": "0x711df55d3663c04b2cbced323ce4ece2cbab92b9",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"gas": "0x160640",
"value": "0x0",
"input": "0x32ab015add757ad0a0eefded4f6bec14f0edd9d43e2ab3010ba11251d716c28a6b02fbe6bb5084433a4b80000060805260e0604052600060a05273d74d14ebe305c93d023c966640788f05593f0fde60c0527fd74d14ebe305c93d023c966640788f05593f0fde00000000000000000000000060015534801561006157600080fd5b50604051611311380380611311833981016040819052610080916101c1565b806001600160a01b0381166100af57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100b881610171565b5046600181148015906100cc575080600514155b80156100da57508061a4b114155b80156100e7575080600a14155b80156100f4575080608914155b8015610101575080603814155b801561010f57508061210514155b801561011e57508062014a3414155b801561012d57508062aa36a714155b801561013c5750806276adf114155b801561014c5750806327bc86aa14155b1561016a57604051636f0c900f60e01b815260040160405180910390fd5b50506101f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156101d357600080fd5b81516001600160a01b03811681146101ea57600080fd5b9392505050565b6080516110f0610221600039600081816106a40152818161078b01528181610a430152610a6901526110f06000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806386b714e21161005b57806386b714e2146100f95780638da5cb5b14610145578063b548848714610160578063f2fde38b1461019257600080fd5b8063150b7a021461008d5780631b5b213c146100c9578063225b20b9146100de578063715018a6146100f1575b600080fd5b6100ab61009b366004610c26565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6100dc6100d7366004610ca6565b6101a5565b005b6100dc6100ec366004610cca565b6101d5565b6100dc6102ea565b60015461011e906001600160601b03811690600160601b90046001600160a01b031682565b604080516001600160601b0390931683526001600160a01b039091166020830152016100c0565b6000546040516001600160a01b0390911681526020016100c0565b61017361016e366004610da5565b6102fe565b604080516001600160a01b0390931683526020830191909152016100c0565b6100dc6101a0366004610ca6565b610360565b6101ad6103a3565b600180546001600160a01b03909216600160601b026001600160601b03909216919091179055565b6101dd6103a3565b60006101e76103d0565b91505060005b82518110156102e457816001600160a01b031663fc6f7865604051806080016040528086858151811061022257610222610e09565b60209081029190910181015182526001600160a01b03808a16838301526001600160801b036040808501829052606094850182905280516001600160e01b031960e089901b1681528651600482015293860151909216602484015290840151811660448301529290910151909116606482015260840160408051808303816000875af11580156102b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102da9190610e1f565b50506001016101ed565b50505050565b6102f26103a3565b6102fc60006105af565b565b60008061030b84846105ff565b6040519193509150339082906001600160a01b038516907f0d1d2eaa1e5bac93f8aaaed98c5de5ec54cdeb3867b3238f239475dfb0dd337d906103519089908990610e89565b60405180910390a49250929050565b6103686103a3565b6001600160a01b03811661039757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6103a0816105af565b50565b6000546001600160a01b031633146102fc5760405163118cdaa760e01b815233600482015260240161038e565b600073c36442b4a4522e871399cd717abdd847ab11fe884660018190036104095773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc292505b806005036104295773b4fbf271143f4fbf7b91a5ded31805e42b2208d692505b8061a4b10361044a577382af49447d8a07e3bd95bd0d56f35241523fbab192505b80600a0361045d576006602160991b0192505b8060890361047d57730d500b1d8e8ef31e21c99d1db9a6444d3adf127092505b806038036104b45773bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c9250737b8a01b39d58278b5de7e48c8449c9f4f517061391505b80612105036104df576006602160991b0192507303a520b32c04bf3beef7beb72e919cf822ed34f191505b8062014a340361050b576006602160991b0192507327f971cb582bf9e50f397e4d29a5c7a34f11faa291505b8062aa36a7036105445773fff9976782d46cc05630d1f6ebab18b2324d6b149250731238536071e1c677a632429e3655c799b22cda5291505b806276adf103610570576006602160991b01925073bc91e8dfa3ff18de43853372a3d7dfe585137d7891505b806327bc86aa036105aa5773eb54dacb4c2ccb64f8074eceea33b5ebb38e538792507356c65e35f2dd06f659bcfe327c4d7f21c9b69c2f91505b509091565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060008061060d6103d0565b6040805180820182526001546001600160601b038116808352600160601b9091046001600160a01b03166020808401829052845146918101919091529384019190915293955091935060009261067b9160600160405160208183030381529060405280519060200120610927565b60405163148f51f360e01b81529092506001600160a01b0383169063148f51f3906106d09030907f0000000000000000000000000000000000000000000000000000000000000000908d908d90600401610eb7565b600060405180830381600087803b1580156106ea57600080fd5b505af11580156106fe573d6000803e3d6000fd5b5050600180549092508291506000906107219083906001600160601b0316610f11565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555050600080846001600160a01b0316836001600160a01b03161061076957848361076c565b82855b60405163095ea7b360e01b81526001600160a01b0387811660048301527f000000000000000000000000000000000000000000000000000000000000000060248301529294509092509084169063095ea7b3906044016020604051808303816000875af11580156107e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108059190610f38565b50600080610813858861099b565b6040516309f56ab160e11b81526001600160a01b038781166004830152868116602483015261271060448301528083166064830152929450909250908716906313ead562906084016020604051808303816000875af115801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e9190610f5a565b50604051634418b22b60e11b81526000906001600160a01b038816906388316456906108ce908690600401610f77565b6080604051808303816000875af11580156108ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610911919061103b565b50979e919d50909b505050505050505050505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f590506001600160a01b038116610995576040516330be1a3d60e21b815260040160405180910390fd5b92915050565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052906001600160a01b0383811690851610818082610a11578587610a14565b86865b9150915060008084610a2b57600062032e10610a33565b62032e0f1960005b9150915060008086610a675760007f0000000000000000000000000000000000000000000000000000000000000000610a8b565b7f000000000000000000000000000000000000000000000000000000000000000060005b91509150604051806101600160405280876001600160a01b03168152602001866001600160a01b0316815260200161271062ffffff1681526020018560020b81526020018460020b81526020018381526020018281526020016305f5e10084610af49190611085565b610afe90856110a7565b8152602001610b116305f5e10084611085565b610b1b90846110a7565b815230602082015242604090910152985086610b45576d82f0137f122ce800000000000000610b52565b6a01f4833103afd3d00000005b6dffffffffffffffffffffffffffff169750505050505050509250929050565b6001600160a01b03811681146103a057600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610bc657610bc6610b87565b604052919050565b600067ffffffffffffffff831115610be857610be8610b87565b610bfb601f8401601f1916602001610b9d565b9050828152838383011115610c0f57600080fd5b828260208301376000602084830101529392505050565b60008060008060808587031215610c3c57600080fd5b8435610c4781610b72565b93506020850135610c5781610b72565b925060408501359150606085013567ffffffffffffffff811115610c7a57600080fd5b8501601f81018713610c8b57600080fd5b610c9a87823560208401610bce565b91505092959194509250565b600060208284031215610cb857600080fd5b8135610cc381610b72565b9392505050565b60008060408385031215610cdd57600080fd5b8235610ce881610b72565b915060208381013567ffffffffffffffff80821115610d0657600080fd5b818601915086601f830112610d1a57600080fd5b813581811115610d2c57610d2c610b87565b8060051b9150610d3d848301610b9d565b8181529183018401918481019089841115610d5757600080fd5b938501935b83851015610d7557843582529385019390850190610d5c565b8096505050505050509250929050565b600082601f830112610d9657600080fd5b610cc383833560208501610bce565b60008060408385031215610db857600080fd5b823567ffffffffffffffff80821115610dd057600080fd5b610ddc86838701610d85565b93506020850135915080821115610df257600080fd5b50610dff85828601610d85565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b60008060408385031215610e3257600080fd5b505080516020909101519092909150565b6000815180845260005b81811015610e6957602081850181015186830182015201610e4d565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000610e9c6040830185610e43565b8281036020840152610eae8185610e43565b95945050505050565b60018060a01b0385168152836020820152608060408201526000610ede6080830185610e43565b8281036060840152610ef08185610e43565b979650505050505050565b634e487b7160e01b600052601160045260246000fd5b6001600160601b03818116838216019080821115610f3157610f31610efb565b5092915050565b600060208284031215610f4a57600080fd5b81518015158114610cc357600080fd5b600060208284031215610f6c57600080fd5b8151610cc381610b72565b81516001600160a01b0316815261016081016020830151610fa360208401826001600160a01b03169052565b506040830151610fba604084018262ffffff169052565b506060830151610fcf606084018260020b9052565b506080830151610fe4608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008084015181840152506101208084015161102a828501826001600160a01b03169052565b505061014092830151919092015290565b6000806000806080858703121561105157600080fd5b8451935060208501516001600160801b038116811461106f57600080fd5b6040860151606090960151949790965092505050565b6000826110a257634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561099557610995610efb56fea26469706673582212204249de01420d07751e04eafcdd4b0f8568a682ed196745f46cbe942e1b6ce76864736f6c6343000819003300000000000000000000000071e1bb6ea5b84e9aa55691a1e86223d250a18f8f",
"nonce": "0x59",
"chainId": "0x2105",
"accessList": null,
"type": null
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0x5c3b8e",
"logs": [
{
"address": "0x773fd11afefbcbc7ef98fc51030d99c9f5605904",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000071e1bb6ea5b84e9aa55691a1e86223d250a18f8f"
],
"data": "0x",
"blockHash": "0xf15997d026765f14512d86cb6ec2a6dab00c04ae393f959b3b3c7f053fb29c68",
"blockNumber": "0xcf6cb4",
"transactionHash": "0x9f9bfc693d7588aba11898b537fa1254bd242ada52593435c65ae46563dac673",
"transactionIndex": "0x1f",
"logIndex": "0x7c",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000020000000000000000000000000000400000000000002000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"transactionHash": "0x9f9bfc693d7588aba11898b537fa1254bd242ada52593435c65ae46563dac673",
"transactionIndex": "0x1f",
"blockHash": "0xf15997d026765f14512d86cb6ec2a6dab00c04ae393f959b3b3c7f053fb29c68",
"blockNumber": "0xcf6cb4",
"gasUsed": "0xff333",
"effectiveGasPrice": "0xbeffb87",
"from": "0x711df55d3663c04b2cbced323ce4ece2cbab92b9",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"contractAddress": "0x773fd11afefbcbc7ef98fc51030d99c9f5605904",
"l1Fee": "0x1801108c3e4",
"l1GasPrice": "0x483ada63d",
"l1GasUsed": "0x12dd8"
}
],
"libraries": [],
"pending": [],
"returns": {
"0": {
"internal_type": "contract MetalFunFactory",
"value": "0x773fd11aFeFbcBc7EF98fC51030D99C9f5605904"
}
},
"timestamp": 1713976930,
"chain": 8453,
"commit": "5cb525f"
}

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions broadcast/DeployMetalFunFactoryV2.s.sol/11155111/run-latest.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions broadcast/DeployMetalFunFactoryV2.s.sol/8453/run-1714608651.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions broadcast/DeployMetalFunFactoryV2.s.sol/8453/run-latest.json

Large diffs are not rendered by default.

217 changes: 217 additions & 0 deletions broadcast/DeployMetalFunTokenV2.s.sol/8453/run-1714608914.json

Large diffs are not rendered by default.

217 changes: 217 additions & 0 deletions broadcast/DeployMetalFunTokenV2.s.sol/8453/run-latest.json
Astronaut828 marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[profile.default]
solc_version = "0.8.25"
src = "src"
out = "out"
libs = ["lib"]
Expand All @@ -10,7 +11,11 @@ remappings = [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"gaslite/=lib/gaslitedrop/contracts/src/",
"solady/=lib/solady/src/",
"~/=src/",
]
[fmt]
line_length = 100
tab_width = 4
[fuzz]
runs = 40
1 change: 1 addition & 0 deletions lib/solady
Submodule solady added at bb4b43
23 changes: 23 additions & 0 deletions script/DeployMetalFunFactory.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

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

import {METAL_FUN_FACTORY_SALT} from "../src/Constants.sol";
import {InstantLiquidityToken} from "../src/InstantLiquidityToken.sol";
import {MetalFunFactory} from "../src/MetalFunFactory.sol";

contract DeployMetalFunFactory is Script {
function run() public returns (MetalFunFactory) {
return _run(vm.envAddress("OWNER"));
}

function _run(address _owner) public returns (MetalFunFactory) {
vm.broadcast();
MetalFunFactory metalFunFactory = new MetalFunFactory{salt: METAL_FUN_FACTORY_SALT}(_owner);

console.log("MetalFunFactory", address(metalFunFactory));

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

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

import {METAL_FUN_FACTORY_V2_SALT} from "../src/Constants.sol";
import {InstantLiquidityToken} from "../src/InstantLiquidityToken.sol";
import {MetalFunFactoryV2} from "../src/MetalFunFactoryV2.sol";

contract DeployMetalFunFactory is Script {
function run() public returns (MetalFunFactoryV2) {
return _run(vm.envAddress("OWNER"));
}

function _run(address _owner) public returns (MetalFunFactoryV2) {
vm.broadcast();
MetalFunFactoryV2 metalFunFactoryV2 =
new MetalFunFactoryV2{salt: METAL_FUN_FACTORY_V2_SALT}(_owner);

console.log("MetalFunFactory", address(metalFunFactoryV2));

return metalFunFactoryV2;
}
}
21 changes: 21 additions & 0 deletions script/DeployMetalFunToken.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 {MetalFunFactory, InstantLiquidityToken} from "../src/MetalFunFactory.sol";

contract DeployMetalFunToken is Script {
function run() public {
vm.broadcast();
_run(0x773fd11aFeFbcBc7EF98fC51030D99C9f5605904);
}

function _run(address _factory) public returns (InstantLiquidityToken, uint256) {
MetalFunFactory factory = MetalFunFactory(_factory);
(InstantLiquidityToken token, uint256 lpTokenId) = factory.deploy("", "");

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

return (token, lpTokenId);
}
}
22 changes: 22 additions & 0 deletions script/DeployMetalFunTokenV2.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

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

contract DeployMetalFunTokenV2 is Script {
function run() public {
vm.broadcast();
_run(0xf0E8778E80D0D012c84F45A501122A77eF3Db099);
}

function _run(address _factory) public returns (InstantLiquidityToken, uint256) {
MetalFunFactoryV2 factory = MetalFunFactoryV2(_factory);
(InstantLiquidityToken token, uint256 lpTokenId) =
factory.deploy("", "", 0.01 ether, 1000_000_000, address(0), 0);

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

return (token, lpTokenId);
}
}
2 changes: 2 additions & 0 deletions src/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ uint256 constant OWNER_ALLOCATION = 8_000_000_000 ether;
bytes32 constant LIQUIDITY_TOKEN_SALT = keccak256("INSTANT_LIQUIDITY_TOKEN_V3");
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");
Loading