Skip to main content
Glama

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin
zip-foundry.test.ts.md64.4 kB
# Snapshot report for `src/zip-foundry.test.ts` The actual snapshot is saved in `zip-foundry.test.ts.snap`. Generated by [AVA](https://avajs.dev). ## erc20 full > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address recipient = <Set recipient address here>;␊ address defaultAdmin = <Set defaultAdmin address here>;␊ address pauser = <Set pauser address here>;␊ address minter = <Set minter address here>;␊ MyToken instance = new MyToken(recipient, defaultAdmin, pauser, minter);␊ console.log("Contract deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";␊ import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";␊ import {ERC20FlashMint} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20FlashMint.sol";␊ import {ERC20Pausable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";␊ import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";␊ import {ERC20Votes} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";␊ import {Nonces} from "@openzeppelin/contracts/utils/Nonces.sol";␊ ␊ contract MyToken is ERC20, ERC20Burnable, ERC20Pausable, AccessControl, ERC20Permit, ERC20Votes, ERC20FlashMint {␊ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");␊ bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");␊ ␊ constructor(address recipient, address defaultAdmin, address pauser, address minter)␊ ERC20("My Token", "MTK")␊ ERC20Permit("My Token")␊ {␊ _mint(recipient, 2000 * 10 ** decimals());␊ _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊ _grantRole(PAUSER_ROLE, pauser);␊ _grantRole(MINTER_ROLE, minter);␊ }␊ ␊ function pause() public onlyRole(PAUSER_ROLE) {␊ _pause();␊ }␊ ␊ function unpause() public onlyRole(PAUSER_ROLE) {␊ _unpause();␊ }␊ ␊ function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {␊ _mint(to, amount);␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _update(address from, address to, uint256 value)␊ internal␊ override(ERC20, ERC20Pausable, ERC20Votes)␊ {␊ super._update(from, to, value);␊ }␊ ␊ function nonces(address owner)␊ public␊ view␊ override(ERC20Permit, Nonces)␊ returns (uint256)␊ {␊ return super.nonces(owner);␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address recipient = vm.addr(1);␊ address defaultAdmin = vm.addr(2);␊ address pauser = vm.addr(3);␊ address minter = vm.addr(4);␊ instance = new MyToken(recipient, defaultAdmin, pauser, minter);␊ }␊ ␊ function testName() public view {␊ assertEq(instance.name(), "My Token");␊ }␊ }␊ `, ] ## erc20 ownable, uups, crossChainBridging custom > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address tokenBridge_ = <Set tokenBridge_ address here>;␊ address recipient = <Set recipient address here>;␊ address initialOwner = <Set initialOwner address here>;␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (tokenBridge_, recipient, initialOwner))␊ );␊ MyToken instance = MyToken(proxy);␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";␊ import {ERC20BridgeableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20BridgeableUpgradeable.sol";␊ import {ERC20BurnableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";␊ import {ERC20FlashMintUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20FlashMintUpgradeable.sol";␊ import {ERC20PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol";␊ import {ERC20PermitUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";␊ import {ERC20VotesUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {NoncesUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol";␊ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ contract MyToken is Initializable, ERC20Upgradeable, ERC20BridgeableUpgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable, ERC20FlashMintUpgradeable, UUPSUpgradeable {␊ address public tokenBridge;␊ error Unauthorized();␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address tokenBridge_, address recipient, address initialOwner)␊ public␊ initializer␊ {␊ __ERC20_init("My Token", "MTK");␊ __ERC20Bridgeable_init();␊ __ERC20Burnable_init();␊ __ERC20Pausable_init();␊ __Ownable_init(initialOwner);␊ __ERC20Permit_init("My Token");␊ __ERC20Votes_init();␊ __ERC20FlashMint_init();␊ __UUPSUpgradeable_init();␊ ␊ require(tokenBridge_ != address(0), "Invalid tokenBridge_ address");␊ tokenBridge = tokenBridge_;␊ if (block.chainid == 10) {␊ _mint(recipient, 2000 * 10 ** decimals());␊ }␊ }␊ ␊ function _checkTokenBridge(address caller) internal view override {␊ if (caller != tokenBridge) revert Unauthorized();␊ }␊ ␊ function pause() public onlyOwner {␊ _pause();␊ }␊ ␊ function unpause() public onlyOwner {␊ _unpause();␊ }␊ ␊ function mint(address to, uint256 amount) public onlyOwner {␊ _mint(to, amount);␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyOwner␊ {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _update(address from, address to, uint256 value)␊ internal␊ override(ERC20Upgradeable, ERC20PausableUpgradeable, ERC20VotesUpgradeable)␊ {␊ super._update(from, to, value);␊ }␊ ␊ function nonces(address owner)␊ public␊ view␊ override(ERC20PermitUpgradeable, NoncesUpgradeable)␊ returns (uint256)␊ {␊ return super.nonces(owner);␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address tokenBridge_ = vm.addr(1);␊ address recipient = vm.addr(2);␊ address initialOwner = vm.addr(3);␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (tokenBridge_, recipient, initialOwner))␊ );␊ instance = MyToken(proxy);␊ }␊ ␊ function testName() public view {␊ assertEq(instance.name(), "My Token");␊ }␊ }␊ `, ] ## erc20 uups, roles > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address defaultAdmin = <Set defaultAdmin address here>;␊ address upgrader = <Set upgrader address here>;␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (defaultAdmin, upgrader))␊ );␊ MyToken instance = MyToken(proxy);␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";␊ import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";␊ import {ERC20PermitUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ contract MyToken is Initializable, ERC20Upgradeable, ERC20PermitUpgradeable, AccessControlUpgradeable, UUPSUpgradeable {␊ bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address defaultAdmin, address upgrader) public initializer {␊ __ERC20_init("My Token", "MTK");␊ __ERC20Permit_init("My Token");␊ __AccessControl_init();␊ __UUPSUpgradeable_init();␊ ␊ _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊ _grantRole(UPGRADER_ROLE, upgrader);␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyRole(UPGRADER_ROLE)␊ {}␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address defaultAdmin = vm.addr(1);␊ address upgrader = vm.addr(2);␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (defaultAdmin, upgrader))␊ );␊ instance = MyToken(proxy);␊ }␊ ␊ function testName() public view {␊ assertEq(instance.name(), "My Token");␊ }␊ }␊ `, ] ## erc721 uups, ownable > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address initialOwner = <Set initialOwner address here>;␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (initialOwner))␊ );␊ MyToken instance = MyToken(proxy);␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ contract MyToken is Initializable, ERC721Upgradeable, OwnableUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address initialOwner) public initializer {␊ __ERC721_init("My Token", "MTK");␊ __Ownable_init(initialOwner);␊ __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyOwner␊ {}␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address initialOwner = vm.addr(1);␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyToken.sol",␊ abi.encodeCall(MyToken.initialize, (initialOwner))␊ );␊ instance = MyToken(proxy);␊ }␊ ␊ function testName() public view {␊ assertEq(instance.name(), "My Token");␊ }␊ }␊ `, ] ## erc1155 basic > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address initialOwner = <Set initialOwner address here>;␊ MyToken instance = new MyToken(initialOwner);␊ console.log("Contract deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";␊ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";␊ ␊ contract MyToken is ERC1155, Ownable {␊ constructor(address initialOwner)␊ ERC1155("https://myuri/{id}")␊ Ownable(initialOwner)␊ {}␊ ␊ function setURI(string memory newuri) public onlyOwner {␊ _setURI(newuri);␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address initialOwner = vm.addr(1);␊ instance = new MyToken(initialOwner);␊ }␊ ␊ function testUri() public view {␊ assertEq(instance.uri(0), "https://myuri/{id}");␊ }␊ }␊ `, ] ## erc1155 transparent, ownable > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyToken.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address initialOwner = <Set initialOwner address here>;␊ address proxy = Upgrades.deployTransparentProxy(␊ "MyToken.sol",␊ initialOwner,␊ abi.encodeCall(MyToken.initialize, (initialOwner))␊ );␊ MyToken instance = MyToken(proxy);␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";␊ ␊ contract MyToken is Initializable, ERC1155Upgradeable, OwnableUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address initialOwner) public initializer {␊ __ERC1155_init("https://myuri/{id}");␊ __Ownable_init(initialOwner);␊ }␊ ␊ function setURI(string memory newuri) public onlyOwner {␊ _setURI(newuri);␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyToken} from "src/MyToken.sol";␊ ␊ contract MyTokenTest is Test {␊ MyToken public instance;␊ ␊ function setUp() public {␊ address initialOwner = vm.addr(1);␊ address proxy = Upgrades.deployTransparentProxy(␊ "MyToken.sol",␊ initialOwner,␊ abi.encodeCall(MyToken.initialize, (initialOwner))␊ );␊ instance = MyToken(proxy);␊ }␊ ␊ function testUri() public view {␊ assertEq(instance.uri(0), "https://myuri/{id}");␊ }␊ }␊ `, ] ## account ecdsa > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyAccount.s.sol␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address signer = <Set signer address here>;␊ MyAccount instance = new MyAccount(signer);␊ console.log("Contract deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ constructor(address signer) EIP712("My Account", "1") SignerECDSA(signer) {}␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountTest is Test {␊ MyAccount public instance;␊ ␊ function setUp() public {␊ address signer = vm.addr(1);␊ instance = new MyAccount(signer);␊ }␊ ␊ function testSomething() public {␊ // Add your test here␊ }␊ }␊ `, ] ## account ecdsa uups > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyAccount.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address signer = <Set signer address here>;␊ Options memory opts;␊ opts.unsafeAllow = "constructor";␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyAccount.sol",␊ abi.encodeCall(MyAccount.initialize, (signer)),␊ opts␊ );␊ MyAccount instance = MyAccount(payable(proxy));␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("My Account", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyEntryPointOrSelf␊ {}␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountTest is Test {␊ MyAccount public instance;␊ ␊ function setUp() public {␊ address signer = vm.addr(1);␊ Options memory opts;␊ opts.unsafeAllow = "constructor";␊ address proxy = Upgrades.deployUUPSProxy(␊ "MyAccount.sol",␊ abi.encodeCall(MyAccount.initialize, (signer)),␊ opts␊ );␊ instance = MyAccount(payable(proxy));␊ }␊ ␊ function testSomething() public {␊ // Add your test here␊ }␊ }␊ `, ] ## custom basic > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyContract.s.sol␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {MyContract} from "src/MyContract.sol";␊ ␊ contract MyContractScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ vm.startBroadcast();␊ MyContract instance = new MyContract();␊ console.log("Contract deployed to %s", address(instance));␊ vm.stopBroadcast();␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ contract MyContract {␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {MyContract} from "src/MyContract.sol";␊ ␊ contract MyContractTest is Test {␊ MyContract public instance;␊ ␊ function setUp() public {␊ instance = new MyContract();␊ }␊ ␊ function testSomething() public {␊ // Add your test here␊ }␊ }␊ `, ] ## custom transparent, managed > Snapshot 1 [ `#!/usr/bin/env bash␊ ␊ # Check if git is installed␊ if ! which git &> /dev/null␊ then␊ echo "git command not found. Install git and try again."␊ exit 1␊ fi␊ ␊ # Check if Foundry is installed␊ if ! which forge &> /dev/null␊ then␊ echo "forge command not found. Install Foundry and try again. See https://book.getfoundry.sh/getting-started/installation"␊ exit 1␊ fi␊ ␊ # Setup Foundry project␊ if ! [ -f "foundry.toml" ]␊ then␊ echo "Initializing Foundry project..."␊ ␊ # Backup Wizard template readme to avoid it being overwritten␊ mv README.md README-oz.md␊ ␊ # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ rm script/Counter.s.sol␊ rm test/Counter.t.sol␊ rm README.md␊ ␊ # Restore Wizard template readme␊ mv README-oz.md README.md␊ ␊ # Add remappings␊ if [ -f "remappings.txt" ]␊ then␊ echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ echo "ast = true" >> foundry.toml␊ echo "build_info = true" >> foundry.toml␊ echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ git commit -m "openzeppelin: add wizard output" --quiet␊ ␊ echo "Done."␊ else␊ echo "Foundry project already initialized."␊ fi␊ `, `# Sample Foundry Project␊ ␊ This project demonstrates a basic Foundry use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that deploys that contract.␊ ␊ ## Installing Foundry␊ ␊ See [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation).␊ ␊ ## Initializing the project␊ ␊ \`\`\`␊ bash setup.sh␊ \`\`\`␊ ␊ ## Testing the contract␊ ␊ \`\`\`␊ forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ ␊ You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ forge script script/MyContract.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyContract} from "src/MyContract.sol";␊ ␊ contract MyContractScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ // TODO: Set addresses for the variables below, then uncomment the following section:␊ /*␊ vm.startBroadcast();␊ address initialOwner = <Set initialOwner address here>;␊ address initialAuthority = <Set initialAuthority address here>;␊ address proxy = Upgrades.deployTransparentProxy(␊ "MyContract.sol",␊ initialOwner,␊ abi.encodeCall(MyContract.initialize, (initialAuthority))␊ );␊ MyContract instance = MyContract(proxy);␊ console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ */␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ ␊ contract MyContract is Initializable, AccessManagedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address initialAuthority) public initializer {␊ __AccessManaged_init(initialAuthority);␊ }␊ }␊ `, `// SPDX-License-Identifier: MIT␊ pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyContract} from "src/MyContract.sol";␊ ␊ contract MyContractTest is Test {␊ MyContract public instance;␊ ␊ function setUp() public {␊ address initialOwner = vm.addr(1);␊ address initialAuthority = vm.addr(2);␊ address proxy = Upgrades.deployTransparentProxy(␊ "MyContract.sol",␊ initialOwner,␊ abi.encodeCall(MyContract.initialize, (initialAuthority))␊ );␊ instance = MyContract(proxy);␊ }␊ ␊ function testSomething() public {␊ // Add your test here␊ }␊ }␊ `, ]

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OpenZeppelin/contracts-wizard'

If you have feedback or need assistance with the MCP directory API, please join our Discord server