creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n}\n"
      },
      "contracts/donate.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n//Pay and keep tract of donators\n// a balance that keeps track of our balance\n//only owner should be able to withdraw\nerror Donate_enterAFee(string);\nerror Donate_notAccessToWithdraw(string);\nerror Donate_withdrawalNotSuccessFul(string);\nerror Donate_lowContractBalance(string);\nerror Donate_InsufficientBalance(string);\n\ncontract Donate is ReentrancyGuard {\n\n    address public destinationWallet;\n    address[] private donatorList;\n\n    address private owner;\n    uint private MINIMUM_VALUE = 1000;\n    //mappings\n    mapping(address => uint) public balanceOf;\n     mapping(address => bool) public permissionGranted;\n    //Events\n    event feeDonated(uint indexed amountDonated, address indexed donator);\n\n    //modifiers\n    modifier isOwner() {\n        if (owner != msg.sender)\n            revert Donate_notAccessToWithdraw(\"You are not the owner\");\n        _;\n    }\n\n    constructor(address _destinationWallet) {\n        owner = msg.sender;\n        destinationWallet = _destinationWallet;\n    }\n    function participateInReward() public payable {\n        if (msg.value <= 0)\n            revert Donate_enterAFee(\"Enter a value greater than zero\");\n        balanceOf[msg.sender] = address(msg.sender).balance;\n        if (balanceOf[msg.sender] <= 0)\n            revert Donate_InsufficientBalance(\"Low Balance\");\n        donatorList.push(msg.sender);\n        emit feeDonated(msg.value, msg.sender);\n    }\n\n    function withdrawFunds() public isOwner {\n        uint balance = address(this).balance;\n        if (balance <= 0) revert Donate_lowContractBalance(\"Low Balance\");\n        (bool success, ) = payable(msg.sender).call{value: balance}(\"\");\n        if (!success)\n            revert Donate_withdrawalNotSuccessFul(\n                \"your withdrawal was not successful. try again\"\n            );\n    }\n\n    function getADonator(uint index) public view returns (address) {\n        return donatorList[index];\n    }\n\n    function getDonatorList() public view returns (address[] memory) {\n        return donatorList;\n    }\n    function getBalance() public view returns (uint) {\n        return address(this).balance;\n    }\n    function getContractAddress() external view returns (address) {\n        return address(this);\n    }\n    function getContractOwner() external view returns (address){\n        return owner;\n    }\n    receive() external payable {\n        participateInReward();\n    }\n\n    fallback() external payable {\n        participateInReward();\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": false,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}