Skip to content

Erc3643 functions - #1992

Open
HenriqueNogara wants to merge 7 commits into
erc7943-functionsfrom
erc3643-functions
Open

Erc3643 functions#1992
HenriqueNogara wants to merge 7 commits into
erc7943-functionsfrom
erc3643-functions

Conversation

@HenriqueNogara

Copy link
Copy Markdown
Contributor

changelog

new features

  • Adds set_symbol, set_name, unpause, pause;

@HenriqueNogara
HenriqueNogara marked this pull request as ready for review August 17, 2026 21:07
@HenriqueNogara
HenriqueNogara requested review from Neopallium and a lite review from Copilot August 17, 2026 21:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ERC-3643-style management functions to the Polymesh fungible-asset precompile surface, backed by new runtime support for freezing individual investor accounts.

Changes:

  • Extends the Solidity IFungibleAsset interface with ERC-3643 events and calls (setName, setSymbol, pause, unpause, setAddressFrozen).
  • Implements the new calls in the precompile interface (including event emission).
  • Adds runtime storage/extrinsic support for per-account freezing, plus benchmarking and weights.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
precompiles/src/interfaces/FungibleAssetStub.sol Extends the Solidity interface/stub with ERC-3643 events and function signatures.
pallets/precompiles/src/interface/mod.rs Wires the new ERC-3643 dispatch paths and introduces shared constants/errors.
pallets/precompiles/src/interface/erc3643.rs Implements pause/unpause, name/symbol update, and address freeze precompile logic + events.
pallets/precompiles/src/interface/erc20.rs Uses shared DECIMALS constant for ERC-20 decimals() return.
pallets/asset/src/lib.rs Adds FrozenAccounts storage, set_address_frozen extrinsic, and enforces frozen-account transfer blocking.
pallets/asset/src/benchmarking.rs Adds benchmark for the new set_address_frozen extrinsic.
pallets/weights/src/pallet_asset.rs Adds weight function for set_address_frozen.
Suppressed comments (1)

pallets/precompiles/src/interface/erc3643.rs:149

  • Same issue as above: UpdatedTokenInformation uses string indexed fields, so the indexed values must be keccak256(bytes(..)). The current FixedBytes::try_from(..).unwrap_or_default() will emit zero topics for typical asset names/symbols.
                IFungibleAsset::UpdatedTokenInformation {
                    newName: FixedBytes::try_from(asset_name.0.as_slice()).unwrap_or_default(),
                    newSymbol: FixedBytes::try_from(ticker.as_ref()).unwrap_or_default(),
                    newDecimals: DECIMALS,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pallets/precompiles/src/interface/erc3643.rs
Comment thread pallets/asset/src/lib.rs
Comment thread pallets/asset/src/lib.rs Outdated
Comment on lines +218 to +224
event UpdatedTokenInformation(
string indexed newName,
string indexed newSymbol,
uint8 newDecimals,
string newVersion,
address indexed newOnchainID
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets not use this event from ERC-3643 for now. The version and onchainID don't make sense for use. Maybe we will add our own events later.

Comment thread pallets/asset/src/lib.rs
Comment on lines +1849 to +1859
/// Set the status of `account` for `asset_id` to `freeze`.
#[pallet::call_index(39)]
#[pallet::weight(<T as Config>::WeightInfo::set_address_frozen())]
pub fn set_address_frozen(
origin: OriginFor<T>,
asset_id: AssetId,
freeze: bool,
account: AccountId32,
) -> DispatchResult {
Self::base_set_address_frozen(origin, asset_id, freeze, account)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should implement this freeze feature for both accounts and portfolios (so take an AssetHolder target here). Also need to make sure that the freeze blocks same DID transfers (portfolio moves and transfer_funds).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The precompile can be limited to account for now. I am not sure if we want to commit to supporting Portfolios long-term (since accounts are more commonly used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants