// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.0; interface IERC3475 { // STRUCTURE /** * @dev Values structure of the Metadata */ struct Values { string stringValue; uint uintValue; address addressValue; bool boolValue; } /** * @dev structure allows to define particular bond metadata (ie the values in the class as well as nonce inputs). * @notice 'title' defining the title information, * @notice '_type' explaining the data type of the title information added (eg int, bool, address), * @notice 'description' explains little description about the information stored in the bond", */ struct Metadata { string title; string _type; string description; } /** * @dev structure that defines the parameters for specific issuance of bonds and amount which are to be transferred/issued/given allowance, etc. * @notice this structure is used to streamline the input parameters for functions of this standard with that of other Token standards like ERC20. * @classId is the class id of the bond. * @nonceId is the nonce id of the given bond class. This param is for distinctions of the issuing conditions of the bond. * @amount is the amount of the bond that will be transferred. */ struct Transaction { uint256 classId; uint256 nonceId; uint256 _amount; } // WRITABLES /** * @dev allows the transfer of a bond from one address to another (either single or in batches). * @param _from is the address of the holder whose balance is about to decrease. * @param _to is the address of the recipient whose balance is about to increase. * @param _transactions is the object defining {class,nonce and amount of the bonds to be transferred}. */ function transferFrom(address _from, address _to, Transaction[] calldata _transactions) external; /** * @dev allows the transfer of allowance from one address to another (either single or in batches). * @param _from is the address of the holder whose balance about to decrease. * @param _to is the address of the recipient whose balance is about to increased. * @param _transactions is the object defining {class,nonce and amount of the bonds to be allowed to transferred}. */ function transferAllowanceFrom(address _from, address _to, Transaction[] calldata _transactions) external; /** * @dev allows issuing of any number of bond types to an address(either single/batched issuance). * The calling of this function needs to be restricted to bond issuer contract. * @param _to is the address to which the bond will be issued. * @param _transactions is the object defining {class,nonce and amount of the bonds to be issued for given whitelisted bond}. */ function issue(address _to, Transaction[] calldata _transactions) external; /** * @dev allows redemption of any number of bond types from an address. * The calling of this function needs to be restricted to bond issuer contract. * @param _from is the address _from which the bond will be redeemed. * @param _transactions is the object defining {class,nonce and amount of the bonds to be redeemed for given whitelisted bond}. */ function redeem(address _from, Transaction[] calldata _transactions) external; /** * @dev allows the transfer of any number of bond types from an address to another. * The calling of this function needs to be restricted to bond issuer contract. * @param _from is the address of the holder whose balance about to decrees. * @param _transactions is the object defining {class,nonce and amount of the bonds to be redeemed for given whitelisted bond}. */ function burn(address _from, Transaction[] calldata _transactions) external; /** * @dev Allows _spender to withdraw from your account multiple times, up to the amount. * @notice If this function is called again, it overwrites the current allowance with amount. * @param _spender is the address the caller approve for his bonds. * @param _transactions is the object defining {class,nonce and amount of the bonds to be approved for given whitelisted bond}. */ function approve(address _spender, Transaction[] calldata _transactions) external; /** * @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. * @dev MUST emit the ApprovalForAll event on success. * @param _operator Address to add to the set of authorized operators * @param _approved "True" if the operator is approved, "False" to revoke approval. */ function setApprovalFor(address _operator, bool _approved) external; // READABLES /** * @dev Returns the total supply of the bond in question. */ function totalSupply(uint256 classId, uint256 nonceId) external view returns (uint256); /** * @dev Returns the redeemed supply of the bond in question. */ function redeemedSupply(uint256 classId, uint256 nonceId) external view returns (uint256); /** * @dev Returns the active supply of the bond in question. */ function activeSupply(uint256 classId, uint256 nonceId) external view returns (uint256); /** * @dev Returns the burned supply of the bond in question. */ function burnedSupply(uint256 classId, uint256 nonceId) external view returns (uint256); /** * @dev Returns the balance of the giving bond classId and bond nonce. */ function balanceOf(address _account, uint256 classId, uint256 nonceId) external view returns (uint256); /** * @dev Returns the JSON metadata of the classes. * The metadata SHOULD follow a set of structure explained later in eip-3475.md * @param metadataId is the index corresponding to the class parameter that you want to return from mapping. */ function classMetadata(uint256 metadataId) external view returns ( Metadata memory); /** * @dev Returns the JSON metadata of the Values of the nonces in the corresponding class. * @param classId is the specific classId of which you want to find the metadata of the corresponding nonce. * @param metadataId is the index corresponding to the class parameter that you want to return from mapping. * @notice The metadata SHOULD follow a set of structure explained later in metadata section. */ function nonceMetadata(uint256 classId, uint256 metadataId) external view returns ( Metadata memory); /** * @dev Returns the values of the given classId. * @param classId is the specific classId of which we want to return the parameter. * @param metadataId is the index corresponding to the class parameter that you want to return from mapping. * the metadata SHOULD follow a set of structures explained in eip-3475.md */ function classValues(uint256 classId, uint256 metadataId) external view returns ( Values memory); /** * @dev Returns the values of given nonceId. * @param metadataId index number of structure as explained in the metadata section in EIP-3475. * @param classId is the class of bonds for which you determine the nonce. * @param nonceId is the nonce for which you return the value struct info. * Returns the values object corresponding to the given value. */ function nonceValues(uint256 classId, uint256 nonceId, uint256 metadataId) external view returns ( Values memory); /** * @dev Returns the information about the progress needed to redeem the bond identified by classId and nonceId. * @notice Every bond contract can have its own logic concerning the progress definition. * @param classId The class of bonds. * @param nonceId is the nonce of bonds for finding the progress. * Returns progressAchieved is the current progress achieved. * Returns progressRemaining is the remaining progress. */ function getProgress(uint256 classId, uint256 nonceId) external view returns (uint256 progressAchieved, uint256 progressRemaining); /** * @notice Returns the amount that spender is still allowed to withdraw from _owner (for given classId and nonceId issuance) * @param _owner is the address whose owner allocates some amount to the _spender address. * @param classId is the classId of the bond. * @param nonceId is the nonce corresponding to the class for which you are approving the spending of total amount of bonds. */ function allowance(address _owner, address _spender, uint256 classId, uint256 nonceId) external view returns (uint256); /** * @notice Queries the approval status of an operator for bonds (for all classes and nonce issuances of owner). * @param _owner is the current holder of the bonds for all classes/nonces. * @param _operator is the address with access to the bonds of _owner for transferring. * Returns "true" if the operator is approved, "false" if not. */ function isApprovedFor(address _owner, address _operator) external view returns (bool); // 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 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); }