Skip to content

Commit d3d7ec3

Browse files
cridmannabcoathup
andauthored
Add ERC: Scaled UI Amount Extension for ERC-20 Tokens (#1283)
* feat: ERC-8043 - Scaled UI Amount Extension for ERC-20 Tokens * chore: formatting * chore: formatting * chore: formatting * fix: rename to EIP-8056 * Update ERCS/erc-8056.md Co-authored-by: Andrew B Coathup <[email protected]> * fix: link to images * fix: link to images * fix: link to images --------- Co-authored-by: Andrew B Coathup <[email protected]>
1 parent c03e646 commit d3d7ec3

File tree

3 files changed

+313
-0
lines changed

3 files changed

+313
-0
lines changed

ERCS/erc-8056.md

Lines changed: 313 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
---
2+
eip: 8056
3+
title: Scaled UI Amount Extension for ERC-20 Tokens
4+
description: Equity Token support for Stock Splits
5+
author: Chris Ridmann (@cridmann) <[email protected]>, Daniel Gretzke (@gretzke)
6+
discussions-to: https://ethereum-magicians.org/t/erc-8056-scaled-ui-amount-extension-for-erc-20-tokens/25899
7+
status: Draft
8+
type: Standards Track
9+
category: ERC
10+
created: 2025-10-20
11+
requires: 20
12+
---
13+
14+
## Abstract
15+
16+
This EIP proposes a standard extension to [ERC-20](./eip-20.md) tokens that enables issuers to apply an updatable multiplier to the UI (user interface) amount of tokens. This allows for efficient representation of stock splits, without requiring actual token minting or transfers. The extension provides a cosmetic layer that modifies how token balances are displayed to users while maintaining the underlying token economics.
17+
18+
## Motivation
19+
20+
Current ERC-20 implementations lack an efficient mechanism to handle real-world asset scenarios such as stock splits: When a company performs a 2-for-1 stock split, all shareholders should see their holdings double. Currently, this requires minting new tokens to all holders, which is gas-intensive and operationally complex. Moreover, the internal accounting in DeFi protocols would break from such a split.
21+
22+
The inability to efficiently handle this scenario limits the adoption of tokenized real-world assets (RWAs) on Ethereum. This EIP addresses these limitations by introducing a multiplier mechanism that adjusts the displayed balance without altering the actual token supply.
23+
24+
## Specification
25+
26+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
27+
28+
### Interface:
29+
30+
```solidity
31+
32+
interface IScaledUIAmount {
33+
// Emitted when the UI multiplier is updated
34+
event UIMultiplierUpdated(uint256 oldMultiplier, uint256 newMultiplier, uint256 setAtTimestamp, uint256 effectiveAtTimestamp);
35+
36+
// Returns the current UI multiplier
37+
// Multiplier is represented with 18 decimals (1e18 = 1.0)
38+
function uiMultiplier() external view returns (uint256);
39+
40+
// Converts a raw token amount to UI amount
41+
function toUIAmount(uint256 rawAmount) external view returns (uint256);
42+
43+
// Converts a UI amount to raw token amount
44+
function fromUIAmount(uint256 uiAmount) external view returns (uint256);
45+
46+
// Returns the UI-adjusted balance of an account
47+
function balanceOfUI(address account) external view returns (uint256);
48+
49+
// Updates the UI multiplier (only callable by authorized role)
50+
function setUIMultiplier(uint256 newMultiplier, uint256 effectiveAtTimestamp) external;
51+
}
52+
53+
```
54+
55+
### Implementation Requirements:
56+
57+
1. Multiplier Precision: The UI multiplier MUST use 18 decimal places for precision (1e18 represents a multiplier of 1.0).
58+
59+
2. Backwards Compatibility: The standard ERC-20 functions (balanceOf, transfer, transferFrom, etc.) MUST continue to work with raw amounts.
60+
61+
3. Event Emission: The UIMultiplierUpdated event MUST be emitted whenever the multiplier is changed.
62+
63+
### Reference Implementation
64+
65+
66+
```solidity
67+
contract ScaledUIToken is ERC20, IScaledUIAmount, Ownable {
68+
uint256 private constant MULTIPLIER_DECIMALS = 1e18;
69+
uint256 private _uiMultiplier = MULTIPLIER_DECIMALS; // Initially 1.0
70+
uint256 public _nextUiMultiplier = MULTIPLIER_DECIMALS;
71+
uint256 public _nextUiMultiplierEffectiveAt = 0;
72+
73+
constructor(string memory name, string memory symbol) ERC20(name, symbol) {}
74+
75+
function uiMultiplier() public view override returns (uint256) {
76+
uint256 currentTime = block.timestamp;
77+
if (currentTime >= _nextUiMultiplierEffectiveAt) {
78+
return _nextUiMultiplier;
79+
} else {
80+
return _uiMultiplier;
81+
}
82+
}
83+
84+
function toUIAmount(uint256 rawAmount) public view override returns (uint256) {
85+
uint256 currentTime = block.timestamp;
86+
if (currentTime >= _nextUiMultiplierEffectiveAt) {
87+
return (rawAmount * _nextUiMultiplier) / MULTIPLIER_DECIMALS;
88+
} else {
89+
return (rawAmount * _uiMultiplier) / MULTIPLIER_DECIMALS;
90+
}
91+
}
92+
93+
function fromUIAmount(uint256 uiAmount) public view override returns (uint256) {
94+
if (currentTime >= _nextUiMultiplierEffectiveAt) {
95+
return (uiAmount * MULTIPLIER_DECIMALS) / _nextUiMultiplier;
96+
} else {
97+
return (uiAmount * MULTIPLIER_DECIMALS) / _uiMultiplier;
98+
}
99+
100+
}
101+
102+
function balanceOfUI(address account) public view override returns (uint256) {
103+
return toUIAmount(balanceOf(account));
104+
}
105+
106+
function setUIMultiplier(uint256 newMultiplier, uint256 effectiveAtTimestamp) external override onlyOwner {
107+
require(newMultiplier > 0, "Multiplier must be positive");
108+
109+
uint256 currentTime = block.timestamp;
110+
require(effectiveAtTimestamp > currentTime, "Effective At must be in the future");
111+
112+
if (currentTime > _nextUiMultiplierEffectiveAt) {
113+
uint256 oldMultiplier = _nextUiMultiplier;
114+
_uiMultiplier = oldMultiplier;
115+
_nextUiMultiplier = newMultiplier;
116+
_nextUiMultiplierEffectiveAt = effectiveAtTimestamp;
117+
emit UIMultiplierUpdated(oldMultiplier, newMultiplier, block.timestamp, effectiveAtTimestamp);
118+
} else {
119+
uint256 oldMultiplier = _uiMultiplier;
120+
_nextUiMultiplier = newMultiplier;
121+
_nextUiMultiplierEffectiveAt = effectiveAtTimestamp;
122+
emit UIMultiplierUpdated(oldMultiplier, newMultiplier, block.timestamp, effectiveAtTimestamp);
123+
}
124+
}
125+
}
126+
127+
```
128+
## Rationale
129+
130+
131+
Design Decisions:
132+
133+
1. Separate UI Functions: Rather than modifying the core ERC-20 functions, we provide separate UI-specific functions. This ensures backward compatibility and allows integrators to opt-in to the UI scaling feature.
134+
135+
2. 18 Decimal Precision: Using 18 decimals for the multiplier provides sufficient precision for most use cases while aligning with Ethereum's standard decimal representation.
136+
137+
3. No Automatic Updates: The multiplier must be explicitly set by authorized parties, giving issuers full control over when and how adjustments are made.
138+
139+
4. Raw Amount Preservation: All actual token operations continue to use raw amounts, ensuring that the multiplier is purely a display feature and doesn't affect the underlying token economics.
140+
141+
Alternative Approaches Considered:
142+
143+
1. Rebasing Tokens: While rebasing tokens adjust supply automatically, they create complexity for integrators and can break composability with DeFi protocols.
144+
145+
2. Wrapper Tokens: Creating wrapper tokens for each adjustment event adds unnecessary complexity and gas costs.
146+
147+
3. Index/Exchange Rate Tokens confer similar advantages to the proposed Scaled UI approach, but is ultimately less intuitive and requires more calculations on the UI layers.
148+
149+
4. Off-chain Solutions: Purely off-chain solutions lack standardization and require trust in centralized providers.
150+
151+
![Token Value Representation Approaches](../assets/eip-8056/token_value_repr.jpeg)
152+
153+
![Token Architecture Layers](../assets/eip-8056/token_arch_layers.jpeg)
154+
155+
### Backwards Compatibility
156+
157+
158+
This EIP is fully backwards compatible with ERC-20. Existing ERC-20 functions continue to work as expected, and the UI scaling features are opt-in through additional functions.
159+
160+
### Test Cases
161+
162+
Example test scenarios:
163+
164+
1. Initial Multiplier Test:
165+
166+
- Verify that initial multiplier is 1.0 (1e18)
167+
168+
- Confirm balanceOf equals balanceOfUI initially
169+
170+
2. Stock Split Test:
171+
172+
- Set multiplier to 2.0 (2e18) for 2-for-1 split
173+
174+
- Verify UI balance is double the raw balance
175+
176+
- Confirm conversion functions work correctly
177+
178+
## Security Considerations
179+
180+
181+
1. Multiplier Manipulation
182+
183+
- Unauthorized changes to the UI multiplier could mislead users about their holdings
184+
185+
- Implementations MUST use robust access control mechanisms
186+
187+
- The setUIMultiplier function MUST be restricted to authorized addresses (e.g., contract owner or a designated role).
188+
189+
2. Integer Overflow
190+
191+
- Risk of overflow when applying the multiplier
192+
193+
- Use SafeMath or Solidity 0.8.0+ automatic overflow protection
194+
195+
3. User Confusion
196+
197+
- Clear communication is essential when UI amounts differ from raw amounts
198+
199+
- Integrators MUST clearly indicate when displaying UI-adjusted balances
200+
201+
4. Oracle Dependency
202+
203+
- For automated multiplier updates, the system may depend on oracles
204+
205+
- Oracle failures or manipulations could affect displayed balances
206+
207+
5. Overflow Protection: Implementations MUST handle potential overflow when applying the multiplier.
208+
209+
### Implementation Guide for Integrators
210+
211+
#### Wallet Integration
212+
213+
Wallets supporting this standard should:
214+
215+
1. Check if a token implements IScaledUIAmount interface
216+
217+
2. Display both raw and UI amounts, clearly labeled
218+
219+
3. Use balanceOfUI() for primary balance display
220+
221+
4. Handle transfers using raw amounts (standard ERC-20 functions)
222+
223+
**Example JavaScript integration:**
224+
225+
```javascript
226+
async function displayBalance(tokenAddress, userAddress) {
227+
const token = new ethers.Contract(tokenAddress, ScaledUIAmountABI, provider);
228+
229+
// Check if scaled UI is supported
230+
const supportsScaledUI = await supportsInterface(tokenAddress, SCALED_UI_INTERFACE_ID);
231+
232+
if (supportsScaledUI) {
233+
const uiBalance = await token.balanceOfUI(userAddress);
234+
const rawBalance = await token.balanceOf(userAddress);
235+
const multiplier = await token.uiMultiplier();
236+
237+
return {
238+
display: formatUnits(uiBalance, decimals),
239+
raw: formatUnits(rawBalance, decimals),
240+
multiplier: formatUnits(multiplier, 18)
241+
};
242+
} else {
243+
// Fall back to standard ERC-20
244+
const balance = await token.balanceOf(userAddress);
245+
return {
246+
display: formatUnits(balance, decimals),
247+
raw: formatUnits(balance, decimals),
248+
multiplier: "1.0"
249+
};
250+
}
251+
}
252+
253+
```
254+
255+
#### Exchange Integration
256+
257+
Exchanges should:
258+
259+
1. Store and track the multiplier for each supported token
260+
261+
2. Display UI amounts in user interfaces
262+
263+
3. Use raw amounts for all internal accounting
264+
265+
4. Provide clear documentation about the scaling mechanism
266+
267+
Example implementation:
268+
269+
```javascript
270+
class ScaledTokenHandler {
271+
async processDeposit(tokenAddress, amount, isUIAmount) {
272+
const token = new ethers.Contract(tokenAddress, ScaledUIAmountABI, provider);
273+
274+
let rawAmount;
275+
if (isUIAmount && await this.supportsScaledUI(tokenAddress)) {
276+
rawAmount = await token.fromUIAmount(amount);
277+
} else {
278+
rawAmount = amount;
279+
}
280+
281+
// Process deposit with raw amount
282+
return this.recordDeposit(tokenAddress, rawAmount);
283+
}
284+
285+
async getDisplayBalance(tokenAddress, userAddress) {
286+
const token = new ethers.Contract(tokenAddress, ScaledUIAmountABI, provider);
287+
const rawBalance = await this.getInternalBalance(userAddress, tokenAddress);
288+
289+
if (await this.supportsScaledUI(tokenAddress)) {
290+
return await token.toUIAmount(rawBalance);
291+
}
292+
return rawBalance;
293+
}
294+
}
295+
296+
```
297+
298+
#### DeFi Protocol Integration
299+
300+
DeFi protocols should:
301+
302+
1. Continue using raw amounts for all protocol operations
303+
304+
2. Provide UI helpers for displaying adjusted amounts
305+
306+
3. Emit events with both raw and UI amounts where relevant
307+
308+
4. Document clearly which amounts are used in calculations
309+
310+
311+
## Copyright
312+
313+
Copyright and related rights waived via [CC0](../LICENSE.md).
113 KB
Loading
106 KB
Loading

0 commit comments

Comments
 (0)