Skip to content
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

Update EIP-3475: Changing comments #5789

Merged
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f3d39dc
some minor description changes in interface and example implemenation.
dhruvmalik007 Sep 26, 2022
6fd0a6b
rectifying description of the array struct.
dhruvmalik007 Oct 3, 2022
70b7d1c
Update assets/eip-3475/interfaces/IERC3475.sol
dhruvmalik007 Oct 3, 2022
18b3a81
Update assets/eip-3475/interfaces/IERC3475.sol
dhruvmalik007 Oct 3, 2022
6c99965
Update assets/eip-3475/interfaces/IERC3475.sol
dhruvmalik007 Oct 3, 2022
32320d7
Update assets/eip-3475/interfaces/IERC3475.sol
dhruvmalik007 Oct 3, 2022
d958901
refactoring and addressing ambiguous descriptions
dhruvmalik007 Oct 3, 2022
9727fde
Merge branches and EIP review changes.
dhruvmalik007 Oct 3, 2022
dae0849
refactor
dhruvmalik007 Oct 3, 2022
b6b5e8d
Merge branch 'ethereum:master' into dhruvmalik007/changing-comments-3475
dhruvmalik007 Oct 4, 2022
a42e07f
refactor final
dhruvmalik007 Oct 4, 2022
600ae6b
adding correct syntax and all refactoring done !!
dhruvmalik007 Oct 4, 2022
cc86cef
spaces and refactoring
dhruvmalik007 Oct 5, 2022
18437ab
update
dhruvmalik007 Oct 5, 2022
4ff1ba8
adding the comments in the interfaces from the standard description.
dhruvmalik007 Oct 17, 2022
adacdf2
sync local branch
dhruvmalik007 Oct 17, 2022
85a25dc
separating the examples for events, decluttering.
dhruvmalik007 Oct 28, 2022
3ed1c0e
updating the example class name
dhruvmalik007 Nov 15, 2022
48f420b
Merge branch 'master' into dhruvmalik007/changing-comments-3475
dhruvmalik007 Nov 17, 2022
c28b03d
removing redundant metadata description.
dhruvmalik007 Nov 17, 2022
ae72fd3
refactor the standard based on feedback PR #6128
dhruvmalik007 Dec 14, 2022
4eba8c2
add example
dhruvmalik007 Dec 14, 2022
2c681d1
modified: EIPS/eip-3475.md
dhruvmalik007 Dec 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions EIPS/eip-3475.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,47 +260,59 @@ 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)]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Double checking that you're intentionally changing a zero to a one here.

* issue by address(operator) 500 DBIT-USD Bond(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)]);

//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.

/**
* 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also explain what "zero value burning" means in this contex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it means when the amount corresponding to the given class and nonce of the bonds is Zero. meaning we should not call functions with null value.

* e.g : 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.
*/
emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]);

event burn(address _operator, address _owner, Transaction[] _transactions);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is correcting a mistake where event Burn(...) was never included? If that's true, then this should be:

Suggested change
event burn(address _operator, address _owner, Transaction[] _transactions);
event Burn(address _operator, address _owner, Transaction[] _transactions);

To match the example in the currently Final version of this EIP.


//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.

/**
* 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 DBIT-USD bonds with (Class 1 and Nonce 14) from 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, to address(_to).
*/
emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, _to, [IERC3475.Transaction(1,14,500)]);

// e.g 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);
* 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);
```

Expand Down Expand Up @@ -385,7 +397,10 @@ 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**: 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.

**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.

- 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.

Expand All @@ -412,7 +427,7 @@ 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

Expand Down
14 changes: 8 additions & 6 deletions assets/eip-3475/ERC3475.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";




// 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;
Expand Down
16 changes: 15 additions & 1 deletion assets/eip-3475/interfaces/IERC3475.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,32 @@ interface IERC3475 {
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 DBIT-USD Bond(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);
}