-
Notifications
You must be signed in to change notification settings - Fork 833
Add ERC: Representable Contract State #1396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cfries
wants to merge
19
commits into
ethereum:master
Choose a base branch
from
finmath:feature/resentable-contract-state
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add ERC: Representable Contract State #1396
cfries
wants to merge
19
commits into
ethereum:master
from
finmath:feature/resentable-contract-state
+2,248
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
abcoathup
reviewed
Dec 8, 2025
abcoathup
reviewed
Dec 8, 2025
abcoathup
reviewed
Dec 8, 2025
Co-authored-by: Andrew B Coathup <[email protected]>
Co-authored-by: Andrew B Coathup <[email protected]>
Co-authored-by: Andrew B Coathup <[email protected]>
|
The commit 225e263 (as a parent of 58f1572) contains errors. |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This proposal specifies a minimal interface
IXMLRepresentableStatethat lets an EVM contract expose a canonicalrepresentation of its state via an XML template with machine-readable bindings to its state and view functions.
Off-chain renderers use only
eth_callat a specific block to materialize that representation.Abstract
This ERC introduces
IXMLRepresentableState, a standard interface and XML binding schema that allows an EVM smart contract to define a static XML template with machine-readable bindings to its state and view functions. Off-chain renderers use this template to build a canonical XML document representing the contract's state at a specific block, without incurring any on-chain gas cost.A contract that claims to implement
IXMLRepresentableStateMUST be XML-complete: every piece of mutable state that the author considers semantically relevant MUST be represented in the XML via bindings, so that the rendered XML is a complete representation of the contract at a given (chain-id, address, block-number).Motivation
Smart contracts can efficiently orchestrate and process the life-cycle of a financial (derivative) product to an extent that they finally represent the financial product itself.
At the same time, many applications require a human-readable, machine-parseable representation of that product and its state: valuation oracles need inputs for settlements, smart bonds and other tokenized instruments need legal terms, term sheets or regulatory reports, and on-chain registries, governance modules or vaults benefit from a stable "document view" of their state.
In the traditional off-chain world, such needs are addressed by standards like FpML, the ISDA Common Domain Model, or the ICMA Bond Data Taxonomy. A common pattern is to treat an XML (or similar) document as the definitive source defining the financial product and then generate code to interact with the corresponding data. When a process modifies or updates properties of the product, developers must synchronize the smart contract's internal state with the off-chain XML representation. Today, each project typically invents its own set of view functions and off-chain conventions, so clients need bespoke code to map contract state into XML, JSON, or PDF. This makes interoperability, independent auditing, and reuse of tooling harder.
This ERC inverts that pattern by putting the smart contract in the centre. A contract declares that it implements
IXMLRepresentableStateand defines an interface of representable state. Off-chain renderers can then derive a canonical XML document that reflects the semantically relevant state of the contract at a given (chain-id, address, block-number), using onlyeth_calland a standardized XML binding schema. Rendering happens entirely off-chain and does not change state, so there is no gas cost, yet the resulting XML remains cryptographically anchored to the chain.Typical use cases include:
By standardizing the Solidity interface and the XML attribute schema, this ERC allows generic tools to consume any compliant contract without project-specific adapters, and to plug directly into existing XML-based workflows in finance and beyond.
Specification sketch (informal)
Very briefly, beyond the header/abstract/motivation above, the ERC specifies:
IXMLRepresentableStatewithxmlTemplate()returning a UTF‑8 XML document.IRepresentableStateVersionedwithstateVersion()(monotonically increasing version of the representable state).IRepresentableStateHashedwithstateHash()(hash of a canonical state tuple for the representation).IXMLRepresentableStateVersioned,IXMLRepresentableStateHashed,IXMLRepresentableStateVersionedHashed.evmstatenamespace, with attributes like:evmstate:call/evmstate:selector/evmstate:returnsevmstate:format/evmstate:scaleevmstate:target(element text vs. attribute target)evmstate:calls/evmstate:selectors/evmstate:returnsListevmstate:formats/evmstate:scales/evmstate:targetsA renderer:
xmlTemplate()at a fixed block tagB,evmstate:*binding viaeth_callatblockTag=B,evmstate:chain-id,evmstate:contract-address,evmstate:block-number).Snapshot consistency is guaranteed by always using the same block
Bfor all calls.Reference implementation / demos
We have a small set of demo contracts and a Java-based reference renderer (Web3j + DOM XML), including:
MinimalInstrument– owner, notional, currency, maturity, active flag.TestContract– exercises many type/format combinations (uint/int, hex, decimal+scale, iso8601 date/datetime, bytes as hex/base64, etc.) including a multi-binding example.InterestRateSwapSettleToMarket– IRS with settle-to-market semantics andlastSettlement{time,value}.BondDataTaxonomyDemo– ICMA BDT-inspired bond (issuer, ISIN, coupon, dates, etc.) rendered via evmstate bindings.Project Homepage: http://finmath.gitlab.io/representable-contract-state