Skip to content

Commit 64ee028

Browse files
authored
Merge pull request #2 from SangIlMo/research/eip-7291-pbm-2
EIPs: add erc-7291.md
2 parents f9c2cbf + a21a583 commit 64ee028

File tree

1 file changed

+392
-0
lines changed

1 file changed

+392
-0
lines changed

EIPs/erc-7291.md

Lines changed: 392 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,392 @@
1+
# PBM Technical Whitepaper
2+
3+
## Background
4+
5+
CDBC는 새로운 디지털 자산 생태계의 교환 매체(medium of exchange)로써 사용되어질 수 있다.
6+
7+
CBDC와 같은 digital money의 가장 큰 장점은 Programmability Feature를 지원한다는 것이다.
8+
9+
그러나, 이 Programmability로 인해 교환 매체\*로서의 기능을 잃어버려서는 안된다. 화폐의 단일 목적(Singleness)이 보존되어야 하며, Programmability가 화폐의 분배를 제한하거나 시스템의 유동성 조각화를 야기해서는 안된다.
10+
11+
- 교환 매체
12+
In economics, a **medium of exchange** is any item that is widely acceptable in exchange for goods and services.
13+
현대시대에서 대표적인 교환 매체는 법정 화폐 라고 볼 수 있다.
14+
15+
PBM - Purpose Bound Money: 화폐 자체가 Program될 필요 없이, 구체적인 목적을 위해 만들어진 화폐
16+
17+
다른 원장 기술과 화폐 형태에도 동작할 수 있도록 Common Protocol을 활용한다. 표준화된 포멧을 통해서, 사용자는 원하는 Wallet Provider로 Digital Money에 접근할 수 있다.
18+
19+
## Motivation
20+
21+
- Proliferation of markets and their fragmentation (시장 증식과 조각화)
22+
23+
- 서로 다른 결제 채널과 방식을 사용함으로써, 상인이나 소비자들이 이에 적응하기위해 소비하는 노력과 자원이 발생함
24+
- ApplePay와 같은 페이먼트 시스템을 제공하기 위해서 해당 스펙의 프로토콜을 지원하는 포스단말기, 인앱서비스, 카드사 결제 시스템 등에 업데이트가 필요하다.
25+
- 독립적이고 개별화된 시스템들을 하나의 플랫폼으로 구성하면 더 나은 UX와 디지털화의 잠재력을 발휘할 수 있음
26+
- 이에 여러 payment 시스템들에 대한 상호작용을 필요로 하게 되며 기업 및 소비자들에게 높은 유연성을 제공해야함
27+
28+
- Programmability and fungibility of money (자산의 프로그래밍 가능성과 대체 가능성)
29+
- digital money의 Prgrammability는 큰 차별점이지만, **교환 매체로써의 역할을 상실할 위험**이 있음
30+
- 서비스에 따라 필요한 디지털 자산들이 많아지면서 모든 UseCase에 맞는 단일화된 Digital Money를 생성하기는 어려움
31+
- 새로운 UseCase를 얻기 위해 의존성에 의해 다시 programming 해야 함
32+
- Fungibility 또한 토큰 간의 거래가 자유롭게 이루어질 수 있는 목적에서 중요
33+
- 개별 서비스 별 digital money를 만드는 경우, Fungibility 상실 및 유동성이 축소될 수 있음
34+
35+
## Models of Programmability
36+
37+
<img width="50%" alt="models-figure" src="https://github.com/SangIlMo/EIP_opensource/assets/156392700/1de60dfd-b374-477b-b92f-471aed40a3ad">
38+
39+
### Programmable payment
40+
41+
- 미리 설정된 조건을 만족한 경우 결제를 자동화하는 모델
42+
- API Gateway 형태나 DB Trigger 형태로 구현되며 accounting ledger ↔ client application의 상호작용으로 발생함
43+
- 자동이체, 자동납부 등
44+
- 여러 형태의 화폐에 Programming Logic이나 조건을 적용할 수 있음
45+
46+
### Programmable money
47+
48+
- 자산 자체에 정해진 규칙을 설정하고 사용을 제한하는 모델
49+
- 포인트, 쿠폰, 상품권 등
50+
- 토큰화된 은행 부채, CBDC
51+
- Programming Logic을 화폐에 적용한 채로 전송됨
52+
53+
→ Programmble payment는 자산과 Programming Logic이 분리되어 있지만, money의 경우 하나로 묶여 자산 자체를 제한한다고 볼 수 있다.
54+
55+
→ 각 국가별 중앙은행, 시중 은행, 서비스 제공자 들에 대해 각각의 CBDC, 부채, stablecoin 이 발생한다면, 더욱 복잡하고 다양한 금융 landsape이 형성됨 따라서, 하나로 통함할 수 있는 Framework의 필요성이 매우 중요 (서로 다른 digital money간의 상호작용과 현존하는 금융 인프라와 호환성을 가능하게 해야함)
56+
57+
### Purpose Bound Money (PBM)
58+
59+
- 자산이 사용되는 조건을 구체화 할 수 있는 모델
60+
- 따라서, payment와 money의 각 특징을 모두 구현 가능
61+
- digital money로서 내재 가치(intrinsic value)와 Programming Logic 을 포함할 수 있음
62+
- condition이 성립되면 digital money는 내재 가치가 보존되고, progrmming 조건에서 벗어나게 됨
63+
- 예시) 디지털 쿠폰
64+
- 상품이나 서비스와 교환할 수 있음 (Programmable Payment)
65+
- 약관에 따라 양도가 가능함 (Programmable Money)
66+
- 다른 점은, Payee가 지불받은 후 digital money로 전환되어 다른 목적으로 사용 가능
67+
68+
<img width="50%" alt="models-compare-table" src="https://github.com/SangIlMo/EIP_opensource/assets/156392700/1418aa35-8f24-4405-b40d-d427ec1b8136">
69+
70+
## System Architecture
71+
72+
|Layer|Examples|
73+
| --- | --- |
74+
| Access Layer | Wallets, Applications, Portals |
75+
| Service Layer | Lending, Borrowing, Derivatives, Purpose Bound Money |
76+
| Asset Layer | CBDC, Stablecoin, Tokenised Bank Liability, Digital Money |
77+
| Platform Layer | Execution, Storage, Addressing, Consensus |
78+
79+
→ PBM 디자인은 다른 유형의 블록체인과 자산에서도 작동하며, 비 원장 시스템에서도 사용 가능하다.
80+
81+
### PBM 요소
82+
83+
- Wrapper: 의도한 목적에 따른 역할 수행
84+
- 정해진 조건에 따라서 수행함
85+
- 조건 만족시 digital money로 전환되고 recipient에게 전송됨
86+
- ERC-1155로 구현 가능함
87+
- Store of Value: 내재가치를 지속적으로 보유
88+
- digital money로서의 가치를 저장함
89+
- 상품 가치, 계좌, 환전 매개체
90+
- CBDC 가능
91+
92+
<img width="394" alt="pbm-component" src="https://github.com/SangIlMo/EIP_opensource/assets/156392700/b882c587-dd4d-43ae-b295-2a545bb7b907">
93+
94+
### 역할과 상호작용
95+
96+
- PBM Creator
97+
→ PBM 로직을 정의하고, 발행 및 분배를 담당함
98+
- PBM Holder
99+
→ PBM token을 사용하며, 기한이 만료되기 전 PBM 토큰을 상환 가능
100+
- PBM Redeemer
101+
→ PBM token의 역할이 완료된 후, digital money를 수령함
102+
103+
### Lifecycle
104+
105+
<img width="691" alt="pbm-lifecycle" src="https://github.com/SangIlMo/EIP_opensource/assets/156392700/f3397baf-79ad-4da5-bd5f-583adf24e793">
106+
107+
예시)
108+
109+
1. Issue Stage
110+
- PBM 초기화
111+
- PBM Token 생성
112+
- PBM Token 발행
113+
2. Distribute | Transfer
114+
- PBM 분배 및 거래(전송)
115+
3. Redemption Stage
116+
- PBM 상환
117+
4. Expired Stage
118+
- Redeem expired PBM Token - 만기로 인한, PBM 사용(전송)불가
119+
- Revoke PBM - 만기로 인한, PBM 상환
120+
121+
### components
122+
123+
- PBM Wrapper (Actions)
124+
- Mint | Burn | Transfer PBM
125+
- Interact with PBM Logic and PBM Token Manager
126+
- PBM Logic → create complex business conditions
127+
- add or remove from whitelist / blacklist
128+
- check if PBM can be transferred / unwrapped
129+
- PBM Token Manager (Type and Balance Management)
130+
- create PBM token types
131+
- get details of each PBM token type
132+
- increase/decrease supply balance
133+
- validate PBM token expiry
134+
135+
<img width="521" alt="pbm-smart-contract" src="https://github.com/SangIlMo/EIP_opensource/assets/156392700/ee02f5aa-254f-4bd2-9a92-8e0e040e3983">
136+
137+
## Interface
138+
139+
ERC-1155를 기반으로 PBM-Wrapper를 통해 PBM Token을 생성한다.
140+
141+
ERC-1155는 multiple tokens를 지원하고 각 토큰에 ID 부여가 가능하여 Token Type을 구체적으로 설정할 수 있다.
142+
143+
### PBM Token Details (PBM Token Manager)
144+
145+
- 모든 필수 비즈니스 로직이 TokenType 별로 반드시 기재되어야 함
146+
147+
PBMToken structure에서 다음 요소를 필수로 지정하고 있다. (**MUST**)
148+
149+
- name - token name
150+
- faceValue - value of underlying token
151+
- Wrapping한 Token 수량을 기록
152+
- expiry - 만료기간
153+
- uri - metadata uri (display purpose)
154+
- 이외 모두 Optional이며 필요한 사항은 추가 가능 (**MAY**)
155+
- PBM Token이 각 서비스 목적에 따라 사용 될 수 있도록 하기 위해 자율성을 부과
156+
- PBMToken struct
157+
158+
```solidity
159+
abstractcontract IPBMRC1_TokenManager {
160+
/// @dev Mapping of each ERC-1155 tokenId to its corresponding PBM Token details.
161+
mapping (uint256=> PBMToken)internal tokenTypes ;
162+
163+
/// @notice A PBM token MUST include compulsory state variables (name, faceValue, expiry, and uri) to adhere to this standard.
164+
/// @dev Represents all the details corresponding to a PBM tokenId.
165+
struct PBMToken {
166+
// Name of the token.
167+
string name;
168+
169+
// Value of the underlying wrapped ERC20-compatible sovToken. Additional information on the `faceValue` can be specified by
170+
// adding the optional variables: `currencySymbol` or `tokenSymbol` as indicated below
171+
uint256 faceValue;
172+
173+
// Time after which the token will be rendered useless (expressed in Unix Epoch time).
174+
uint256 expiry;
175+
176+
// Metadata URI for ERC-1155 display purposes.
177+
string uri;
178+
179+
// OPTIONAL: Indicates if the PBM token can be transferred to a non merchant/redeemer wallet.
180+
bool isTransferable;
181+
182+
// OPTIONAL: Determines whether the PBM will be burned or revoked upon expiry, under certain predefined conditions, or at the owner's discretion.
183+
bool burnable;
184+
185+
// OPTIONAL: Number of decimal places for the token.
186+
uint8 decimals;
187+
188+
// OPTIONAL: The address of the creator of this PBM type on this smart contract. This field is optional because the creator is msg.sender by default.
189+
address creator;
190+
191+
// OPTIONAL: The smart contract address of the sovToken.
192+
address tokenAddress;
193+
194+
// OPTIONAL: The running balance of the PBM Token type that has been minted.
195+
uint256 totalSupply;
196+
197+
// OPTIONAL: An ISO4217 three-character alphabetic code may be needed for the faceValue in multicurrency PBM use cases.
198+
string currencySymbol;
199+
200+
// OPTIONAL: An abbreviation for the PBM token name may be assigned.
201+
string tokenSymbol;
202+
203+
// Add other optional state variables below...
204+
}
205+
}
206+
```
207+
208+
PBMToken Type 생성 (**SHOULD**)
209+
210+
- 필수 파라미터 (name, faceValue, expiry, uri) 전달
211+
- 해당 Token 정보에 대한 Event 발생
212+
- createPBMTokenType
213+
214+
```solidity
215+
/// @notice Creates a new PBM Token type with the provided data.
216+
/// @dev The caller of createPBMTokenType shall be responsible for setting the creator address.
217+
/// Example of uri can be found in [`sample-uri`](/assets/eip-7291/sample-uri/stx-10-static)
218+
/// Must emit {NewPBMTypeCreated}
219+
/// @param _name Name of the token.
220+
/// @param _faceValue Value of the underlying wrapped ERC20-compatible sovToken.
221+
/// @param _tokenExpiry Time after which the token will be rendered useless (expressed in Unix Epoch time).
222+
/// @param _tokenURI Metadata URI for ERC-1155 display purposes
223+
function createPBMTokenType(
224+
string memory _name,
225+
uint256 _faceValue,
226+
uint256 _tokenExpiry,
227+
string memory _tokenURI
228+
) external virtual returns (uint256 tokenId_);
229+
230+
/// @notice Emitted when a new Purpose-Bound Token (PBM) type is created within the contract.
231+
/// @param tokenId The unique identifier for the newly created PBM token type.
232+
/// @param tokenName A human-readable string representing the name of the newly created PBM token type.
233+
/// @param amount The initial supply of the newly created PBM token type.
234+
/// @param expiry The timestamp at which the newly created PBM token type will expire.
235+
/// @param creator The address of the account that created the new PBM token type.
236+
event NewPBMTypeCreated(uint256 tokenId, string tokenName, uint256 amount, uint256 expiry, address creator);
237+
```
238+
239+
PBM Token Info Details (**MUST**)
240+
241+
- PBM 정보를 가져오기 위한 함수
242+
- getTokenDetails
243+
```solidity
244+
/// @notice Retrieves the details of a PBM Token type given its tokenId.
245+
/// @dev This function fetches the PBMToken struct associated with the tokenId and returns it.
246+
/// @param tokenId The identifier of the PBM token type.
247+
/// @return pbmToken_ A PBMToken struct containing all the details of the specified PBM token type.
248+
function getTokenDetails(uint256 tokenId) external virtual view returns(PBMToken memory pbmToken_);
249+
```
250+
251+
### PBM Address List (PBM Logic)
252+
253+
- PBM 사용 및 Release(Unwrap)이 가능한 Address 목록을 유지해야 함
254+
- 해당 인터페이스는, 추가적인 비즈니스 로직과 함께 사용되어질 수 있음 (**MUST**)
255+
- isBlacklisted()
256+
- Blacklist - event
257+
- isMerchant()
258+
- MerchantList - event
259+
- IPBMAddressList
260+
261+
```
262+
pragma solidity^0.8.0;
263+
264+
/// @title PBM Address list Interface.
265+
/// @notice The PBM address list stores and manages whitelisted merchants/redeemers and blacklisted address for the PBMs
266+
interface IPBMAddressList {
267+
268+
/// @notice Checks if the address is one of the blacklisted addresses
269+
/// @param _address The address to query
270+
/// @return bool_ True if address is blacklisted, else false
271+
function isBlacklisted(address _address)externalreturns (bool bool_) ;
272+
273+
/// @notice Checks if the address is one of the whitelisted merchant/redeemer addresses
274+
/// @param _address The address to query
275+
/// @return bool_ True if the address is in merchant/redeemer whitelist and is NOT a blacklisted address, otherwise false.
276+
function isMerchant(address _address)externalreturns (bool bool_) ;
277+
278+
/// @notice Event emitted when the Merchant/Redeemer List is edited
279+
/// @param action Tags "add" or "remove" for action type
280+
/// @param addresses An array of merchant wallet addresses that was just added or removed from Merchant/Redeemer whitelist
281+
/// @param metadata Optional comments or notes about the added or removed addresses.
282+
event MerchantList(string action,address[] addresses,string metadata);
283+
284+
/// @notice Event emitted when the Blacklist is edited
285+
/// @param action Tags "add" or "remove" for action type
286+
/// @param addresses An array of wallet addresses that was just added or removed from address blacklist
287+
/// @param metadata Optional comments or notes about the added or removed addresses.
288+
event Blacklist(string action,address[] addresses,string metadata);
289+
}
290+
```
291+
292+
### PBMRC - Base Interface (PBM Wrapper)
293+
294+
- Digital Money Wrapping을 통한 PBM Token 발행
295+
- mint | burn | transfer | revoke | unwrap PBM Lifecycle위한 Action 책임짐
296+
- IPBMRC1
297+
298+
```solidity
299+
/// LIST OF EVENTS TO BE EMITTED
300+
/// A database or explorer may listen to events and be able to provide indexed and categorized searches
301+
/// @title PBM Specification interface
302+
/// @notice The PBM (purpose bound money) allows us to add logical requirements on the use of sovTokens.
303+
/// The PBM acts as wrapper around the sovTokens and implements the necessary business logic.
304+
/// @dev PBM deployer must assign an overall owner to the smart contract. If fine grain access controls are required, EIP-5982 can be used on top of ERC173
305+
interface IPBMRC1 is IERC173, IERC5679Ext1155 {
306+
307+
// underlying ERC20 토큰의 정보와, Business Logic 컨트랙트 정보 등을 얻어
308+
// PBM Token으로 Wrapping하는 함수
309+
function initialise(address _sovToken, uint256 _expiry, address _pbmWrapperLogic) external;
310+
311+
/// @notice Returns the uri metadata information for the PBM with the corresponding tokenId
312+
function uri(uint256 tokenId) external view returns (string memory);
313+
314+
function safeMint(address receiver, uint256 tokenId, uint256 amount, bytes calldata data) external;
315+
function safeMintBatch(address receiver, uint256[] calldata tokenIds, uint256[] calldata amounts, bytes calldata data) external;
316+
317+
function burn(address from, uint256 tokenId, uint256 amount, bytes calldata data) external;
318+
function burnBatch(address from, uint256[] calldata tokenIds, uint256[] calldata amounts, bytes calldata data) external;
319+
320+
// 1. buisiness logic check
321+
// 2. unwrap function may be called within this function
322+
// buisiness logic 조건 만족하는 경우, PBM Token 간 자유롭게 전송 가능해야 하며
323+
// 조건 만족시 underlying ERC20 토큰 release를 위해 unwrap 호출 해야 함
324+
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) external;
325+
function safeBatchTransferFrom(address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) external;
326+
327+
function unwrap(address from, address to, uint256 tokenId, uint256 amount, bytes memory data) internal;
328+
329+
// PBM Token 만료시 Revoke
330+
// 전송 되지 않고, unwrap 되어 underlying ERC20 release 됨
331+
function revokePBM(uint256 tokenId) external;
332+
333+
event PBMrevokeWithdraw(address beneficiary, uint256 PBMTokenId, address sovToken, uint256 sovTokenValue);
334+
event TokenUnwrapForTarget(address from, address to, uint256[] tokenIds, uint256[] amounts, address sovToken, uint256 sovTokenValue);
335+
event TokenUnwrapForPBMBurn(address from, address to, uint256[] tokenIds, uint256[] amounts, address sovToken, uint256 sovTokenValue);
336+
event TokenWrap(address from, uint256[] tokenIds, uint256[] amounts,address sovToken, uint256 sovTokenValue);
337+
}
338+
339+
```
340+
341+
### Extension of PBMRC1 - Token Receiver
342+
343+
- Token Receiver의 경우, PBM Token을 전송 받고 Unwrap(release) 과정에서 추가적인 로직을 수행할 수 있도록 한다.
344+
- PBMRC1_TokenReceiver
345+
346+
```solidity
347+
/// @notice Smart contracts MUST implement the ERC-165 `supportsInterface` function and signify support for the `PBMRC1_TokenReceiver` interface to accept callbacks.
348+
/// It is optional for a receiving smart contract to implement the `PBMRC1_TokenReceiver` interface
349+
/// @dev WARNING: Reentrancy guard procedure, Non delegate call, or the check-effects-interaction pattern must be adhere to when calling an external smart contract.
350+
/// The interface functions MUST only be called at the end of the `unwrap` function.
351+
interface PBMRC1_TokenReceiver {
352+
353+
// PBMToken 수신 후, Unwrap 시에 추가적인 logic 호출 가능
354+
// ex) 구입 시 10% 할인 등?
355+
function onPBMRC1Unwrap(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4);
356+
function onPBMRC1BatchUnwrap(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4);
357+
}
358+
```
359+
360+
### PBMRC2
361+
362+
- PBMRC1과 달리, non preloaded PBM으로 underlying ERC20 amount를 처음부터 할당 하지 않고, 이후에 할당할 수 있는 방식이다.
363+
- IPBMRC1을 구현하고 있으며 추가적으로 다음 함수를 포함한다.
364+
- load() - load underlying ERC20 amount into PBMtoken
365+
- unload() - unload amount
366+
- 네이버 포인트 등으로 사용 가능할 것 같음
367+
- PBMRC2_NonPreloadedPBM
368+
369+
```solidity
370+
interface PBMRC2_NonPreloadedPBM is IPBMRC1 {
371+
372+
...
373+
374+
function load(uint256 amount) external;
375+
function unload(uint256 amount) external;
376+
377+
event TokenLoad(address caller, address to, uint256 amount, address sovToken, uint256 sovTokenValue);
378+
event TokenUnload(address caller, address from, uint256 amount, address sovToken, uint256 sovTokenValue);
379+
}
380+
```
381+
382+
진행된 PoC - https://github.com/StraitsX/Orchid-PBM
383+
384+
## reference
385+
386+
- [ERC-7291](https://eips.ethereum.org/EIPS/eip-7291)
387+
- [PBM poc Implementation](https://github.com/StraitsX/Orchid-PBM)
388+
- [ERC-7291 Interface](https://github.com/ethereum/ERCs/tree/master/assets/erc-7291/contracts)
389+
- [ERC-7291 Proposal](https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7291.md)
390+
- [PBM Technical Report](https://www.mas.gov.sg/-/media/mas-media-library/development/fintech/pbm/pbm-technical-whitepaper.pdf)
391+
- [Ethereum Magician Discussion](https://ethereum-magicians.org/t/eip-7291-purpose-bound-money/14973)
392+
- [RFC2119](https://datatracker.ietf.org/doc/html/rfc2119)

0 commit comments

Comments
 (0)