diff --git a/EIPS/eip-3475.md b/EIPS/eip-3475.md index c8b909f94c8712..f55b6dc3e3334d 100644 --- a/EIPS/eip-3475.md +++ b/EIPS/eip-3475.md @@ -13,19 +13,20 @@ requires: 20, 721, 1155 ## Abstract -- This EIP allows the creation of tokenized obligations with abstract on-chain metadata storage. Issuing bonds with multiple redemption data cannot be achieved with existing token standards. +- This EIP allows the creation of tokenized obligations with abstract on-chain metadata storage. Issuing bonds with multiple redemption data cannot be achieved with existing token standards. - This EIP enables each bond class ID to represent a new configurable token type and corresponding to each class, corresponding bond nonces to represent an issuing condition or any other form of data in uint256. Every single nonce of a bond class can have its metadata, supply, and other redemption conditions. - Bonds created by this EIP can also be batched for issuance/redemption conditions for efficiency on gas costs and UX side. And finally, bonds created from this standard can be divided and exchanged in a secondary market. ## Motivation + Current LP (Liquidity Provider) tokens are simple [EIP-20](./eip-20.md) tokens with no complex data structure. To allow more complex reward and redemption logic to be stored on-chain, we need a new token standard that: - - Supports multiple token IDs - - Can store on-chain metadata - - Doesn't require a fixed storage pattern - - Is gas-efficient. +- Supports multiple token IDs +- Can store on-chain metadata +- Doesn't require a fixed storage pattern +- Is gas-efficient. Also Some benefits: @@ -50,9 +51,11 @@ pragma solidity ^0.8.0; * @param _to argument is the address of the bond recipient whose balance is about to increase. * @param _transactions is the `Transaction[] calldata` (of type ['classId', 'nonceId', '_amountBonds']) structure defined in the rationale section below. * @dev transferFrom MUST have the `isApprovedFor(_from, _to, _transactions[i].classId)` approval to transfer `_from` address to `_to` address for given classId (i.e for Transaction tuple corresponding to all nonces). +e.g: +* function transferFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]); +* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`. */ -// function transferFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]); -// transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`. + function transferFrom(address _from, address _to, Transaction[] calldata _transactions) external; /** @@ -62,10 +65,12 @@ function transferFrom(address _from, address _to, Transaction[] calldata _transa * @param _to is the address of the recipient whose balance is about to increase. * @param _transactions is the `Transaction[] calldata` structure defined in the section `rationale` below. * @dev transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) +e.g: +* function transferAllowanceFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]); +* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`. */ -// function transferAllowanceFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]); -// transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`. -function transferAllowanceFrom(address _from,address _to, Transaction[] calldata _transactions) public virtual override + +function transferAllowanceFrom(address _from,address _to, Transaction[] calldata _transactions) public ; /** * issue @@ -74,9 +79,10 @@ function transferAllowanceFrom(address _from,address _to, Transaction[] calldata * @param `_to` argument is the address to which the bond will be issued. * @param `_transactions` is the `Transaction[] calldata` (ie array of issued bond class, bond nonce and amount of bonds to be issued). * @dev transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) +e.g: +example: issue(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); +issues `1000` bonds with a class of `0` to address `0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef` with a nonce of `5`. */ -// example: issue(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); -// issues `1000` bonds with a class of `0` to address `0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef` with a nonce of `5`. function issue(address _to, Transaction[] calldata _transaction) external; /** @@ -87,9 +93,11 @@ function issue(address _to, Transaction[] calldata _transaction) external; * @param `_transactions` is the `Transaction[] calldata` structure (i.e., array of tuples with the pairs of (class, nonce and amount) of the bonds that are to be redeemed). Further defined in the rationale section. * @dev redeem function for a given class, and nonce category MUST BE done after certain conditions for maturity (can be end time, total active liquidity, etc.) are met. * @dev furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract. +e.g: +* redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, [IERC3475.Transaction(1,14,500)]); +means “redeem from wallet address(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef), 500000000 of bond class1 and nonce 42. */ -// redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, [IERC3475.Transaction(1,14,500)]); -// means “redeem from wallet address(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef), 500000000 of bond class1 and nonce 42. + function redeem(address _from, Transaction[] calldata _transactions) external; /** @@ -100,9 +108,10 @@ function redeem(address _from, Transaction[] calldata _transactions) external; * @param `_transactions` is the `Transaction[] calldata` structure (i.e., array of tuple with the pairs of (class, nonce and amount) of the bonds that are to be burned). further defined in the rationale. * @dev burn function for a given class, and nonce category MUST BE done only after certain conditions for maturity (can be end time, total active liquidity, etc). * @dev furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract. +* e.g: +* burn(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]); +* means burning 500000000 bonds of class 1 nonce 42 owned by address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B. */ -// burnBond(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]); -// means burning 500000000 bonds of class 1 nonce 42 owned by address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B. function burn(address _from, Transaction[] calldata _transactions) external; /** @@ -112,9 +121,11 @@ function burn(address _from, Transaction[] calldata _transactions) external; * @dev `approve()` should only be callable by the bank, or the owner of the account. * @param `_spender` argument is the address of the user who is approved to transfer the bonds. * @param `_transactions` is the `Transaction[] calldata` structure (ie array of tuple with the pairs of (class,nonce, and amount) of the bonds that are to be approved to be spend by _spender). Further defined in the rationale section. +* e.g: +* approve(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]); +* means owner of address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is approved to manage 500 bonds from class 1 and Nonce 14. */ -// approve(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]); -// means owner of address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is approved to manage 30000 bonds from class 0 and Nonce 1. + function approve(address _spender, Transaction[] calldata _transactions) external; /** @@ -126,9 +137,10 @@ function approve(address _spender, Transaction[] calldata _transactions) externa * @param `classId` is the class id of the bond. * @param `_approved` is true if the operator is approved (based on the conditions provided), false meaning approval is revoked. * @dev contract MUST define internal function regarding the conditions for setting approval and should be callable only by bank or owner. +* e.g: setApprovalFor(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,0,true); +* means that address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is authorized to transfer bonds from class 0 (across all nonces). */ -// setApprovalFor(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,0,true); -// means that address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is authorized to transfer bonds from class 0 (across all nonces). + function setApprovalFor(address _operator, bool _approved) external returns(bool approved); /** @@ -137,9 +149,10 @@ function setApprovalFor(address _operator, bool _approved) external returns(bool * @param classId is the corresponding class Id of the bond. * @param nonceId is the nonce Id of the given bond class. * @return the supply of the bonds +* e.g: +* totalSupply(0, 1); +* it finds the total supply of the bonds of classid 0 and bond nonce 1. */ -// totalSupply(0, 1); -// it finds the total supply of the bonds of classid 0 and bond nonce 1. function totalSupply(uint256 classId, uint256 nonceId) external view returns (uint256); /** @@ -239,7 +252,7 @@ function getProgress(uint256 classId, uint256 nonceId) external view returns (ui * @param nonceId is the nonceId of the given bond class. * @notice Returns the _amount which spender is still allowed to withdraw from _owner. */ -function allowance(address _owner, address _spender, uint256 classId, uint256 nonceId) external view returns(uint256); +function allowance(address _owner, address _spender, uint256 classId, uint256 nonceId) external returns(uint256); /** * isApprovedFor @@ -252,7 +265,7 @@ function allowance(address _owner, address _spender, uint256 classId, uint256 no function isApprovedFor(address _owner, address _operator) external view returns (bool); ``` -**Events** +### Events ```solidity /** @@ -260,47 +273,51 @@ function isApprovedFor(address _owner, address _operator) external view returns * @notice Issue MUST trigger when Bonds are issued. This SHOULD not include zero value Issuing. * @dev This SHOULD not include zero value issuing. * @dev Issue MUST be triggered when the operator (i.e Bank address) contract issues bonds to the given entity. +* eg: emit Issue(_operator, 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); +* issue by address(operator) 500 Bonds(nonce14,class 1) to address 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ + event Issue(address indexed _operator, address indexed _to, Transaction[] _transactions); -// eg: - -emit Issue(_operator, 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); -// issue by address(operator) 500 DBIT-USD Bond(nonce14,class 0) to address 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. /** * Redeem * @notice Redeem MUST trigger when Bonds are redeemed. This SHOULD not include zero value redemption. +*e.g: emit Redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); +* emit event when 5000 bonds of class 1, nonce 14 owned by address 0x492Af743654549b12b1B807a9E0e8F397E44236E are being redeemed by 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ -event Redeem(address indexed _operator, address indexed _from, uint256 classId, uint256 nonceId, uint256 _amount); -//e.g: -emit Redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); -//emit event when 5000 bonds of class 1, nonce 14 owned by address 0x492Af743654549b12b1B807a9E0e8F397E44236E are being redeemed by 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. + +event Redeem(address indexed _operator, address indexed _from, Transaction[] _transactions); + /** * Burn. * @dev `Burn` MUST trigger when the bonds are being redeemed via staking (or being invalidated) by the bank contract. * @dev `Burn` MUST trigger when Bonds are burned. This SHOULD not include zero value burning. +* e.g : emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); +* emits event when 500 bonds of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E of type (class 1, nonce 14) are burned by operator 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ - emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); -//emits event when 5000 bonds of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E of type (class 1, nonce 14) are burned by operator 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. + +event burn(address _operator, address _owner, Transaction[] _transactions); /** * Transfer * @dev its emitted when the bond is transferred by address(operator) from owner address(_from) to address(_to) with the bonds transferred, whose params are defined by _transactions struct array. * @dev Transfer MUST trigger when Bonds are transferred. This SHOULD not include zero value transfers. * @dev Transfer event with the _from `0x0` MUST not create this event(use `event Issued` instead). +* e.g emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, _to, [IERC3475.Transaction(1,14,500)]); +* transfer by address(_operator) amount 500 bonds with (Class 1 and Nonce 14) from 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, to address(_to). */ -emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, _to, [IERC3475.Transaction(1,14,500)]); -// transfer by address(_operator) amount 500 DBIT-USD bonds with (Class 1 and Nonce 14) from 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, to address(_to). + event Transfer(address indexed _operator, address indexed _from, address indexed _to, Transaction[] _transactions); /** * ApprovalFor * @dev its emitted when address(_owner) approves the address(_operator) to transfer his bonds. * @notice Approval MUST trigger when bond holders are approving an _operator. This SHOULD not include zero value approval. +* eg: emit ApprovalFor(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, true); +* this means 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef gives 0x492Af743654549b12b1B807a9E0e8F397E44236E access permission for transfer of its bonds. */ -emit ApprovalFor(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E); -// this means 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef gives 0x492Af743654549b12b1B807a9E0e8F397E44236E access permission for transfer of its bonds. + event ApprovalFor(address indexed _owner, address indexed _operator, bool _approved); ``` @@ -326,17 +343,17 @@ Some specific examples of metadata can be the localization of bonds, jurisdictio This structure defines the details of the class information (symbol, risk information, etc.). the example is explained [here](../assets/eip-3475/Metadata.md) in the class metadata section. -### 4. Decoding data: +### 4. Decoding data -First, the functions for analyzing the metadata (i.e `ClassMetadata` and `NonceMetadata`) are to be used by the corresponding frontend to decode the information of the bond. +First, the functions for analyzing the metadata (i.e `ClassMetadata` and `NonceMetadata`) are to be used by the corresponding frontend to decode the information of the bond. -This is done via overriding the function interface for functions `classValues` and `nonceValues` by defining the key (which SHOULD be an index) to read the corresponding information stored as a JSON object. +This is done via overriding the function interface for functions `classValues` and `nonceValues` by defining the key (which SHOULD be an index) to read the corresponding information stored as a JSON object. ```JSON { "title": "symbol", "_type": "string", -"description": "Lorem ipsum..." +"description": "defines the unique identifier name in following format: (symbol, bondType, maturity in months)", "values": ["Class Name 1","Class Name 2","DBIT Fix 6M"], } ``` @@ -345,7 +362,9 @@ e.g. In the above example, to get the `symbol` of the given class id, we can use ## Rationale -**Metadata structure**: Instead of utilizing a mapping from address, the bond's metadata like the time of redemption, redemption conditions, and interest rate can be stored in the bond class and nonce structures. Classes represent the different bond types, and nonces represent the various period of issuances. Nonces under the same class share the same metadata. Meanwhile, nonces are non-fungible. Each nonce can store a different set of metadata. Thus, upon transfer of a bond, all the metadata will be transferred to the new owner of the bond. +### Metadata structure + +Instead of storing the details about the class and their issuances to the user (ie nonce) externally, we store the details in the respective structures. Classes represent the different bond types, and nonces represent the various period of issuances. Nonces under the same class share the same metadata. Meanwhile, nonces are non-fungible. Each nonce can store a different set of metadata. Thus, upon transfer of a bond, all the metadata will be transferred to the new owner of the bond. ```solidity struct Values{ @@ -353,6 +372,7 @@ e.g. In the above example, to get the `symbol` of the given class id, we can use uint uintValue; address addressValue; bool boolValue; + bytes bytesValue; } ``` @@ -364,8 +384,7 @@ e.g. In the above example, to get the `symbol` of the given class id, we can use } ``` - -**Batch function:** +### Batch function This EIP supports batch operations. It allows the user to transfer different bonds along with their metadata to a new address instantaneously in a single transaction. After execution, the new owner holds the right to reclaim the face value of each of the bonds. This mechanism helps with the "packaging" of bonds–helpful in use cases like trades on a secondary market. @@ -384,8 +403,9 @@ The `nonceId` is the nonce id of the given bond class. This param is for distinc The `_amount` is the amount of the bond for which the spender is approved. +### AMM optimization -**AMM optimization**: One of the most obvious use cases of this EIP is the multilayered pool. The early version of AMM uses a separate smart contract and an [EIP-20](./eip-20.md) LP token to manage a pair. By doing so, the overall liquidity inside of one pool is significantly reduced and thus generates unnecessary gas spent and slippage. Using this EIP standard, one can build a big liquidity pool with all the pairs inside (thanks to the presence of the data structures consisting of the liquidity corresponding to the given class and nonce of bonds). Thus by knowing the class and nonce of the bonds, the liquidity can be represented as the percentage of a given token pair for the owner of the bond in the given pool. Effectively, the [EIP-20](./eip-20.md) LP token (defined by a unique smart contract in the pool factory contract) is aggregated into a single bond and consolidated into a single pool. + One of the most obvious use cases of this EIP is the multilayered pool. The early version of AMM uses a separate smart contract and an [EIP-20](./eip-20.md) LP token to manage a pair. By doing so, the overall liquidity inside of one pool is significantly reduced and thus generates unnecessary gas spent and slippage. Using this EIP standard, one can build a big liquidity pool with all the pairs inside (thanks to the presence of the data structures consisting of the liquidity corresponding to the given class and nonce of bonds). Thus by knowing the class and nonce of the bonds, the liquidity can be represented as the percentage of a given token pair for the owner of the bond in the given pool. Effectively, the [EIP-20](./eip-20.md) LP token (defined by a unique smart contract in the pool factory contract) is aggregated into a single bond and consolidated into a single pool. - The reason behind the standard's name (abstract storage bond) is its ability to store all the specifications (metadata/values and transaction as defined in the following sections) without needing external storage on-chain/off-chain. @@ -401,7 +421,7 @@ To ensure the indexing of transactions throughout the bond lifecycle (i.e "Issue However, creating a separate bank contract is recommended for reading the bonds and future upgrade needs. -Acceptable collateral can be in the form of [EIP-20](./eip-20.md) tokens, [EIP-721](./eip-721.md) tokens, or other bonds represented by the standard. Thus bonds can now represent a collection of collaterals (of the same type) of all fungible/non-fungible or semi-fungible tokens. +Acceptable collateral can be in the form of fungible (like [EIP-20](./eip-20.md)), non-fungible ([EIP-721](./eip-721.md), [EIP-1155](./eip-1155.md)) , or other bonds represented by this standard. ## Test Cases @@ -412,16 +432,14 @@ Test-case for the minimal reference implementation is [here](../assets/eip-3475/ - [Interface](../assets/eip-3475/interfaces/IERC3475.sol). - [Basic Example](../assets/eip-3475/ERC3475.sol). - - This demonstration shows only minimalist implementation. + - This demonstration shows only minimalist implementation. ## Security Considerations -- The `function setApprovalFor()` gives the operator role in this standard. It has all the permissions to transfer, burn and redeem bonds by default. +- The `function setApprovalFor(address _operatorAddress)` gives the operator role to `_operatorAddress`. It has all the permissions to transfer, burn and redeem bonds by default. - If the owner wants to give a one-time allocation to an address for specific bonds(classId,bondsId), he should call the `function approve()` giving the `Transaction[]` allocated rather than approving all the classes using `setApprovalFor`. -- The `function issue()` can only be called by the bank contract (what we call issuer in this EIP). This can be either a smart contract managing the logic of liquidity management and routing the collateral, but also EOA multi-sig. - ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md). diff --git a/assets/eip-3475/ERC3475.sol b/assets/eip-3475/ERC3475.sol index 157476587c42f1..43448e132e1999 100644 --- a/assets/eip-3475/ERC3475.sol +++ b/assets/eip-3475/ERC3475.sol @@ -49,16 +49,18 @@ contract ERC3475 is IERC3475 { _classMetadata[0].title = "symbol"; _classMetadata[0]._type = "string"; _classMetadata[0].description = "symbol of the class"; - _classes[0]._values[0].stringValue = "DBIT Fix 6M"; - _classMetadata[1].title = "symbol"; - _classMetadata[1]._type = "string"; - _classMetadata[1].description = "symbol of the class"; - _classes[1]._values[0].stringValue = "DBIT Fix test Instantaneous"; - // define "period of the class"; _classMetadata[5].title = "period"; _classMetadata[5]._type = "int"; - _classMetadata[5].description = "details about issuance and redemption time"; + _classMetadata[5].description = "value (in months) about maturity time"; + + + + + // describing the symbol of the different class + _classes[0]._values[0].stringValue = "DBIT Fix 6M"; + _classes[1]._values[0].stringValue = "DBIT Fix test Instantaneous"; + // define the maturity time period (for the test class). _classes[0]._values[5].uintValue = 10; @@ -74,15 +76,16 @@ contract ERC3475 is IERC3475 { _classes[1].nonces[1]._values[0].uintValue = block.timestamp + 2; _classes[1].nonces[2]._values[0].uintValue = block.timestamp + 3; - // define "maturity of the nonce"; + // define metadata explaining "maturity of the nonce"; _classes[0]._nonceMetadata[0].title = "maturity"; _classes[0]._nonceMetadata[0]._type = "int"; _classes[0]._nonceMetadata[0].description = "maturity date in integer"; + _classes[1]._nonceMetadata[0].title = "maturity"; - _classes[0]._nonceMetadata[0]._type = "int"; + _classes[1]._nonceMetadata[0]._type = "int"; _classes[1]._nonceMetadata[0].description = "maturity date in integer"; - // defining the value status + // initializing all of the nonces for issued bonds _classes[0].nonces[0]._values[0].boolValue = true; _classes[0].nonces[1]._values[0].boolValue = true; _classes[0].nonces[2]._values[0].boolValue = true; diff --git a/assets/eip-3475/interfaces/IERC3475.sol b/assets/eip-3475/interfaces/IERC3475.sol index 9dc5a45e06deb4..9fa2b1b44c2c5e 100644 --- a/assets/eip-3475/interfaces/IERC3475.sol +++ b/assets/eip-3475/interfaces/IERC3475.sol @@ -180,22 +180,39 @@ interface IERC3475 { // EVENTS /** * @notice MUST trigger when tokens are transferred, including zero value transfers. + * e.g: + emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E,0x3d03B6C79B75eE7aB35298878D05fe36DC1fEf, [IERC3475.Transaction(1,14,500)]) + means that operator 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef wants to transfer 500 bonds of class 1 , Nonce 14 of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E to address 0x3d03B6C79B75eE7aB35298878D05fe36DC1fEf. */ event Transfer(address indexed _operator, address indexed _from, address indexed _to, Transaction[] _transactions); /** * @notice MUST trigger when tokens are issued + * @notice Issue MUST trigger when Bonds are issued. This SHOULD not include zero value Issuing. + * @dev This SHOULD not include zero value issuing. + * @dev Issue MUST be triggered when the operator (i.e Bank address) contract issues bonds to the given entity. + eg: emit Issue(_operator, 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); + issue by address(operator) 500 Bonds(nonce14,class 0) to address 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ event Issue(address indexed _operator, address indexed _to, Transaction[] _transactions); /** - * @notice MUST trigger when tokens are redeemed + * @notice MUST trigger when tokens are redeemed. + * @notice Redeem MUST trigger when Bonds are redeemed. This SHOULD not include zero value redemption. + * eg: emit Redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); + * this emit event when 5000 bonds of class 1, nonce 14 owned by address 0x492Af743654549b12b1B807a9E0e8F397E44236E are being redeemed by 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ event Redeem(address indexed _operator, address indexed _from, Transaction[] _transactions); /** * @notice MUST trigger when tokens are burned + * @dev `Burn` MUST trigger when the bonds are being redeemed via staking (or being invalidated) by the bank contract. + * @dev `Burn` MUST trigger when Bonds are burned. This SHOULD not include zero value burning + * @notice emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]); + * emits event when 5000 bonds of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E of type (class 1, nonce 14) are burned by operator 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef. */ event Burn(address indexed _operator, address indexed _from, Transaction[] _transactions); /** * @dev MUST emit when approval for a second party/operator address to manage all bonds from a classId given for an owner address is enabled or disabled (absence of an event assumes disabled). + * @dev its emitted when address(_owner) approves the address(_operator) to transfer his bonds. + * @notice Approval MUST trigger when bond holders are approving an _operator. This SHOULD not include zero value approval. */ event ApprovalFor(address indexed _owner, address indexed _operator, bool _approved); }