Skip to content
Verified contractExactMIT

DividendWallet

Address0x21e5de8d232b2b64ceeab96eca9148821c3d8aa0
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,135,180
Creation transaction
0xd81bcfdb43…a0861c1064

Wallet Dressed.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/* “The best way to find yourself is to lose yourself in the service of others.” – Mahatma Gandhi
 
                                                                                                                                                       
                                                                    dddddddd                                                                           
        GGGGGGGGGGGGG                                               d::::::dhhhhhhh               iiii   jjjj   iiii            iiii                   
     GGG::::::::::::G                                               d::::::dh:::::h              i::::i j::::j i::::i          i::::i                  
   GG:::::::::::::::G                                               d::::::dh:::::h               iiii   jjjj   iiii            iiii                   
  G:::::GGGGGGGG::::G                                               d:::::d h:::::h                                                                    
 G:::::G       GGGGGG  aaaaaaaaaaaaa  nnnn  nnnnnnnn        ddddddddd:::::d  h::::h hhhhh       iiiiiiijjjjjjjiiiiiii         iiiiiii    ooooooooooo   
G:::::G                a::::::::::::a n:::nn::::::::nn    dd::::::::::::::d  h::::hh:::::hhh    i:::::ij:::::ji:::::i         i:::::i  oo:::::::::::oo 
G:::::G                aaaaaaaaa:::::an::::::::::::::nn  d::::::::::::::::d  h::::::::::::::hh   i::::i j::::j i::::i          i::::i o:::::::::::::::o
G:::::G    GGGGGGGGGG           a::::ann:::::::::::::::nd:::::::ddddd:::::d  h:::::::hhh::::::h  i::::i j::::j i::::i          i::::i o:::::ooooo:::::o
G:::::G    G::::::::G    aaaaaaa:::::a  n:::::nnnn:::::nd::::::d    d:::::d  h::::::h   h::::::h i::::i j::::j i::::i          i::::i o::::o     o::::o
G:::::G    GGGGG::::G  aa::::::::::::a  n::::n    n::::nd:::::d     d:::::d  h:::::h     h:::::h i::::i j::::j i::::i          i::::i o::::o     o::::o
G:::::G        G::::G a::::aaaa::::::a  n::::n    n::::nd:::::d     d:::::d  h:::::h     h:::::h i::::i j::::j i::::i          i::::i o::::o     o::::o
 G:::::G       G::::Ga::::a    a:::::a  n::::n    n::::nd:::::d     d:::::d  h:::::h     h:::::h i::::i j::::j i::::i          i::::i o::::o     o::::o
  G:::::GGGGGGGG::::Ga::::a    a:::::a  n::::n    n::::nd::::::ddddd::::::dd h:::::h     h:::::hi::::::ij::::ji::::::i        i::::::io:::::ooooo:::::o
   GG:::::::::::::::Ga:::::aaaa::::::a  n::::n    n::::n d:::::::::::::::::d h:::::h     h:::::hi::::::ij::::ji::::::i ...... i::::::io:::::::::::::::o
     GGG::::::GGG:::G a::::::::::aa:::a n::::n    n::::n  d:::::::::ddd::::d h:::::h     h:::::hi::::::ij::::ji::::::i .::::. i::::::i oo:::::::::::oo 
        GGGGGG   GGGG  aaaaaaaaaa  aaaa nnnnnn    nnnnnn   ddddddddd   ddddd hhhhhhh     hhhhhhhiiiiiiiij::::jiiiiiiii ...... iiiiiiii   ooooooooooo   
                                                                                                        j::::j                                         
                                                                                              jjjj      j::::j                                         
                                                                                             j::::jj   j:::::j                                         
                                                                                             j::::::jjj::::::j                                         
                                                                                              jj::::::::::::j                                          
                                                                                                jjj::::::jjj                                           
                                                                                                   jjjjjj                 
																						   
																						   
 ██████████    ███               ███      █████                         █████    █████   ███   █████           ████  ████            █████   
░░███░░░░███  ░░░               ░░░      ░░███                         ░░███    ░░███   ░███  ░░███           ░░███ ░░███           ░░███    
 ░███   ░░███ ████  █████ █████ ████   ███████   ██████  ████████    ███████     ░███   ░███   ░███   ██████   ░███  ░███   ██████  ███████  
 ░███    ░███░░███ ░░███ ░░███ ░░███  ███░░███  ███░░███░░███░░███  ███░░███     ░███   ░███   ░███  ░░░░░███  ░███  ░███  ███░░███░░░███░   
 ░███    ░███ ░███  ░███  ░███  ░███ ░███ ░███ ░███████  ░███ ░███ ░███ ░███     ░░███  █████  ███    ███████  ░███  ░███ ░███████   ░███    
 ░███    ███  ░███  ░░███ ███   ░███ ░███ ░███ ░███░░░   ░███ ░███ ░███ ░███      ░░░█████░█████░    ███░░███  ░███  ░███ ░███░░░    ░███ ███
 ██████████   █████  ░░█████    █████░░████████░░██████  ████ █████░░████████       ░░███ ░░███     ░░████████ █████ █████░░██████   ░░█████ 
░░░░░░░░░░   ░░░░░    ░░░░░    ░░░░░  ░░░░░░░░  ░░░░░░  ░░░░ ░░░░░  ░░░░░░░░         ░░░   ░░░       ░░░░░░░░ ░░░░░ ░░░░░  ░░░░░░     ░░░░░   
	 
 *  This Dividend Wallet stands as a guardian of earned value, autonomously forwarding ETH dividends to Wisdom NFT holders as their rightful share from the Swaraj contract.
 * Trustless. Transparent. Timeless.												   
*/

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

interface ISwaraj {
    function withdraw() external;
    function myDividends(bool includeReferralBonus) external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
}

interface IERC721 {
    function ownerOf(uint256 tokenId) external view returns (address);
}

contract DividendWallet is ReentrancyGuard {
    address public nftContract;
    address public swaraj;
    uint256 public tokenId;
    bool public initialized;
    uint256 public totalClaimed;
    string public quote;

    event DividendClaimed(uint256 tokenId, address owner, uint256 amount);

    function init(address _nftContract, uint256 _tokenId, address _swaraj, string memory _quote) external {
        require(!initialized, "Already initialized");
        require(_nftContract != address(0), "Invalid NFT contract");
        require(_swaraj != address(0), "Invalid Swaraj contract");

        nftContract = _nftContract;
        tokenId = _tokenId;
        swaraj = _swaraj;
        quote = _quote;
        initialized = true;
    }

    function claimDividends() external nonReentrant {
        require(initialized, "Not initialized");

        address owner = IERC721(nftContract).ownerOf(tokenId);
        uint256 beforeBalance = address(this).balance;

        ISwaraj(swaraj).withdraw();

        uint256 gained = address(this).balance - beforeBalance;
        require(gained > 0, "No dividends");

        totalClaimed += gained;

        (bool success, ) = payable(owner).call{value: gained}("");
        require(success, "ETH transfer failed");

        emit DividendClaimed(tokenId, owner, gained);
    }

    function getDividends() external view returns (uint256) {
        return ISwaraj(swaraj).myDividends(true);
    }

    function getDividendBreakdown() external view returns (uint256 baseDividends, uint256 referralBonus) {
        uint256 total = ISwaraj(swaraj).myDividends(true);
        uint256 base = ISwaraj(swaraj).myDividends(false);
        return (base, total - base);
    }

    function getSWJBalance() external view returns (uint256) {
        return ISwaraj(swaraj).balanceOf(address(this));
    }

    function getOwner() external view returns (address) {
        return IERC721(nftContract).ownerOf(tokenId);
    }

    receive() external payable {
        require(msg.sender == swaraj, "Only Swaraj can send ETH");
    }

/**
  * To RK. Without you I would have nothing. I love you always, wife.
*/
}

@openzeppelin/contracts/security/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.