From 79f955c63ef7fa3728ff85f1658dd506eb88c01c Mon Sep 17 00:00:00 2001 From: Matthew Pereira Date: Fri, 21 Jun 2024 20:11:11 -0700 Subject: [PATCH] refactor deploy scripts using foundry best practices --- packages/foundry/package.json | 5 +- .../foundry/script/00_DeployMockTokens.s.sol | 36 + .../foundry/script/01_DeployFactory.s.sol | 36 + .../{DeployPool.s.sol => 02_DeployPool.s.sol} | 45 +- .../foundry/script/DeployFactoryAndPool.s.sol | 87 --- .../foundry/script/ScaffoldETHDeploy.s.sol | 1 + packages/foundry/script/generateTsAbis.js | 71 +- packages/foundry/utils/HelperConfig.sol | 40 +- .../nextjs/contracts/deployedContracts.ts | 706 ------------------ 9 files changed, 132 insertions(+), 895 deletions(-) create mode 100644 packages/foundry/script/00_DeployMockTokens.s.sol create mode 100644 packages/foundry/script/01_DeployFactory.s.sol rename packages/foundry/script/{DeployPool.s.sol => 02_DeployPool.s.sol} (76%) delete mode 100644 packages/foundry/script/DeployFactoryAndPool.s.sol diff --git a/packages/foundry/package.json b/packages/foundry/package.json index 88b993b5..bdcd41e4 100644 --- a/packages/foundry/package.json +++ b/packages/foundry/package.json @@ -5,8 +5,9 @@ "account": "node script/ListAccount.js", "chain": "anvil --config-out localhost.json", "compile": "forge compile", - "deploy:all": "forge build --build-info --build-info-path out/build-info/ && forge script script/DeployFactoryAndPool.s.sol --rpc-url ${1:-default_network} --broadcast --legacy && node script/generateTsAbis.js", - "deploy:pool": "forge build --build-info --build-info-path out/build-info/ && forge script script/DeployPool.s.sol --rpc-url ${1:-default_network} --broadcast", + "deploy:tokens": "forge build --build-info --build-info-path out/build-info/ && forge script script/00_DeployMockTokens.s.sol --rpc-url ${1:-default_network} --broadcast --legacy", + "deploy:factory": "forge build --build-info --build-info-path out/build-info/ && forge script script/01_DeployFactory.s.sol --rpc-url ${1:-default_network} --broadcast --legacy && node script/generateTsAbis.js", + "deploy:pool": "forge build --build-info --build-info-path out/build-info/ && forge script script/02_DeployPool.s.sol --rpc-url ${1:-default_network} --broadcast", "deploy:verify": "forge build --build-info --build-info-path out/build-info/ && forge script script/DeployFactoryAndPool.s.sol --rpc-url ${1:-default_network} --broadcast --legacy --verify ; node script/generateTsAbis.js", "flatten": "forge flatten", "fork": "anvil --fork-url ${0:-sepolia} --chain-id 31337 --config-out localhost.json", diff --git a/packages/foundry/script/00_DeployMockTokens.s.sol b/packages/foundry/script/00_DeployMockTokens.s.sol new file mode 100644 index 00000000..4c94208e --- /dev/null +++ b/packages/foundry/script/00_DeployMockTokens.s.sol @@ -0,0 +1,36 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import { ScaffoldETHDeploy, console } from "./ScaffoldETHDeploy.s.sol"; +import { MockToken1 } from "../contracts/MockToken1.sol"; +import { MockToken2 } from "../contracts/MockToken2.sol"; + +/** + * @title Deploy Mock Tokens + * @dev run this script with `yarn deploy:tokens` + */ +contract DeployMockTokens is ScaffoldETHDeploy { + function run() external virtual { + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + if (deployerPrivateKey == 0) { + revert InvalidPrivateKey( + "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" + ); + } + + vm.startBroadcast(deployerPrivateKey); + MockToken1 scUSD = new MockToken1("Scaffold USD", "scUSD"); + MockToken2 scDAI = new MockToken2("Scaffold DAI", "scDAI"); + console.log("Deployed MockToken1 Address: %s", address(scUSD)); + console.log("Deployed MockToken2 Address: %s", address(scDAI)); + vm.stopBroadcast(); + + // TODO: figure out how to carry contract info from foundry to nextjs for more than a single deploy script + // /** + // * This function generates the file containing the contracts Abi definitions. + // * These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example. + // * This function should be called last. + // */ + // exportDeployments(); + } +} diff --git a/packages/foundry/script/01_DeployFactory.s.sol b/packages/foundry/script/01_DeployFactory.s.sol new file mode 100644 index 00000000..62667f5f --- /dev/null +++ b/packages/foundry/script/01_DeployFactory.s.sol @@ -0,0 +1,36 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import { ScaffoldETHDeploy, console } from "./ScaffoldETHDeploy.s.sol"; +import { CustomPoolFactory } from "../contracts/CustomPoolFactory.sol"; +import { HelperConfig } from "../utils/HelperConfig.sol"; + +/** + * @title Deploy Factory + * @dev Set the factory pauseWindowDuration in `HelperConfig.sol` + * @dev Run this script with `yarn deploy:factory` + */ +contract DeployFactory is HelperConfig, ScaffoldETHDeploy { + function run() external virtual { + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + if (deployerPrivateKey == 0) { + revert InvalidPrivateKey( + "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" + ); + } + + HelperConfig helperConfig = new HelperConfig(); + uint32 pauseWindowDuration = helperConfig.getFactoryConfig(); + vm.startBroadcast(deployerPrivateKey); + CustomPoolFactory factory = new CustomPoolFactory(vault, pauseWindowDuration); + console.log("Deployed Factory Address: %s", address(factory)); + vm.stopBroadcast(); + + /** + * This function generates the file containing the contracts Abi definitions. + * These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example. + * This function should be called last. + */ + exportDeployments(); + } +} diff --git a/packages/foundry/script/DeployPool.s.sol b/packages/foundry/script/02_DeployPool.s.sol similarity index 76% rename from packages/foundry/script/DeployPool.s.sol rename to packages/foundry/script/02_DeployPool.s.sol index d7c421b7..d9476f4b 100644 --- a/packages/foundry/script/DeployPool.s.sol +++ b/packages/foundry/script/02_DeployPool.s.sol @@ -8,25 +8,17 @@ import { DevOpsTools } from "lib/foundry-devops/src/DevOpsTools.sol"; import { Script, console } from "forge-std/Script.sol"; import { RegistrationConfig, InitializationConfig } from "../utils/PoolTypes.sol"; -import { - TokenConfig, - LiquidityManagement, - PoolRoleAccounts -} from "@balancer-labs/v3-interfaces/contracts/vault/VaultTypes.sol"; import { InputHelpers } from "@balancer-labs/v3-solidity-utils/contracts/helpers/InputHelpers.sol"; /** * @title Deploy Pool Script - * @notice This script creates a new pool using the most recently deployed pool factory and then initializes it - * @notice This script can be run directly with `yarn deploy:pool`, but is also inherited by the `DeployFactoryAndPool.s.sol` script + * @notice This script deploys a new pool using the most recently deployed pool factory and mock tokens + * @dev Set the pool registration and initialization configurations in `HelperConfig.sol` + * @dev Run this script with `yarn deploy:pool` */ contract DeployPool is HelperConfig, Script { error InvalidPrivateKey(string); - /** - * @dev Set your pool deployment and initialization configurations in `HelperConfig.sol` - * @dev Deploy only the pool with the CLI command `yarn deploy:pool` - */ function run() external virtual { uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); if (deployerPrivateKey == 0) { @@ -35,6 +27,7 @@ contract DeployPool is HelperConfig, Script { ); } + // Grab the most recently deployed addresses of mock tokens and factory address mockToken1 = DevOpsTools.get_most_recent_deployment( "MockToken1", // Must match the mock token contract name block.chainid @@ -43,22 +36,18 @@ contract DeployPool is HelperConfig, Script { "MockToken2", // Must match the mock token contract name block.chainid ); - - // Generate all configurations from `HelperConfig.sol` - HelperConfig helperConfig = new HelperConfig(); - RegistrationConfig memory regConfig = helperConfig.getPoolConfig( - "Scaffold Balancer Constant Price Pool #2", // name for the pool - "POOL2-SB-50scUSD-50scDAI", // symbol for the BPT - mockToken1, - mockToken2 - ); - InitializationConfig memory poolInitConfig = helperConfig.getInitializationConfig(regConfig.tokenConfig); - // Get the most recently deployed address of the pool factory address poolFactoryAddress = DevOpsTools.get_most_recent_deployment( "CustomPoolFactory", // Must match the pool factory contract name block.chainid ); CustomPoolFactory factory = CustomPoolFactory(poolFactoryAddress); + + // Set all pool configurations from `HelperConfig.sol` + HelperConfig helperConfig = new HelperConfig(); + RegistrationConfig memory regConfig = helperConfig.getPoolConfig(mockToken1, mockToken2); + InitializationConfig memory initConfig = helperConfig.getInitializationConfig(regConfig.tokenConfig); + + vm.startBroadcast(deployerPrivateKey); // Deploy the pool (and register it with the vault) address newPool = factory.create( regConfig.name, @@ -72,14 +61,14 @@ contract DeployPool is HelperConfig, Script { regConfig.liquidityManagement ); console.log("Deployed pool at address: %s", newPool); - IERC20[] memory tokens = InputHelpers.sortTokens(poolInitConfig.tokens); + // Initialize the pool initializePool( newPool, - tokens, - poolInitConfig.exactAmountsIn, - poolInitConfig.minBptAmountOut, - poolInitConfig.wethIsEth, - poolInitConfig.userData + InputHelpers.sortTokens(initConfig.tokens), + initConfig.exactAmountsIn, + initConfig.minBptAmountOut, + initConfig.wethIsEth, + initConfig.userData ); vm.stopBroadcast(); } diff --git a/packages/foundry/script/DeployFactoryAndPool.s.sol b/packages/foundry/script/DeployFactoryAndPool.s.sol deleted file mode 100644 index 480a489e..00000000 --- a/packages/foundry/script/DeployFactoryAndPool.s.sol +++ /dev/null @@ -1,87 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import { DeployPool } from "./DeployPool.s.sol"; -import { ScaffoldETHDeploy, console } from "./ScaffoldETHDeploy.s.sol"; -import { CustomPoolFactory } from "../contracts/CustomPoolFactory.sol"; -import { HelperConfig } from "../utils/HelperConfig.sol"; -import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol"; -import { RegistrationConfig, InitializationConfig } from "../utils/PoolTypes.sol"; - -import { - TokenConfig, - LiquidityManagement, - PoolRoleAccounts -} from "@balancer-labs/v3-interfaces/contracts/vault/VaultTypes.sol"; -import { ArrayHelpers } from "@balancer-labs/v3-solidity-utils/contracts/helpers/ArrayHelpers.sol"; -import { InputHelpers } from "@balancer-labs/v3-solidity-utils/contracts/helpers/InputHelpers.sol"; - -/** - * @title Deploy Factory And Pool Script - * @notice Contracts deployed by this script will have their info saved into the frontend for hot reload - * @notice This script deploys a pool factory, deploys a pool using the factory, and then initializes the pool with mock tokens - * @notice Mock tokens and BPT will be sent to the PK set in the .env file - * @dev Set the pool factory, pool deployment, and pool initialization configurations in `HelperConfig.sol` - * @dev Then run this script with `yarn deploy:all` - */ -contract DeployFactoryAndPool is ScaffoldETHDeploy, DeployPool { - function run() external override { - uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); - if (deployerPrivateKey == 0) { - revert InvalidPrivateKey( - "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" - ); - } - - // Deploy mock tokens. Remove this if using already deployed tokens - vm.startBroadcast(deployerPrivateKey); - (address mockToken1, address mockToken2) = deployMockTokens(); - vm.stopBroadcast(); - - // Look up all configuration from `HelperConfig.sol` - HelperConfig helperConfig = new HelperConfig(); - uint32 pauseWindowDuration = helperConfig.getFactoryConfig(); - RegistrationConfig memory regConfig = helperConfig.getPoolConfig( - "Scaffold Balancer Constant Price Pool #1", // name for the pool - "SB-50scUSD-50scDAI", // symbol for the BPT - mockToken1, - mockToken2 - ); - InitializationConfig memory initConfig = helperConfig.getInitializationConfig(regConfig.tokenConfig); - - // Deploy the pool factory - vm.startBroadcast(deployerPrivateKey); - CustomPoolFactory factory = new CustomPoolFactory(vault, pauseWindowDuration); - console.log("Deployed Factory Address: %s", address(factory)); - // Deploy the pool (and register it with the vault) - address newPool = factory.create( - regConfig.name, - regConfig.symbol, - regConfig.salt, - helperConfig.sortTokenConfig(regConfig.tokenConfig), - regConfig.swapFeePercentage, - regConfig.protocolFeeExempt, - regConfig.roleAccounts, - regConfig.poolHooksContract, - regConfig.liquidityManagement - ); - console.log("Deployed pool at address: %s", newPool); - // Initialize the pool - initializePool( - newPool, - InputHelpers.sortTokens(initConfig.tokens), - initConfig.exactAmountsIn, - initConfig.minBptAmountOut, - initConfig.wethIsEth, - initConfig.userData - ); - vm.stopBroadcast(); - - /** - * This function generates the file containing the contracts Abi definitions. - * These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example. - * This function should be called last. - */ - exportDeployments(); - } -} diff --git a/packages/foundry/script/ScaffoldETHDeploy.s.sol b/packages/foundry/script/ScaffoldETHDeploy.s.sol index b8bfe3ff..8932b495 100644 --- a/packages/foundry/script/ScaffoldETHDeploy.s.sol +++ b/packages/foundry/script/ScaffoldETHDeploy.s.sol @@ -6,6 +6,7 @@ import "forge-std/Vm.sol"; contract ScaffoldETHDeploy is Script { error InvalidChain(); + error InvalidPrivateKey(string); struct Deployment { string name; diff --git a/packages/foundry/script/generateTsAbis.js b/packages/foundry/script/generateTsAbis.js index e96f41b7..1ddb8f55 100644 --- a/packages/foundry/script/generateTsAbis.js +++ b/packages/foundry/script/generateTsAbis.js @@ -1,8 +1,8 @@ -const fs = require("fs"); -const path = require("path"); +const fs = require('fs'); +const path = require('path'); //@ts-expect-error This script runs after `forge deploy` therefore its deterministic that it will present // const deployments = require("../deployments.json"); -const prettier = require("prettier"); +const prettier = require('prettier'); const generatedContractComment = ` /** @@ -13,23 +13,17 @@ const generatedContractComment = ` function getDirectories(path) { return fs.readdirSync(path).filter(function (file) { - return fs.statSync(path + "/" + file).isDirectory(); + return fs.statSync(path + '/' + file).isDirectory(); }); } function getFiles(path) { return fs.readdirSync(path).filter(function (file) { - return fs.statSync(path + "/" + file).isFile(); + return fs.statSync(path + '/' + file).isFile(); }); } function getArtifactOfContract(contractName) { - const current_path_to_artifacts = path.join( - __dirname, - "..", - `out/${contractName}.sol` - ); - const artifactJson = JSON.parse( - fs.readFileSync(`${current_path_to_artifacts}/${contractName}.json`) - ); + const current_path_to_artifacts = path.join(__dirname, '..', `out/${contractName}.sol`); + const artifactJson = JSON.parse(fs.readFileSync(`${current_path_to_artifacts}/${contractName}.json`)); return artifactJson; } @@ -38,11 +32,9 @@ function getInheritedFromContracts(artifact) { let inheritedFromContracts = []; if (artifact?.ast) { for (const astNode of artifact.ast.nodes) { - if (astNode.nodeType == "ContractDefinition") { + if (astNode.nodeType == 'ContractDefinition') { if (astNode.baseContracts.length > 0) { - inheritedFromContracts = astNode.baseContracts.map( - ({ baseName }) => baseName.name - ); + inheritedFromContracts = astNode.baseContracts.map(({ baseName }) => baseName.name); } } } @@ -59,7 +51,7 @@ function getInheritedFunctions(mainArtifact) { ast: { absolutePath }, } = getArtifactOfContract(inheritanceContractName); for (const abiEntry of abi) { - if (abiEntry.type == "function") { + if (abiEntry.type == 'function') { inheritedFunctions[abiEntry.name] = absolutePath; } } @@ -68,12 +60,9 @@ function getInheritedFunctions(mainArtifact) { } function main() { - const current_path_to_broadcast = path.join( - __dirname, - "..", - "broadcast/DeployFactoryAndPool.s.sol" - ); - const current_path_to_deployments = path.join(__dirname, "..", "deployments"); + const current_path_to_broadcast = path.join(__dirname, '..', 'broadcast/01_DeployFactory.s.sol'); + console.log('current_path_to_broadcast', current_path_to_broadcast); + const current_path_to_deployments = path.join(__dirname, '..', 'deployments'); const chains = getDirectories(current_path_to_broadcast); const Deploymentchains = getFiles(current_path_to_deployments); @@ -81,11 +70,9 @@ function main() { const deployments = {}; Deploymentchains.forEach((chain) => { - if (!chain.endsWith(".json")) return; + if (!chain.endsWith('.json')) return; chain = chain.slice(0, -5); - var deploymentObject = JSON.parse( - fs.readFileSync(`${current_path_to_deployments}/${chain}.json`) - ); + var deploymentObject = JSON.parse(fs.readFileSync(`${current_path_to_deployments}/${chain}.json`)); deployments[chain] = deploymentObject; }); @@ -93,18 +80,13 @@ function main() { chains.forEach((chain) => { allGeneratedContracts[chain] = {}; - const broadCastObject = JSON.parse( - fs.readFileSync(`${current_path_to_broadcast}/${chain}/run-latest.json`) - ); + const broadCastObject = JSON.parse(fs.readFileSync(`${current_path_to_broadcast}/${chain}/run-latest.json`)); const transactionsCreate = broadCastObject.transactions.filter( - (transaction) => transaction.transactionType == "CREATE" + (transaction) => transaction.transactionType == 'CREATE' ); transactionsCreate.forEach((transaction) => { const artifact = getArtifactOfContract(transaction.contractName); - allGeneratedContracts[chain][ - deployments[chain][transaction.contractAddress] || - transaction.contractName - ] = { + allGeneratedContracts[chain][deployments[chain][transaction.contractAddress] || transaction.contractName] = { address: transaction.contractAddress, abi: artifact.abi, inheritedFunctions: getInheritedFunctions(artifact), @@ -112,18 +94,11 @@ function main() { }); }); - const TARGET_DIR = "../nextjs/contracts/"; + const TARGET_DIR = '../nextjs/contracts/'; - const fileContent = Object.entries(allGeneratedContracts).reduce( - (content, [chainId, chainConfig]) => { - return `${content}${parseInt(chainId).toFixed(0)}:${JSON.stringify( - chainConfig, - null, - 2 - )},`; - }, - "" - ); + const fileContent = Object.entries(allGeneratedContracts).reduce((content, [chainId, chainConfig]) => { + return `${content}${parseInt(chainId).toFixed(0)}:${JSON.stringify(chainConfig, null, 2)},`; + }, ''); if (!fs.existsSync(TARGET_DIR)) { fs.mkdirSync(TARGET_DIR); @@ -134,7 +109,7 @@ function main() { `${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n const deployedContracts = {${fileContent}} as const; \n\n export default deployedContracts satisfies GenericContractsDeclaration`, { - parser: "typescript", + parser: 'typescript', } ) ); diff --git a/packages/foundry/utils/HelperConfig.sol b/packages/foundry/utils/HelperConfig.sol index 0c940f31..82556962 100644 --- a/packages/foundry/utils/HelperConfig.sol +++ b/packages/foundry/utils/HelperConfig.sol @@ -29,15 +29,6 @@ contract HelperConfig { // Canonical permit2 Sepolia address IPermit2 public permit2 = IPermit2(0x000000000022D473030F116dDEE9F6B43aC78BA3); - /** - * @notice Creates mock tokens for the pool and mints 1000 of each to the deployer wallet - */ - function deployMockTokens() internal returns (address, address) { - MockToken1 scUSD = new MockToken1("Scaffold USD", "scUSD"); - MockToken2 scDAI = new MockToken2("Scaffold DAI", "scDAI"); - return (address(scDAI), address(scUSD)); - } - /** * @dev Set the pool factory configuration here */ @@ -46,19 +37,18 @@ contract HelperConfig { } /** - * @dev Set the name, symbol, and token configuration for the pool here - * @dev TokenConfig encapsulates the data required for the Vault to support a token of the given type. For STANDARD tokens, - * the rate provider address must be 0, and paysYieldFees must be false. All WITH_RATE tokens need a rate provider, - * and may or may not be yield-bearing. + * @dev Set all of the configurations for deploying and registering a pool here */ - function getPoolConfig( - string memory name, - string memory symbol, - address token1, - address token2 - ) public pure returns (RegistrationConfig memory poolSettings) { - bytes32 salt = keccak256(abi.encode(name)); // salt for the pool deployment + function getPoolConfig(address token1, address token2) public pure returns (RegistrationConfig memory regConfig) { + string memory name = "Scaffold Balancer Constant Price Pool #2"; // name for the pool + string memory symbol = "POOL2-SB-50scUSD-50scDAI"; // symbol for the BPT + bytes32 salt = keccak256(abi.encode(name)); // salt for the pool deployment via factory + /** + * TokenConfig encapsulates the data required for the Vault to support a token of the given type. For STANDARD tokens, + * the rate provider address must be 0, and paysYieldFees must be false. All WITH_RATE tokens need a rate provider, + * and may or may not be yield-bearing. + */ TokenConfig[] memory tokenConfig = new TokenConfig[](2); // An array of descriptors for the tokens the pool will manage. tokenConfig[0] = TokenConfig({ // Make sure to have proper token order (alphanumeric) token: IERC20(token1), @@ -87,7 +77,7 @@ contract HelperConfig { enableRemoveLiquidityCustom: false }); - poolSettings = RegistrationConfig({ + regConfig = RegistrationConfig({ name: name, symbol: symbol, salt: salt, @@ -110,8 +100,8 @@ contract HelperConfig { tokens[0] = tokenConfig[0].token; tokens[1] = tokenConfig[1].token; uint256[] memory exactAmountsIn = new uint256[](2); // Exact amounts of tokens to be added, sorted in token alphanumeric order - exactAmountsIn[0] = 1 ether; // amount of token1 to send during pool initialization - exactAmountsIn[1] = 1 ether; // amount of token2 to send during pool initialization + exactAmountsIn[0] = 10 ether; // amount of token1 to send during pool initialization + exactAmountsIn[1] = 10 ether; // amount of token2 to send during pool initialization uint256 minBptAmountOut = 1 ether; // Minimum amount of pool tokens to be received bool wethIsEth = false; // If true, incoming ETH will be wrapped to WETH; otherwise the Vault will pull WETH tokens bytes memory userData = bytes(""); // Additional (optional) data required for adding initial liquidity @@ -125,6 +115,9 @@ contract HelperConfig { }); } + /** + * Helper function to sort the tokenConfig array + */ function sortTokenConfig(TokenConfig[] memory tokenConfig) public pure returns (TokenConfig[] memory) { for (uint256 i = 0; i < tokenConfig.length - 1; i++) { for (uint256 j = 0; j < tokenConfig.length - i - 1; j++) { @@ -134,7 +127,6 @@ contract HelperConfig { } } } - return tokenConfig; } } diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 04e6a784..a9a914e5 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -6,712 +6,6 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { 31337: { - MockToken1: { - address: "0x579bB3a775c831526D5E94EF9ccd6601F62790Bc", - abi: [ - { - type: "constructor", - inputs: [ - { - name: "name", - type: "string", - internalType: "string", - }, - { - name: "symbol", - type: "string", - internalType: "string", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "allowance", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "approve", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "balanceOf", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "decimals", - inputs: [], - outputs: [ - { - name: "", - type: "uint8", - internalType: "uint8", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "mint", - inputs: [ - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "name", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "symbol", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "totalSupply", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "transfer", - inputs: [ - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "transferFrom", - inputs: [ - { - name: "from", - type: "address", - internalType: "address", - }, - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "Approval", - inputs: [ - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "spender", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Transfer", - inputs: [ - { - name: "from", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "to", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ERC20InsufficientAllowance", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "allowance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InsufficientBalance", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "balance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidApprover", - inputs: [ - { - name: "approver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidReceiver", - inputs: [ - { - name: "receiver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSender", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSpender", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - }, - ], - inheritedFunctions: { - allowance: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - approve: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - balanceOf: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - decimals: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - name: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - symbol: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - totalSupply: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - transfer: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - transferFrom: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - }, - }, - MockToken2: { - address: "0x3626DEff4AFB3Acd8f217288cd33FBE3a337Ce0B", - abi: [ - { - type: "constructor", - inputs: [ - { - name: "name", - type: "string", - internalType: "string", - }, - { - name: "symbol", - type: "string", - internalType: "string", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "allowance", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "approve", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "balanceOf", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "decimals", - inputs: [], - outputs: [ - { - name: "", - type: "uint8", - internalType: "uint8", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "mint", - inputs: [ - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "name", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "symbol", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "totalSupply", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "transfer", - inputs: [ - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "transferFrom", - inputs: [ - { - name: "from", - type: "address", - internalType: "address", - }, - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "Approval", - inputs: [ - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "spender", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Transfer", - inputs: [ - { - name: "from", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "to", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ERC20InsufficientAllowance", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "allowance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InsufficientBalance", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "balance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidApprover", - inputs: [ - { - name: "approver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidReceiver", - inputs: [ - { - name: "receiver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSender", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSpender", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - }, - ], - inheritedFunctions: { - allowance: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - approve: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - balanceOf: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - decimals: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - name: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - symbol: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - totalSupply: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - transfer: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - transferFrom: "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol", - }, - }, CustomPoolFactory: { address: "0x69221a99e5Bc30E0cf891992e958E3Ba3815bfc6", abi: [