|
{
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"contracts/RedeemerFactory.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport \"./Redeemer.sol\";\nimport \"./interfaces/IRedeemerFactory.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract RedeemerFactory is IRedeemerFactory, Ownable {\n int public constant Version = 3;\n\n address public protocolManagerAddr;\n\n function setPMAddress(address _pmAddress) external onlyOwner {\n require(_pmAddress != address(0x0), \"ZERO Addr is not allowed\");\n protocolManagerAddr = _pmAddress;\n }\n\n function createRedeemerContract(\n address fluentToken,\n address burnerContract,\n address fedMember,\n address redeemersBookkeper,\n address redeemersTreasury\n ) external returns (address) {\n require(msg.sender == protocolManagerAddr, \"Caller is not the PM\");\n Redeemer newRedeemer = new Redeemer(\n fluentToken,\n burnerContract,\n fedMember,\n redeemersBookkeper,\n redeemersTreasury\n );\n\n return address(newRedeemer);\n }\n}\n"
|
|
},
|
|
"contracts/Redeemer.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport \"./interfaces/IRedeemer.sol\";\nimport \"./interfaces/IUSPlusBurner.sol\";\nimport \"./interfaces/IFluentUSPlus.sol\";\nimport \"./interfaces/IRedeemersBookkeeper.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\n\n/// @title Federation member´s Contract for redeem balance\n/// @author Fluent Group - Development team\n/// @notice Use this contract for request US dollars back\n/// @dev\ncontract Redeemer is IRedeemer, Pausable, AccessControl {\n int public constant Version = 3;\n bytes32 public constant USER_ROLE = keccak256(\"USER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n bytes32 public constant APPROVER_ROLE = keccak256(\"APPROVER_ROLE\");\n bytes32 public constant TRANSFER_REJECTED_AMOUNTS_OPERATOR_ROLE =\n keccak256(\"TRANSFER_REJECTED_AMOUNTS_OPERATOR_ROLE\");\n bytes32 public constant TRANSFER_ALLOWLIST_TOKEN_OPERATOR_ROLE =\n keccak256(\"TRANSFER_ALLOWLIST_TOKEN_OPERATOR_ROLE\");\n bytes32 public constant TRANSFER_ALLOWLIST_TOKEN_COMPLIANCE_ROLE =\n keccak256(\"TRANSFER_ALLOWLIST_TOKEN_COMPLIANCE_ROLE\");\n\n address public fedMemberId;\n address public USPlusBurnerAddr;\n address public fluentUSPlusAddress;\n address public redeemersBookkeeper;\n address public redeemerTreasury;\n\n constructor(\n address _fluentUSPlusAddress,\n address _USPlusBurnerAddr,\n address _fedMemberId,\n address _redeemerBookkeeper,\n address _redeemerTreasury\n ) {\n require(\n _fluentUSPlusAddress != address(0x0),\n \"ZERO Addr is not allowed\"\n );\n require(_USPlusBurnerAddr != address(0x0), \"ZERO Addr is not allowed\");\n require(_fedMemberId != address(0x0), \"ZERO Addr is not allowed\");\n require(\n _redeemerBookkeeper != address(0x0),\n \"ZERO Addr is not allowed\"\n );\n require(_redeemerTreasury != address(0x0), \"ZERO Addr is not allowed\");\n\n _grantRole(DEFAULT_ADMIN_ROLE, _fedMemberId);\n _grantRole(PAUSER_ROLE, _fedMemberId);\n _grantRole(APPROVER_ROLE, _fedMemberId);\n\n fluentUSPlusAddress = _fluentUSPlusAddress;\n USPlusBurnerAddr = _USPlusBurnerAddr;\n fedMemberId = _fedMemberId;\n redeemersBookkeeper = _redeemerBookkeeper;\n redeemerTreasury = _redeemerTreasury;\n }\n\n function pause() external onlyRole(PAUSER_ROLE) {\n _pause();\n }\n\n function unpause() external onlyRole(PAUSER_ROLE) {\n _unpause();\n }\n\n /// @notice Entry point to a user request redeem their US+ back to FIAT\n /// @dev\n /// @param amount The requested amount\n /// @param refId The Ticket Id generated in Core Banking System\n function requestRedeem(\n uint256 amount,\n bytes32 refId\n ) external whenNotPaused returns (bool isRequestPlaced) {\n require(\n verifyRole(USER_ROLE, msg.sender),\n \"Caller does not have the role to request redeem\"\n );\n require(\n IERC20(fluentUSPlusAddress).balanceOf(msg.sender) >= amount,\n \"NOT_ENOUGH_BALANCE\"\n );\n require(\n IERC20(fluentUSPlusAddress).allowance(msg.sender, address(this)) >=\n amount,\n \"NOT_ENOUGH_ALLOWANCE\"\n );\n\n require(!getUsedTicketsInfo(refId), \"ALREADY_USED_REFID\"); //needs to send to redeemers bookkeeping\n\n emit RedeemRequested(msg.sender, amount, refId);\n\n BurnTicket memory ticket = IRedeemer.BurnTicket({\n refId: refId,\n from: msg.sender,\n amount: amount,\n placedBlock: block.number,\n confirmedBlock: 0,\n usedTicket: true,\n ticketStatus: TicketStatus.PENDING\n });\n\n _setBurnTickets(refId, ticket);\n require(\n IERC20(fluentUSPlusAddress).transferFrom(\n msg.sender,\n address(this),\n amount\n ),\n \"FAIL_TRANSFER\"\n );\n\n return true;\n }\n\n /// @notice Set a Ticket to approved or not approved\n /// @dev\n /// @param refId The Ticket Id generated in Core Banking System\n /// @param isApproved boolean condition for this Ticket\n function approveTickets(\n bytes32 refId,\n bool isApproved\n ) external onlyRole(APPROVER_ROLE) {\n BurnTicket memory ticket = _getBurnTicketInfo(refId);\n require(ticket.usedTicket, \"INVALID_TICKED_ID\");\n require(\n ticket.ticketStatus == TicketStatus.PENDING,\n \"INVALID_TICKED_STATUS\"\n );\n\n if (isApproved) {\n _approvedTicket(refId);\n } else {\n _setRejectedAmounts(refId, true);\n\n BurnTicket memory _ticket = IRedeemer.BurnTicket({\n refId: ticket.refId,\n from: ticket.from,\n amount: ticket.amount,\n placedBlock: ticket.placedBlock,\n confirmedBlock: ticket.confirmedBlock,\n usedTicket: ticket.usedTicket,\n ticketStatus: TicketStatus.REJECTED\n });\n\n _setBurnTickets(refId, _ticket);\n }\n }\n\n /// @notice Set a Ticket to approved and send it to US+\n /// @dev\n /// @param refId The Ticket Id generated in Core Banking System\n function _approvedTicket(\n bytes32 refId\n )\n internal\n onlyRole(APPROVER_ROLE)\n whenNotPaused\n returns (bool isTicketApproved)\n {\n emit RedeemApproved(refId);\n\n BurnTicket memory ticket = _getBurnTicketInfo(refId); //retrieve from the bookkeeper\n\n BurnTicket memory _ticket = IRedeemer.BurnTicket({\n refId: ticket.refId,\n from: ticket.from,\n amount: ticket.amount,\n placedBlock: ticket.placedBlock,\n confirmedBlock: ticket.confirmedBlock,\n usedTicket: ticket.usedTicket,\n ticketStatus: TicketStatus.APPROVED\n });\n\n _setBurnTickets(refId, _ticket);\n require(\n IUSPlusBurner(USPlusBurnerAddr).requestBurnUSPlus(\n ticket.refId,\n address(this),\n ticket.from,\n fedMemberId,\n ticket.amount\n )\n );\n\n require(\n IFluentUSPlus(fluentUSPlusAddress).increaseAllowance(\n USPlusBurnerAddr,\n ticket.amount\n ),\n \"INCREASE_ALLOWANCE_FAIL\"\n );\n\n return true;\n }\n\n /// @notice Allows the FedMember give a destination for a seized value\n /// @dev\n /// @param _refId The Ticket Id generated in Core Banking System\n /// @param recipient The target address where the values will be addressed\n function transferRejectedAmounts(\n bytes32 refId,\n address recipient\n ) external onlyRole(TRANSFER_REJECTED_AMOUNTS_OPERATOR_ROLE) whenNotPaused {\n require(\n !hasRole(APPROVER_ROLE, msg.sender),\n \"Call not allowed. Caller has also Approver Role\"\n );\n\n require(_getRejectedAmounts(refId), \"Not a rejected refId\");\n\n BurnTicket memory ticket = _getBurnTicketInfo(refId); //retrieve from the keeper\n require(\n ticket.ticketStatus == TicketStatus.REJECTED,\n \"Ticket not rejected\"\n );\n\n BurnTicket memory _ticket = IRedeemer.BurnTicket({\n refId: ticket.refId,\n from: ticket.from,\n amount: ticket.amount,\n placedBlock: ticket.placedBlock,\n confirmedBlock: ticket.confirmedBlock,\n usedTicket: ticket.usedTicket,\n ticketStatus: TicketStatus.TRANSFERED\n });\n\n emit RejectedAmountsTransfered(refId, recipient);\n\n _setBurnTickets(refId, _ticket);\n\n _setRejectedAmounts(refId, false); //send to the keeper\n require(\n IERC20(fluentUSPlusAddress).transfer(recipient, ticket.amount),\n \"FAIL_TRANSFER\"\n );\n }\n\n function revertTicketRejection(\n bytes32 refId\n ) external onlyRole(APPROVER_ROLE) whenNotPaused {\n BurnTicket memory ticket = _getBurnTicketInfo(refId);\n require(\n ticket.ticketStatus == TicketStatus.REJECTED,\n \"Ticket not rejected\"\n );\n\n BurnTicket memory _ticket = IRedeemer.BurnTicket({\n refId: ticket.refId,\n from: ticket.from,\n amount: ticket.amount,\n placedBlock: ticket.placedBlock,\n confirmedBlock: ticket.confirmedBlock,\n usedTicket: ticket.usedTicket,\n ticketStatus: TicketStatus.PENDING\n });\n\n _setBurnTickets(refId, _ticket);\n\n _setRejectedAmounts(refId, false);\n }\n\n /// @notice Returns a Burn ticket structure\n /// @dev\n /// @param refId The Ticket Id generated in Core Banking System\n function getBurnReceiptById(\n bytes32 refId\n ) external view returns (BurnTicket memory) {\n // return burnTickets[refId];\n return _getBurnTicketInfo(refId); //retrieve from the bookkeper\n }\n\n /// @notice Returns Status, Execution Status and the Block Number when the burn occurs\n /// @dev\n /// @param _refId The Ticket Id generated in Core Banking System\n function getBurnStatusById(\n bytes32 refId\n ) external view returns (bool, TicketStatus, uint256) {\n BurnTicket memory ticket = _getBurnTicketInfo(refId);\n\n if (ticket.usedTicket) {\n return (\n ticket.usedTicket,\n ticket.ticketStatus,\n ticket.confirmedBlock //retrieve from the bookkeper\n );\n } else {\n return (false, TicketStatus.NOT_EXIST, 0);\n }\n }\n\n function rejectedAmount(bytes32 refId) external view returns (bool) {\n return _getRejectedAmounts(refId);\n }\n\n function setErc20AllowList(\n address erc20Addr,\n bool status\n ) external onlyRole(TRANSFER_ALLOWLIST_TOKEN_COMPLIANCE_ROLE) {\n require(\n !_getErc20AllowList(erc20Addr),\n \"Address already in the ERC20 AllowList\"\n );\n _setErc20AllowList(erc20Addr, status);\n }\n\n function transferErc20(\n address to,\n address erc20Addr,\n uint256 amount\n ) external onlyRole(TRANSFER_ALLOWLIST_TOKEN_OPERATOR_ROLE) {\n require(\n _getErc20AllowList(erc20Addr),\n \"Address not in the ERC20 AllowList\"\n );\n require(IERC20(erc20Addr).transfer(to, amount), \"Fail\");\n }\n\n //Access control stored in the redeemersKeeper\n function grantRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) {\n _grantRole(role, account);\n IRedeemersBookkeeper(redeemersBookkeeper).setRoleControl(\n role,\n account,\n fedMemberId\n );\n }\n\n function verifyRole(\n bytes32 role,\n address account\n ) public view returns (bool _hasRole) {\n _hasRole = IRedeemersBookkeeper(redeemersBookkeeper).getRoleControl(\n role,\n account,\n fedMemberId\n );\n return _hasRole;\n }\n\n function revokeRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) {\n _revokeRole(role, account);\n IRedeemersBookkeeper(redeemersBookkeeper).revokeRoleControl(\n role,\n account,\n fedMemberId\n );\n }\n\n function getUsedTicketsInfo(bytes32 refId) public view returns (bool) {\n return\n IRedeemersBookkeeper(redeemersBookkeeper)\n .getBurnTickets(fedMemberId, refId)\n .usedTicket;\n }\n\n function _getBurnTicketInfo(\n bytes32 refId\n ) internal view returns (IRedeemer.BurnTicket memory _burnTickets) {\n _burnTickets = IRedeemersBookkeeper(redeemersBookkeeper).getBurnTickets(\n fedMemberId,\n refId\n );\n return _burnTickets;\n }\n\n function _setBurnTickets(bytes32 refId, BurnTicket memory ticket) internal {\n IRedeemersBookkeeper(redeemersBookkeeper).setTickets(\n fedMemberId,\n refId,\n ticket\n );\n }\n\n function _setRejectedAmounts(bytes32 refId, bool status) internal {\n emit RedeemRejected(refId);\n\n IRedeemersBookkeeper(redeemersBookkeeper).setRejectedAmounts(\n refId,\n fedMemberId,\n status\n );\n }\n\n function _getRejectedAmounts(bytes32 refId) internal view returns (bool) {\n return\n IRedeemersBookkeeper(redeemersBookkeeper).getRejectedAmounts(\n refId,\n fedMemberId\n );\n }\n\n function _setErc20AllowList(address tokenAddress, bool status) internal {\n IRedeemersBookkeeper(redeemersBookkeeper).setErc20AllowListToken(\n fedMemberId,\n tokenAddress,\n status\n );\n }\n\n function _getErc20AllowList(\n address tokenAddress\n ) internal view returns (bool) {\n return\n IRedeemersBookkeeper(redeemersBookkeeper).getErc20AllowListToken(\n fedMemberId,\n tokenAddress\n );\n }\n\n function getErc20AllowList(\n address tokenAddress\n ) external view onlyRole(DEFAULT_ADMIN_ROLE) returns (bool) {\n return\n IRedeemersBookkeeper(redeemersBookkeeper).getErc20AllowListToken(\n fedMemberId,\n tokenAddress\n );\n }\n\n function prepareMigration() external onlyRole(DEFAULT_ADMIN_ROLE) {\n uint currentBalance = IERC20(fluentUSPlusAddress).balanceOf(\n address(this)\n );\n require(\n IFluentUSPlus(fluentUSPlusAddress).increaseAllowance(\n redeemerTreasury,\n currentBalance\n ),\n \"Fail to increase allowance\"\n );\n }\n\n function increaseAllowanceToBurner(\n uint amount\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(\n IFluentUSPlus(fluentUSPlusAddress).increaseAllowance(\n USPlusBurnerAddr,\n amount\n ),\n \"INCREASE_ALLOWANCE_FAIL\"\n );\n }\n}\n"
|
|
},
|
|
"contracts/interfaces/IRedeemerFactory.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IRedeemerFactory {\n function createRedeemerContract(\n address fluentToken,\n address burnerContract,\n address fedMember,\n address redeemersBookkeper,\n address redeemersTreasury\n ) external returns (address);\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/access/Ownable.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
|
|
},
|
|
"contracts/interfaces/IRedeemer.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IRedeemer {\n event RedeemRequested(address indexed user, uint256 amount, bytes32 refId);\n event RedeemApproved(bytes32 refId);\n event RedeemRejected(bytes32 refId);\n event RejectedAmountsTransfered(bytes32 refId, address indexed recipient);\n\n enum TicketStatus {\n NOT_EXIST,\n PENDING,\n APPROVED,\n TRANSFERED,\n REJECTED\n }\n\n struct BurnTicket {\n bytes32 refId;\n address from;\n uint256 amount;\n uint256 placedBlock;\n uint256 confirmedBlock;\n bool usedTicket;\n TicketStatus ticketStatus;\n }\n\n function requestRedeem(\n uint256 amount,\n bytes32 refId\n ) external returns (bool isRequestPlaced);\n\n function approveTickets(bytes32 refId, bool isApproved) external;\n\n function transferRejectedAmounts(bytes32 refId, address recipient) external;\n\n function revertTicketRejection(bytes32 refId) external;\n\n function getBurnReceiptById(\n bytes32 refId\n ) external view returns (BurnTicket memory);\n\n function getBurnStatusById(\n bytes32 refId\n ) external view returns (bool, TicketStatus, uint256);\n\n function setErc20AllowList(address erc20Addr, bool status) external;\n\n function transferErc20(\n address to,\n address erc20Addr,\n uint256 amount\n ) external;\n\n function increaseAllowanceToBurner(uint amount) external;\n}\n"
|
|
},
|
|
"contracts/interfaces/IUSPlusBurner.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IUSPlusBurner {\n struct BurnTicket {\n bytes32 refId;\n address redeemerContractAddress;\n address redeemerPerson;\n address fedMemberID;\n uint256 amount;\n uint256 placedBlock;\n uint256 confirmedBlock;\n bool status;\n bool executed;\n }\n\n ///@dev arrays of refIds\n struct BurnTicketId {\n bytes32 refId;\n address fedMemberId;\n }\n\n /// @notice Returns a Burn ticket structure\n /// @dev\n /// @param id The Ticket Id generated in Core Banking System\n function getBurnReceiptById(\n bytes32 id\n ) external view returns (BurnTicket memory);\n\n /// @notice Returns Status, Execution Status and the Block Number when the burn occurs\n /// @dev\n /// @param id The Ticket Id generated in Core Banking System\n function getBurnStatusById(\n bytes32 id\n ) external view returns (bool, bool, uint256);\n\n function toGrantRole(address _to) external;\n\n /// @notice Execute transferFrom Executer Acc to this contract, and open a burn Ticket\n /// @dev to match the id the fields should be (burnCounter, _refNo, amount, msg.sender)\n /// @param refId Ref Code provided by customer to identify this request\n /// @param redeemerContractAddress The Federation Member´s REDEEMER contract\n /// @param redeemerPerson The person who is requesting USD Redeem\n /// @param fedMemberID Identification for Federation Member\n /// @param amount The amount to be burned\n /// @return isRequestPlaced confirmation if Function gets to the end without revert\n function requestBurnUSPlus(\n bytes32 refId,\n address redeemerContractAddress,\n address redeemerPerson,\n address fedMemberID,\n uint256 amount\n ) external returns (bool isRequestPlaced);\n\n /// @notice Burn the amount of US defined in the ticket\n /// @dev Be aware that burnID is formed by a hash of (mapping.burnCounter, mapping._refNo, amount, _redeemBy), see requestBurnUSPlus method\n /// @param refId Burn TicketID\n /// @param redeemerContractAddress address from the amount get out\n /// @param fedMemberId Federation Member ID\n /// @param amount Burn amount requested\n /// @return isAmountBurned confirmation if Function gets to the end without revert\n function executeBurn(\n bytes32 refId,\n address redeemerContractAddress,\n address fedMemberId,\n uint256 amount,\n address vault\n ) external returns (bool isAmountBurned);\n\n function setComplianceManagerAddr(\n address newComplianceManagerAddr\n ) external;\n\n function setUSPlusAddr(address newUSPlusAddr) external;\n\n function transferErc20(\n address to,\n address erc20Addr,\n uint256 amount\n ) external;\n}\n"
|
|
},
|
|
"contracts/interfaces/IFluentUSPlus.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IFluentUSPlus {\n function burn(uint256 amount) external;\n\n function burnFrom(address account, uint amount) external;\n\n function mint(address to, uint amount) external returns (bool);\n\n function increaseAllowance(\n address spender,\n uint addedValue\n ) external returns (bool);\n\n function transfer(address to, uint256 amount) external returns (bool);\n}\n"
|
|
},
|
|
"contracts/interfaces/IRedeemersBookkeeper.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"./IRedeemer.sol\";\n\ninterface IRedeemersBookkeeper {\n function setTickets(\n address fedMember,\n bytes32 refId,\n IRedeemer.BurnTicket memory ticket\n ) external;\n\n function setRoleControl(\n bytes32 role,\n address account,\n address fedMemberAddr\n ) external;\n\n function getRoleControl(\n bytes32 role,\n address account,\n address fedMemberAddr\n ) external view returns (bool _hasRole);\n\n function revokeRoleControl(\n bytes32 role,\n address account,\n address fedMemberAddr\n ) external;\n\n function getBurnTickets(\n address fedMember,\n bytes32 refId\n ) external view returns (IRedeemer.BurnTicket memory _burnTickets);\n\n function setRejectedAmounts(\n bytes32 refId,\n address fedMember,\n bool status\n ) external;\n\n function getRejectedAmounts(\n bytes32 refId,\n address fedMember\n ) external view returns (bool);\n\n function setErc20AllowListToken(\n address fedMember,\n address tokenAddress,\n bool status\n ) external;\n\n function getErc20AllowListToken(\n address fedMember,\n address tokenAddress\n ) external view returns (bool);\n\n function setRedeemerStatus(address redeemer, bool status) external;\n\n function getRedeemerStatus(address redeemer) external view returns (bool);\n\n function toGrantRole(address redeemerContract) external;\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/security/Pausable.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/access/AccessControl.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/utils/Context.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/access/IAccessControl.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/utils/Strings.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
|
|
}
|
|
},
|
|
"settings": {
|
|
"optimizer": {
|
|
"enabled": false,
|
|
"runs": 200
|
|
},
|
|
"outputSelection": {
|
|
"*": {
|
|
"*": [
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"devdoc",
|
|
"userdoc",
|
|
"metadata",
|
|
"abi"
|
|
]
|
|
}
|
|
},
|
|
"libraries": {}
|
|
}
|
|
} |