contracts-wizard
contracts-wizard copied to clipboard
Add Cairo API for a general contract
Related to https://github.com/OpenZeppelin/contracts-wizard/issues/110 and https://github.com/OpenZeppelin/contracts-wizard/issues/82
Requested for https://github.com/onlydustxyz/generator-starknet/issues/28
Proposed API
New function:
function printGeneral(opts?: GeneralOptions): string
With the following interfaces:
interface GeneralOptions {
name: string;
access?: 'ownable' | false;
upgradeable?: boolean;
info?: {
license?: string;
};
storageVars?: StorageVariable[];
}
interface StorageVariable {
name: string;
type: 'felt' | 'Uint256';
view?: boolean;
setInConstructor?: boolean;
}
Open questions
- Feedback welcome on function or option names
- Should the storage variables support arguments or multiple values? (this would increase complexity when posing the questions in the user interface (whether console or GUI))
Related to #110, #112.
This is supported through the custom contract type in the API.
Handling of custom storage variables is not included since storage variables are generic to the Cairo language, whereas Wizard is intended to help with usage of libraries.