Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1345f3b
Support customizing decimals for cairo-alpha
immrsd Sep 2, 2025
73727c7
Update cairo-alpha tests
immrsd Sep 2, 2025
7149d9c
Support customizing decimals in cairo
immrsd Sep 2, 2025
c30efb3
Update cairo-stable ERC20 tests
immrsd Sep 2, 2025
0a42281
Add changelog entries
immrsd Sep 2, 2025
48205ae
Update versions of packages
immrsd Sep 2, 2025
86527d8
Add decimals value to Cairo ERC20 scheme and support it in MCP
immrsd Sep 2, 2025
334ac12
Improve tooltip message for ERC20 decimals
immrsd Sep 2, 2025
f45744b
Fix source of decimals value: allOpts (that include defaults) instead…
immrsd Sep 2, 2025
21a041a
Fix issue of premint using hardcoded decimals of 18
immrsd Sep 2, 2025
9de183c
Add changeset
immrsd Sep 2, 2025
363fbd2
Fix AI assistant functions definitions
immrsd Sep 2, 2025
0ec0ff4
Merge master
immrsd Sep 2, 2025
afee833
Make decimals optional for ERC20 Cairo and Cairo-Alpha builders
immrsd Sep 8, 2025
37e4153
Use ERC20 default config if decimals value of 18 is used
immrsd Sep 8, 2025
f1f59d8
Update Cairo ERC20 snapshots
immrsd Sep 8, 2025
d38c6e4
Remove decimals param in tests when default value is used
immrsd Sep 8, 2025
b22d3bc
Add custom decimals to ERC20 generator
immrsd Sep 8, 2025
26bbdcd
Lint ts files
immrsd Sep 8, 2025
f07c29a
Remove custom decimals from Cairo ERC20 generator
immrsd Sep 8, 2025
21238f9
Revert changelog entries in favor of changeset
ericglau Sep 9, 2025
d6e9c83
Revert package.json updates in favor of changeset
ericglau Sep 9, 2025
732d585
Make decimals optional for MCP
ericglau Sep 9, 2025
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
7 changes: 7 additions & 0 deletions .changeset/swift-eels-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@openzeppelin/wizard-cairo': minor
'@openzeppelin/wizard-common': patch
'@openzeppelin/contracts-mcp': patch
---

Support decimals customization for ERC20 Cairo contracts
3 changes: 3 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog


## 0.1.1 (2025-09-02)
- Cairo: Add decimals to ERC20 scheme ([#654](https://github.com/OpenZeppelin/contracts-wizard/pull/654))

## 0.1.0 (2025-08-15)

- Bump minor version for semantic versioning stability ([#631](https://github.com/OpenZeppelin/contracts-wizard/pull/631))
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openzeppelin/wizard-common",
"version": "0.1.0",
"version": "0.1.1",
"description": "Common library for OpenZeppelin Contracts Wizard components. Used internally.",
"license": "AGPL-3.0-only",
"repository": "https://github.com/OpenZeppelin/contracts-wizard",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/ai/descriptions/cairo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const cairoRoyaltyInfoDescriptions = {

export const cairoERC20Descriptions = {
premint: 'The number of tokens to premint for the deployer.',
decimals: 'The number of decimals to use for the contract.',
votes:
"Whether to keep track of historical balances for voting in on-chain governance, with a way to delegate one's voting power to a trusted account.",
};
Expand Down
3 changes: 3 additions & 0 deletions packages/core/cairo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2.1.0 (2025-09-02)

- Support ERC20 decimals customization ([#654](https://github.com/OpenZeppelin/contracts-wizard/pull/654))

## 2.0.1 (2025-08-20)

Expand Down
2 changes: 1 addition & 1 deletion packages/core/cairo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openzeppelin/wizard-cairo",
"version": "2.0.1",
"version": "2.1.0",
"description": "A boilerplate generator to get started with OpenZeppelin Contracts for Cairo",
"license": "AGPL-3.0-only",
"repository": "https://github.com/OpenZeppelin/contracts-wizard",
Expand Down
22 changes: 21 additions & 1 deletion packages/core/cairo/src/erc20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function testERC20(title: string, opts: Partial<ERC20Options>) {
const c = buildERC20({
name: 'MyToken',
symbol: 'MTK',
decimals: '18',
...opts,
});
t.snapshot(printContract(c));
Expand All @@ -29,6 +30,7 @@ function testAPIEquivalence(title: string, opts?: ERC20Options) {
buildERC20({
name: 'MyToken',
symbol: 'MTK',
decimals: '18',
...opts,
}),
),
Expand Down Expand Up @@ -69,6 +71,21 @@ testERC20('erc20 premint of 0', {
premint: '0',
});

testERC20('erc20 votes, custom decimals', {
decimals: '6',
});

test('erc20 votes, decimals too high', async t => {
const error = t.throws(() =>
buildERC20({
name: 'MyToken',
symbol: 'MTK',
decimals: '256',
}),
);
t.is((error as OptionsError).messages.decimals, 'Value is greater than u8 max value');
});

testERC20('erc20 mintable', {
mintable: true,
access: 'ownable',
Expand All @@ -95,6 +112,7 @@ test('erc20 votes, no name', async t => {
buildERC20({
name: 'MyToken',
symbol: 'MTK',
decimals: '18',
votes: true,
}),
);
Expand All @@ -106,6 +124,7 @@ test('erc20 votes, empty version', async t => {
buildERC20({
name: 'MyToken',
symbol: 'MTK',
decimals: '18',
votes: true,
appName: 'MY_DAPP_NAME',
appVersion: '', // avoids default value of v1
Expand Down Expand Up @@ -158,11 +177,12 @@ testERC20('erc20 full upgradeable with roles', {

testAPIEquivalence('erc20 API default');

testAPIEquivalence('erc20 API basic', { name: 'CustomToken', symbol: 'CTK' });
testAPIEquivalence('erc20 API basic', { name: 'CustomToken', symbol: 'CTK', decimals: '6' });

testAPIEquivalence('erc20 API full upgradeable', {
name: 'CustomToken',
symbol: 'CTK',
decimals: '6',
premint: '2000',
access: 'roles',
burnable: true,
Expand Down
Loading
Loading