Skip to main content
Glama

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin
contract.test.ts.md6.04 kB
# Snapshot report for `src/contract.test.ts` The actual snapshot is saved in `contract.test.ts.snap`. Generated by [AVA](https://avajs.dev). ## contract basics > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ }␊ ` ## contract with constructor code > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ ␊ #[constructor]␊ fn constructor(ref self: ContractState) {␊ someFunction();␊ }␊ }␊ ` ## contract with constructor code with semicolon > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ ␊ #[constructor]␊ fn constructor(ref self: ContractState) {␊ someFunction();␊ }␊ }␊ ` ## contract with function code before > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ ␊ #[generate_trait]␊ #[abi(per_item)]␊ impl External of ExternalTrait {␊ #[external(v0)]␊ fn someFunction() {␊ before();␊ someFunction();␊ }␊ }␊ }␊ ` ## contract with function code before with semicolons > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ ␊ #[generate_trait]␊ #[abi(per_item)]␊ impl External of ExternalTrait {␊ #[external(v0)]␊ fn someFunction() {␊ before();␊ someFunction();␊ }␊ }␊ }␊ ` ## contract with initializer params > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ use some::path::FooComponent;␊ ␊ component!(path: FooComponent, storage: foo, event: FooEvent);␊ ␊ // External␊ #[abi(embed_v0)]␊ impl FooImpl = FooComponent::FooImpl<ContractState>;␊ ␊ // Internal␊ impl FooInternalImpl = FooComponent::InternalImpl<ContractState>;␊ ␊ #[storage]␊ struct Storage {␊ #[substorage(v0)]␊ foo: FooComponent::Storage,␊ }␊ ␊ #[event]␊ #[derive(Drop, starknet::Event)]␊ enum Event {␊ #[flat]␊ FooEvent: FooComponent::Event,␊ }␊ ␊ #[constructor]␊ fn constructor(ref self: ContractState) {␊ self.foo.initializer("param1");␊ }␊ }␊ ` ## contract with standalone import > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ use some::library::SomeLibrary;␊ use some::path::FooComponent;␊ ␊ component!(path: FooComponent, storage: foo, event: FooEvent);␊ ␊ // External␊ #[abi(embed_v0)]␊ impl FooImpl = FooComponent::FooImpl<ContractState>;␊ ␊ // Internal␊ impl FooInternalImpl = FooComponent::InternalImpl<ContractState>;␊ ␊ #[storage]␊ struct Storage {␊ #[substorage(v0)]␊ foo: FooComponent::Storage,␊ }␊ ␊ #[event]␊ #[derive(Drop, starknet::Event)]␊ enum Event {␊ #[flat]␊ FooEvent: FooComponent::Event,␊ }␊ ␊ #[constructor]␊ fn constructor(ref self: ContractState) {␊ self.foo.initializer();␊ }␊ }␊ ` ## contract with sorted use clauses > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ use another::library::{AnotherLibrary, Foo as Custom1, Foo as Custom2};␊ use some::library::SomeLibrary;␊ use some::path::FooComponent;␊ ␊ component!(path: FooComponent, storage: foo, event: FooEvent);␊ ␊ // External␊ #[abi(embed_v0)]␊ impl FooImpl = FooComponent::FooImpl<ContractState>;␊ ␊ // Internal␊ impl FooInternalImpl = FooComponent::InternalImpl<ContractState>;␊ ␊ #[storage]␊ struct Storage {␊ #[substorage(v0)]␊ foo: FooComponent::Storage,␊ }␊ ␊ #[event]␊ #[derive(Drop, starknet::Event)]␊ enum Event {␊ #[flat]␊ FooEvent: FooComponent::Event,␊ }␊ ␊ #[constructor]␊ fn constructor(ref self: ContractState) {␊ self.foo.initializer();␊ }␊ }␊ ` ## contract with info > Snapshot 1 `// SPDX-License-Identifier: MIT␊ // Compatible with OpenZeppelin Contracts for Cairo ^2.0.0␊ ␊ // Security contact: security@example.com␊ #[starknet::contract]␊ mod Foo {␊ #[storage]␊ struct Storage {␊ }␊ }␊ `

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