ETH Price: $3,386.66 (-1.35%)

Contract

0x1275E7a67B7B52985d2A2a2bc147424b6C0ffb4e
 

Overview

ETH Balance

0.00183561196020374 ETH

Eth Value

$6.22 (@ $3,386.66/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00003878 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00006741 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00004522 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00004629 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.0000474 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00004854 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00004973 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00177918 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00011023 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00011589 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.000122 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00021621 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00013477 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00013995 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00014545 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00116903 ETH
192548252024-02-18 12:55:59282 days ago1708260959
0x1275E7a6...b6C0ffb4e
0.00015636 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00021393 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00033074 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00034097 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00031315 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00293079 ETH
191476592024-02-03 11:53:35297 days ago1706961215
0x1275E7a6...b6C0ffb4e
0.00178551 ETH
191475152024-02-03 11:23:59297 days ago1706959439
0x1275E7a6...b6C0ffb4e
0.00021564 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DividendTracker

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 5 runs

Other Settings:
default evmVersion
File 1 of 9 : DividendTracker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./DividendToken.sol";

interface IDividendTracker {
	function setExcludedFromDividends(address account, bool state) external;	
    function setBalance(address payable account, uint256 amount) external;
	function setDividendClaimWait(uint256 value) external;
	function process(uint256 gas) external returns (uint256, uint256, uint256);	
}

contract DividendTracker is IDividendTracker, DividendToken {
	using SafeERC20 for IERC20;

    IERC20 public immutable mainToken;
	
	struct Map {
        address[] keys;
        mapping(address => uint) indexOf;
        mapping(address => bool) inserted;
    }

    Map private tokenHoldersMap;
    uint256 public lastProcessedIndex;
	uint256 public claimWait;

    mapping (address => bool) public excludedFromDividends;
    mapping (address => uint256) public lastClaimTimes;
				
    constructor(
		string memory dtName_, 
		string memory dtSymbol_
	) 
        DividendToken(dtName_, dtSymbol_) 
    {
    	mainToken = IERC20(msg.sender);
    }

	// --------------------- MAIN TOKEN ------------------------
	modifier onlyMainToken() {
        require(_msgSender() == address(mainToken), "Not allowed");
        _;
    }	
    
    function setDividendClaimWait(uint256 value) public onlyMainToken {
    	_checkAlreadySet(claimWait == value);
		claimWait = value;
    }

    function setExcludedFromDividends(address account, bool state) public onlyMainToken {
    	_checkAlreadySet(excludedFromDividends[account] == state);
    	excludedFromDividends[account] = state;
		if (!state) {
			_processAccount(payable(account));
			_exclude(account);
			
			_setBalance(account, 0);		
			_tokenHoldersRemove(account);
		} 
    }

	function setBalance(address payable account, uint256 value) external onlyMainToken {
    	if (excludedFromDividends[account]) return;    		
		_tokenHoldersAdd(account);
		_setBalance(account, value);    		
		
		_processAccount(account);
		_include(account);	
    }

    // --------------------- VIEW ------------------------

    function getAccount(address account_) public view returns (
        address account,
        int256 index,
        int256 iterationsUntilProcessed,
        uint256 withdrawableDividends,
        uint256 totalDividends,
        uint256 lastClaimTime,
        uint256 nextClaimTime,
        uint256 secondsUntilAutoClaimAvailable
	) {
        account = account_;
        index = tokenHoldersGetIndexOfKey(account);
        iterationsUntilProcessed = -1;

        if (index >= 0) {
            if (uint256(index) > lastProcessedIndex) {
                iterationsUntilProcessed = index - int256(lastProcessedIndex);
            } else {
                uint256 processesUntilEndOfArray = tokenHoldersSize() > lastProcessedIndex ? tokenHoldersSize() - lastProcessedIndex : 0;
                iterationsUntilProcessed = index + int256(processesUntilEndOfArray);
            }
        }

        withdrawableDividends = withdrawableDividendOf(account);
        totalDividends = accumulativeDividendOf(account);
        lastClaimTime = lastClaimTimes[account];
        nextClaimTime = lastClaimTime > 0 ? lastClaimTime + claimWait : 0;
        secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime - block.timestamp : 0;
    }

    function getAccountAtIndex(uint256 index) public view returns (address, int256, int256, uint256, uint256, uint256, uint256, uint256) {
    	if (index >= tokenHoldersSize()) {
            return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);
        }
        address account = tokenHoldersGetKeyAtIndex(index);
        return getAccount(account);
    }

    // --------------------- PUBLIC ------------------------

	function process(uint256 gas) public returns (uint256, uint256, uint256) {
    	uint256 numberOfTokenHolders = tokenHoldersSize();

    	if (numberOfTokenHolders == 0) {
    		return (0, 0, lastProcessedIndex);
    	}

    	uint256 _lastProcessedIndex = lastProcessedIndex;
    	uint256 gasUsed = 0;
    	uint256 gasLeft = gasleft();
    	uint256 iterations = 0;
    	uint256 claims = 0;

    	while (gasUsed < gas && iterations < numberOfTokenHolders) {
    		_lastProcessedIndex++;
			if (_lastProcessedIndex >= tokenHoldersSize()) {
    			_lastProcessedIndex = 0;
    		}

    		address account = tokenHoldersMap.keys[_lastProcessedIndex];
			
			// check on every distribution is user still eligible
            bool canClaim = block.timestamp - lastClaimTimes[account] >= claimWait;							
			if (canClaim && _processAccount(payable(account))) claims++;					
									
			iterations++;

    		uint256 newGasLeft = gasleft();
    		if (gasLeft > newGasLeft) {
				uint256 iterationGas = gasLeft - newGasLeft;
    			gasUsed += iterationGas;				
    		}
			
    		gasLeft = newGasLeft;			
    	}

    	lastProcessedIndex = _lastProcessedIndex;
    	return (iterations, claims, lastProcessedIndex);
    }

    // --------------------- INTERNAL ------------------------

	function _processAccount(address payable account) internal returns (bool) {
		uint256 amount = _withdrawDividendOfUser(account);    	
		if (amount != 0) {
    		lastClaimTimes[account] = block.timestamp;
            return true;			
    	}
    	return false;
    }

    function _checkAlreadySet(bool result) internal pure {
        require(!result, "Already set");
    }
	
	// --------------------- HOLDERS MAP ------------------------
	
    function tokenHoldersGetIndexOfKey(address key) public view returns (int) {
        if (!tokenHoldersMap.inserted[key]) {
            return -1;
        }
        return int(tokenHoldersMap.indexOf[key]);
    }

    function tokenHoldersGetKeyAtIndex(uint index) public view returns (address) {
        return tokenHoldersMap.keys[index];
    }

    function tokenHoldersSize() public view returns (uint) {
        return tokenHoldersMap.keys.length;
    }

    function _tokenHoldersAdd(address key) internal {
		Map storage map = tokenHoldersMap;
        if (!map.inserted[key]) {
            map.inserted[key] = true;            
            map.indexOf[key] = map.keys.length;
            map.keys.push(key);
        } 
    }

    function _tokenHoldersRemove(address key) internal {
		Map storage map = tokenHoldersMap;
        if (!map.inserted[key]) {
            return;
        }

        delete map.inserted[key];

        uint index = map.indexOf[key];
        uint lastIndex = map.keys.length - 1;
        address lastKey = map.keys[lastIndex];

        map.indexOf[lastKey] = index;
        delete map.indexOf[key];

        map.keys[index] = lastKey;
        map.keys.pop();
    }
}

File 2 of 9 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 3 of 9 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 4 of 9 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 5 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 6 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 7 of 9 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 8 of 9 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 9 : DividendToken.sol
// SPDX-License-Identifier: none
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// ------------------------------------- Context -------------------------------------------
contract DividendToken is ERC20 {
	event DividendsDistributed(
	   address indexed from,
	   uint256 weiAmount,
	   uint256 magnifiedDividendPerShare
	);

	/// @dev This event MUST emit when an address withdraws their dividend.
	/// @param to The address which withdraws ether from this contract.
	/// @param weiAmount The amount of withdrawn ether in wei.
	event DividendWithdrawn(
	   address indexed to,
	   uint256 weiAmount
	);

	event DividendReturn(
	   address indexed to,
	   uint256 weiAmount
	);

	// With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.
	// For more discussion about choosing the value of `magnitude`,
	//  see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728
	uint256 constant internal magnitude = 2**128;

	uint256 public magnifiedDividendPerShare;

	// About dividendCorrection:
	// If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:
	//   `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.
	// When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),
	//   `dividendOf(_user)` should not be changed,
	//   but the computed value of `dividendPerShare * balanceOf(_user)` is changed.
	// To keep the `dividendOf(_user)` unchanged, we add a correction term:
	//   `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,
	//   where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:
	//   `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.
	// So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.
	mapping(address => int256) public magnifiedDividendCorrections;
	mapping(address => uint256) public withdrawnDividends;
	mapping(address => bool) public excludedAccounts;

	uint256 public totalDividendsDistributed;

	constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {
	}

	/// @dev Distributes dividends whenever ether is paid to this contract.
	receive() external payable {
		distributeDividends();
	}

	/// @notice Distributes ether to token holders as dividends.
	/// @dev It reverts if the total supply of tokens is 0.
	/// It emits the `DividendsDistributed` event if the amount of received ether is greater than 0.
	/// About undistributed ether:
	///   In each distribution, there is a small amount of ether not distributed,
	///     the magnified amount of which is
	///     `(msg.value * magnitude) % totalSupply()`.
	///   With a well-chosen `magnitude`, the amount of undistributed ether
	///     (de-magnified) in a distribution can be less than 1 wei.
	///   We can actually keep track of the undistributed ether in a distribution
	///     and try to distribute it in the next distribution,
	///     but keeping track of such data on-chain costs much more than
	///     the saved ether, so we don't do that.
	function distributeDividends() public payable {
		require(totalSupply() != 0);

		if (msg.value != 0) {
			magnifiedDividendPerShare += msg.value * magnitude / totalSupply();
			emit DividendsDistributed(msg.sender, msg.value, magnifiedDividendPerShare);
			totalDividendsDistributed += msg.value;
		}
	}

	function returnDividends(uint256 amount) internal {
		if (amount != 0) {
			magnifiedDividendPerShare += amount * magnitude / totalSupply();
		}
	}

	function isExcluded(address account) public view returns (bool) {
		return excludedAccounts[account];
	}
	function _exclude(address account) internal {
		if (!excludedAccounts[account]) excludedAccounts[account] = true;
	}
	function _include(address account) internal {
        if (excludedAccounts[account]) excludedAccounts[account] = false;
	}

	/// @notice Withdraws the ether distributed to the sender.
	/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
	function withdrawDividend() public { //
		//require(false);
		_withdrawDividendOfUser(payable(msg.sender));
	}

	/// @notice Withdraws the ether distributed to the sender.
	/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
	function _withdrawDividendOfUser(address payable account) internal returns (uint256) {
		uint256 _withdrawableDividend = withdrawableDividendOf(account);
		if (_withdrawableDividend != 0) {
			withdrawnDividends[account] += _withdrawableDividend;
			
			if (!isExcluded(account)) {
				emit DividendWithdrawn(account, _withdrawableDividend);
				(bool success,) = account.call{ value: _withdrawableDividend, gas: 3000 }("");

				if (!success) {
					withdrawnDividends[account] -= _withdrawableDividend;
					return 0;
				}
				return _withdrawableDividend;
			} else {				
				returnDividends(_withdrawableDividend);
				emit DividendReturn(account, _withdrawableDividend);
			}
		}
		return 0;
	}


	/// @notice View the amount of dividend in wei that an address can withdraw.
	/// @param account The address of a token holder.
	/// @return The amount of dividend in wei that `account` can withdraw.
	function dividendOf(address account) public view returns(uint256) {
		return withdrawableDividendOf(account);
	}

	/// @notice View the amount of dividend in wei that an address can withdraw.
	/// @param account The address of a token holder.
	/// @return The amount of dividend in wei that `account` can withdraw.
	function withdrawableDividendOf(address account) public view returns(uint256) {
		return accumulativeDividendOf(account) - withdrawnDividends[account];
	}

	/// @notice View the amount of dividend in wei that an address has withdrawn.
	/// @param account The address of a token holder.
	/// @return The amount of dividend in wei that `account` has withdrawn.
	function withdrawnDividendOf(address account) public view returns(uint256) {
		return withdrawnDividends[account];
	}


	/// @notice View the amount of dividend in wei that an address has earned in total.
	/// @dev accumulativeDividendOf(account) = withdrawableDividendOf(account) + withdrawnDividendOf(account)
	/// = (magnifiedDividendPerShare * balanceOf(account) + magnifiedDividendCorrections[account]) / magnitude
	/// @param account The address of a token holder.
	/// @return The amount of dividend in wei that `account` has earned in total.
	function accumulativeDividendOf(address account) public view returns(uint256) {
		return uint256(int256(magnifiedDividendPerShare * balanceOf(account)) + magnifiedDividendCorrections[account]) / magnitude;
	}

	/// @dev Internal function that transfer tokens from one address to another.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param from The address to transfer from.
	/// @param to The address to transfer to.
	/// @param value The amount to be transferred.
	function _transfer(address from, address to, uint256 value) internal virtual override {
		require(false);
		int256 _magCorrection = int256(magnifiedDividendPerShare * value);
		magnifiedDividendCorrections[from] += _magCorrection;
		magnifiedDividendCorrections[to] -= _magCorrection;
	}

	/// @dev Internal function that mints tokens to an account.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param account The account that will receive the created tokens.
	/// @param value The amount that will be created.
	function _mint(address account, uint256 value) internal override {
		super._mint(account, value);
		magnifiedDividendCorrections[account] -= int256(magnifiedDividendPerShare * value);
	}

	/// @dev Internal function that burns an amount of the token of a given account.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param account The account whose tokens will be burnt.
	/// @param value The amount that will be burnt.
	function _burn(address account, uint256 value) internal override {
		super._burn(account, value);
		magnifiedDividendCorrections[account] += int256(magnifiedDividendPerShare * value);
	}

	function _setBalance(address account, uint256 newBalance) internal {
		uint256 currentBalance = balanceOf(account);

		if (newBalance > currentBalance) {
			uint256 mintAmount = newBalance - currentBalance;
			_mint(account, mintAmount);
		} else if (newBalance < currentBalance) {
			uint256 burnAmount = currentBalance - newBalance;
			_burn(account, burnAmount);
		}
	}
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 5
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"dtName_","type":"string"},{"internalType":"string","name":"dtSymbol_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendReturn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"magnifiedDividendPerShare","type":"uint256"}],"name":"DividendsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"accumulativeDividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimWait","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeDividends","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"dividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"excludedAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"excludedFromDividends","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account_","type":"address"}],"name":"getAccount","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"int256","name":"index","type":"int256"},{"internalType":"int256","name":"iterationsUntilProcessed","type":"int256"},{"internalType":"uint256","name":"withdrawableDividends","type":"uint256"},{"internalType":"uint256","name":"totalDividends","type":"uint256"},{"internalType":"uint256","name":"lastClaimTime","type":"uint256"},{"internalType":"uint256","name":"nextClaimTime","type":"uint256"},{"internalType":"uint256","name":"secondsUntilAutoClaimAvailable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getAccountAtIndex","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isExcluded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastClaimTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastProcessedIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"magnifiedDividendCorrections","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"magnifiedDividendPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gas","type":"uint256"}],"name":"process","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setDividendClaimWait","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setExcludedFromDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"key","type":"address"}],"name":"tokenHoldersGetIndexOfKey","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenHoldersGetKeyAtIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenHoldersSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDividendsDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawDividend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"withdrawableDividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"withdrawnDividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawnDividends","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162001dd438038062001dd483398101604081905262000034916200012c565b81818181600362000046838262000225565b50600462000055828262000225565b50503360805250620002f19350505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200008f57600080fd5b81516001600160401b0380821115620000ac57620000ac62000067565b604051601f8301601f19908116603f01168101908282118183101715620000d757620000d762000067565b81604052838152602092508683858801011115620000f457600080fd5b600091505b83821015620001185785820183015181830184015290820190620000f9565b600093810190920192909252949350505050565b600080604083850312156200014057600080fd5b82516001600160401b03808211156200015857600080fd5b62000166868387016200007d565b935060208501519150808211156200017d57600080fd5b506200018c858286016200007d565b9150509250929050565b600181811c90821680620001ab57607f821691505b602082108103620001cc57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200022057600081815260208120601f850160051c81016020861015620001fb5750805b601f850160051c820191505b818110156200021c5782815560010162000207565b5050505b505050565b81516001600160401b0381111562000241576200024162000067565b620002598162000252845462000196565b84620001d2565b602080601f831160018114620002915760008415620002785750858301515b600019600386901b1c1916600185901b1785556200021c565b600085815260208120601f198616915b82811015620002c257888601518255948401946001909101908401620002a1565b5085821015620002e15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051611ab2620003226000396000818161032b0152818161094c01528181610b370152610c290152611ab26000f3fe6080604052600436106101ae5760003560e01c806303c83302146101c257806306fdde03146101ca578063095ea7b3146101f557806318160ddd14610225578063226cfa3d1461024457806323b872dd1461027157806327ce0147146102915780633009a609146102b1578063313ce567146102c757806339509351146102e35780633a7960e0146103035780633fc15f15146103195780634e7b827f146103655780635183d6fd146103955780635999095e146103fa5780636a4740021461041a5780636f2789ec1461042f57806370a082311461044557806371f75a15146104655780638234c9d21461047a57806385a6b3ae1461049a57806391b89fba146104b057806395d89b41146104d057806397a06724146104e55780639b06d06414610512578063a457c2d714610542578063a8b9d24014610562578063a9059cbb14610582578063aafd847a146105a2578063cba0e996146105d8578063cd3aec9f146105f8578063d429293b14610618578063dd62ed3e14610638578063de3aaf6114610658578063e30443bc14610685578063fbcbc0f1146106a5578063ffb2c479146106c557600080fd5b366101bd576101bb610700565b005b600080fd5b6101bb610700565b3480156101d657600080fd5b506101df6107a4565b6040516101ec9190611782565b60405180910390f35b34801561020157600080fd5b506102156102103660046117e5565b610836565b60405190151581526020016101ec565b34801561023157600080fd5b506002545b6040519081526020016101ec565b34801561025057600080fd5b5061023661025f366004611811565b60106020526000908152604090205481565b34801561027d57600080fd5b5061021561028c366004611835565b610850565b34801561029d57600080fd5b506102366102ac366004611811565b610871565b3480156102bd57600080fd5b50610236600d5481565b3480156102d357600080fd5b50604051601281526020016101ec565b3480156102ef57600080fd5b506102156102fe3660046117e5565b6108ba565b34801561030f57600080fd5b5061023660055481565b34801561032557600080fd5b5061034d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101ec565b34801561037157600080fd5b50610215610380366004611811565b600f6020526000908152604090205460ff1681565b3480156103a157600080fd5b506103b56103b0366004611876565b6108dc565b604080516001600160a01b0390991689526020890197909752958701949094526060860192909252608085015260a084015260c083015260e0820152610100016101ec565b34801561040657600080fd5b506101bb610415366004611876565b610949565b34801561042657600080fd5b506101bb6109ac565b34801561043b57600080fd5b50610236600e5481565b34801561045157600080fd5b50610236610460366004611811565b6109b8565b34801561047157600080fd5b50600a54610236565b34801561048657600080fd5b50610236610495366004611811565b6109d3565b3480156104a657600080fd5b5061023660095481565b3480156104bc57600080fd5b506102366104cb366004611811565b610a18565b3480156104dc57600080fd5b506101df610a23565b3480156104f157600080fd5b50610236610500366004611811565b60066020526000908152604090205481565b34801561051e57600080fd5b5061021561052d366004611811565b60086020526000908152604090205460ff1681565b34801561054e57600080fd5b5061021561055d3660046117e5565b610a32565b34801561056e57600080fd5b5061023661057d366004611811565b610aad565b34801561058e57600080fd5b5061021561059d3660046117e5565b610ad9565b3480156105ae57600080fd5b506102366105bd366004611811565b6001600160a01b031660009081526007602052604090205490565b3480156105e457600080fd5b506102156105f3366004611811565b610ae3565b34801561060457600080fd5b5061034d610613366004611876565b610b01565b34801561062457600080fd5b506101bb61063336600461188f565b610b34565b34801561064457600080fd5b506102366106533660046118cd565b610bfb565b34801561066457600080fd5b50610236610673366004611811565b60076020526000908152604090205481565b34801561069157600080fd5b506101bb6106a03660046117e5565b610c26565b3480156106b157600080fd5b506103b56106c0366004611811565b610cb4565b3480156106d157600080fd5b506106e56106e0366004611876565b610d9f565b604080519384526020840192909252908201526060016101ec565b60025460000361070f57600080fd5b34156107a257600254610726600160801b34611911565b6107309190611928565b60056000828254610741919061194a565b909155505060055460405133917fd2f6b4ff9fc44f9f09c0bf947cfb196c17c66213ea2a7d59a42bab3428ccd94e9161078291348252602082015260400190565b60405180910390a2346009600082825461079c919061194a565b90915550505b565b6060600380546107b39061195d565b80601f01602080910402602001604051908101604052809291908181526020018280546107df9061195d565b801561082c5780601f106108015761010080835404028352916020019161082c565b820191906000526020600020905b81548152906001019060200180831161080f57829003601f168201915b5050505050905090565b600033610844818585610ed9565b60019150505b92915050565b60003361085e858285610ffd565b610866600080fd5b506001949350505050565b6001600160a01b038116600090815260066020526040812054600160801b90610899846109b8565b6005546108a69190611911565b6108b09190611997565b61084a9190611928565b6000336108448185856108cd8383610bfb565b6108d7919061194a565b610ed9565b6000806000806000806000806108f1600a5490565b891061091657506000965060001995508594508693508392508291508190508061093e565b60006109218a610b01565b905061092c81610cb4565b98509850985098509850985098509850505b919395975091939597565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461099a5760405162461bcd60e51b8152600401610991906119bf565b60405180910390fd5b6109a781600e5414611077565b600e55565b6109b5336110b3565b50565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0381166000908152600c602052604081205460ff166109fc5750600019919050565b506001600160a01b03166000908152600b602052604090205490565b600061084a82610aad565b6060600480546107b39061195d565b60003381610a408286610bfb565b905083811015610aa05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610991565b6108668286868403610ed9565b6001600160a01b038116600090815260076020526040812054610acf83610871565b61084a91906119e4565b6000336108448280fd5b6001600160a01b031660009081526008602052604090205460ff1690565b6000600a6000018281548110610b1957610b196119f7565b6000918252602090912001546001600160a01b031692915050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610b7c5760405162461bcd60e51b8152600401610991906119bf565b6001600160a01b0382166000908152600f6020526040902054610ba79060ff16151582151514611077565b6001600160a01b0382166000908152600f60205260409020805460ff191682151517905580610bf757610bd982611239565b50610be38261126e565b610bee8260006112b4565b610bf782611306565b5050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610c6e5760405162461bcd60e51b8152600401610991906119bf565b6001600160a01b0382166000908152600f602052604090205460ff16610bf757610c9782611436565b610ca182826112b4565b610caa82611239565b50610bf7826114b0565b806000808080808080610cc6886109d3565b9650600019955060008712610d2d57600d54871115610cf357600d54610cec9088611a0d565b9550610d2d565b6000600d54610d01600a5490565b11610d0d576000610d1d565b600d54600a54610d1d91906119e4565b9050610d298189611997565b9650505b610d3688610aad565b9450610d4188610871565b6001600160a01b038916600090815260106020526040902054909450925082610d6b576000610d78565b600e54610d78908461194a565b9150428211610d88576000610d92565b610d9242836119e4565b9050919395975091939597565b600080600080610dae600a5490565b905080600003610dc9575050600d5460009250829150610ed2565b600d546000805a90506000805b8984108015610de457508582105b15610ec15784610df381611a2d565b955050610dff600a5490565b8510610e0a57600094505b6000600a6000018681548110610e2257610e226119f7565b6000918252602080832090910154600e546001600160a01b039091168084526010909252604083205491935090610e5990426119e4565b10159050808015610e6e5750610e6e82611239565b15610e815782610e7d81611a2d565b9350505b83610e8b81611a2d565b94505060005a905080861115610eb7576000610ea782886119e4565b9050610eb3818961194a565b9750505b9450610dd6915050565b600d85905590975095509193505050505b9193909250565b6001600160a01b038316610f3b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610991565b6001600160a01b038216610f9c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610991565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006110098484610bfb565b9050600019811461107157818110156110645760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610991565b6110718484848403610ed9565b50505050565b80156109b55760405162461bcd60e51b815260206004820152600b60248201526a105b1c9958591e481cd95d60aa1b6044820152606401610991565b6000806110bf83610aad565b90508015611230576001600160a01b038316600090815260076020526040812080548392906110ef90849061194a565b909155506110fe905083610ae3565b6111e357826001600160a01b03167fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d8260405161113d91815260200190565b60405180910390a26000836001600160a01b031682610bb890604051600060405180830381858888f193505050503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b50509050806111dc576001600160a01b038416600090815260076020526040812080548492906111cd9084906119e4565b90915550600095945050505050565b5092915050565b6111ec816114f2565b826001600160a01b03167f3f7ae20ba919d7706fbd6dc76195345b62aba2e088a54878c89fa6fc809893fa8260405161122791815260200190565b60405180910390a25b50600092915050565b600080611245836110b3565b905080156112305750506001600160a01b03166000908152601060205260409020429055600190565b6001600160a01b03811660009081526008602052604090205460ff166109b5576001600160a01b0381166000908152600860205260409020805460ff1916600117905550565b60006112bf836109b8565b9050808211156112e15760006112d582846119e4565b9050611071848261152c565b808210156113015760006112f583836119e4565b90506110718482611575565b505050565b6001600160a01b0381166000908152600c6020526040902054600a9060ff1661132d575050565b6001600160a01b03821660009081526002820160209081526040808320805460ff191690556001808501909252822054835490929161136b916119e4565b90506000836000018281548110611384576113846119f7565b60009182526020808320909101546001600160a01b039081168084526001880190925260408084208790559088168352822091909155845490915081908590859081106113d3576113d36119f7565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055835484908061140d5761140d611a46565b600082815260209020810160001990810180546001600160a01b03191690550190555050505050565b6001600160a01b0381166000908152600c6020526040902054600a9060ff16610bf7576001600160a01b03821660008181526002830160209081526040808320805460ff19166001908117909155855486820184529184208290558101855584835291200180546001600160a01b03191690911790555050565b6001600160a01b03811660009081526008602052604090205460ff16156109b5576001600160a01b03166000908152600860205260409020805460ff19169055565b80156109b557600254611509600160801b83611911565b6115139190611928565b60056000828254611524919061194a565b909155505050565b61153682826115b5565b806005546115449190611911565b6001600160a01b0383166000908152600660205260408120805490919061156c908490611a0d565b90915550505050565b61157f8282611662565b8060055461158d9190611911565b6001600160a01b0383166000908152600660205260408120805490919061156c908490611997565b6001600160a01b03821661160b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610991565b806002600082825461161d919061194a565b90915550506001600160a01b03821660008181526020818152604080832080548601905551848152600080516020611a5d833981519152910160405180910390a35050565b6001600160a01b0382166116c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610991565b6001600160a01b038216600090815260208190526040902054818110156117365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610991565b6001600160a01b038316600081815260208181526040808320868603905560028054879003905551858152919291600080516020611a5d833981519152910160405180910390a3505050565b600060208083528351808285015260005b818110156117af57858101830151858201604001528201611793565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b03811681146109b557600080fd5b600080604083850312156117f857600080fd5b8235611803816117d0565b946020939093013593505050565b60006020828403121561182357600080fd5b813561182e816117d0565b9392505050565b60008060006060848603121561184a57600080fd5b8335611855816117d0565b92506020840135611865816117d0565b929592945050506040919091013590565b60006020828403121561188857600080fd5b5035919050565b600080604083850312156118a257600080fd5b82356118ad816117d0565b9150602083013580151581146118c257600080fd5b809150509250929050565b600080604083850312156118e057600080fd5b82356118eb816117d0565b915060208301356118c2816117d0565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761084a5761084a6118fb565b60008261194557634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561084a5761084a6118fb565b600181811c9082168061197157607f821691505b60208210810361199157634e487b7160e01b600052602260045260246000fd5b50919050565b80820182811260008312801582168215821617156119b7576119b76118fb565b505092915050565b6020808252600b908201526a139bdd08185b1b1bddd95960aa1b604082015260600190565b8181038181111561084a5761084a6118fb565b634e487b7160e01b600052603260045260246000fd5b81810360008312801583831316838312821617156111dc576111dc6118fb565b600060018201611a3f57611a3f6118fb565b5060010190565b634e487b7160e01b600052603160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205864e1664115b6f8fdbe880af7406d76f147e1be39617e6322b0f4c5726d8e6064736f6c63430008130033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000011536869656c64536b794469766964656e6400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035354440000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101ae5760003560e01c806303c83302146101c257806306fdde03146101ca578063095ea7b3146101f557806318160ddd14610225578063226cfa3d1461024457806323b872dd1461027157806327ce0147146102915780633009a609146102b1578063313ce567146102c757806339509351146102e35780633a7960e0146103035780633fc15f15146103195780634e7b827f146103655780635183d6fd146103955780635999095e146103fa5780636a4740021461041a5780636f2789ec1461042f57806370a082311461044557806371f75a15146104655780638234c9d21461047a57806385a6b3ae1461049a57806391b89fba146104b057806395d89b41146104d057806397a06724146104e55780639b06d06414610512578063a457c2d714610542578063a8b9d24014610562578063a9059cbb14610582578063aafd847a146105a2578063cba0e996146105d8578063cd3aec9f146105f8578063d429293b14610618578063dd62ed3e14610638578063de3aaf6114610658578063e30443bc14610685578063fbcbc0f1146106a5578063ffb2c479146106c557600080fd5b366101bd576101bb610700565b005b600080fd5b6101bb610700565b3480156101d657600080fd5b506101df6107a4565b6040516101ec9190611782565b60405180910390f35b34801561020157600080fd5b506102156102103660046117e5565b610836565b60405190151581526020016101ec565b34801561023157600080fd5b506002545b6040519081526020016101ec565b34801561025057600080fd5b5061023661025f366004611811565b60106020526000908152604090205481565b34801561027d57600080fd5b5061021561028c366004611835565b610850565b34801561029d57600080fd5b506102366102ac366004611811565b610871565b3480156102bd57600080fd5b50610236600d5481565b3480156102d357600080fd5b50604051601281526020016101ec565b3480156102ef57600080fd5b506102156102fe3660046117e5565b6108ba565b34801561030f57600080fd5b5061023660055481565b34801561032557600080fd5b5061034d7f0000000000000000000000000355dee512df170f4d63daf40eff93d7aa9701b681565b6040516001600160a01b0390911681526020016101ec565b34801561037157600080fd5b50610215610380366004611811565b600f6020526000908152604090205460ff1681565b3480156103a157600080fd5b506103b56103b0366004611876565b6108dc565b604080516001600160a01b0390991689526020890197909752958701949094526060860192909252608085015260a084015260c083015260e0820152610100016101ec565b34801561040657600080fd5b506101bb610415366004611876565b610949565b34801561042657600080fd5b506101bb6109ac565b34801561043b57600080fd5b50610236600e5481565b34801561045157600080fd5b50610236610460366004611811565b6109b8565b34801561047157600080fd5b50600a54610236565b34801561048657600080fd5b50610236610495366004611811565b6109d3565b3480156104a657600080fd5b5061023660095481565b3480156104bc57600080fd5b506102366104cb366004611811565b610a18565b3480156104dc57600080fd5b506101df610a23565b3480156104f157600080fd5b50610236610500366004611811565b60066020526000908152604090205481565b34801561051e57600080fd5b5061021561052d366004611811565b60086020526000908152604090205460ff1681565b34801561054e57600080fd5b5061021561055d3660046117e5565b610a32565b34801561056e57600080fd5b5061023661057d366004611811565b610aad565b34801561058e57600080fd5b5061021561059d3660046117e5565b610ad9565b3480156105ae57600080fd5b506102366105bd366004611811565b6001600160a01b031660009081526007602052604090205490565b3480156105e457600080fd5b506102156105f3366004611811565b610ae3565b34801561060457600080fd5b5061034d610613366004611876565b610b01565b34801561062457600080fd5b506101bb61063336600461188f565b610b34565b34801561064457600080fd5b506102366106533660046118cd565b610bfb565b34801561066457600080fd5b50610236610673366004611811565b60076020526000908152604090205481565b34801561069157600080fd5b506101bb6106a03660046117e5565b610c26565b3480156106b157600080fd5b506103b56106c0366004611811565b610cb4565b3480156106d157600080fd5b506106e56106e0366004611876565b610d9f565b604080519384526020840192909252908201526060016101ec565b60025460000361070f57600080fd5b34156107a257600254610726600160801b34611911565b6107309190611928565b60056000828254610741919061194a565b909155505060055460405133917fd2f6b4ff9fc44f9f09c0bf947cfb196c17c66213ea2a7d59a42bab3428ccd94e9161078291348252602082015260400190565b60405180910390a2346009600082825461079c919061194a565b90915550505b565b6060600380546107b39061195d565b80601f01602080910402602001604051908101604052809291908181526020018280546107df9061195d565b801561082c5780601f106108015761010080835404028352916020019161082c565b820191906000526020600020905b81548152906001019060200180831161080f57829003601f168201915b5050505050905090565b600033610844818585610ed9565b60019150505b92915050565b60003361085e858285610ffd565b610866600080fd5b506001949350505050565b6001600160a01b038116600090815260066020526040812054600160801b90610899846109b8565b6005546108a69190611911565b6108b09190611997565b61084a9190611928565b6000336108448185856108cd8383610bfb565b6108d7919061194a565b610ed9565b6000806000806000806000806108f1600a5490565b891061091657506000965060001995508594508693508392508291508190508061093e565b60006109218a610b01565b905061092c81610cb4565b98509850985098509850985098509850505b919395975091939597565b337f0000000000000000000000000355dee512df170f4d63daf40eff93d7aa9701b66001600160a01b03161461099a5760405162461bcd60e51b8152600401610991906119bf565b60405180910390fd5b6109a781600e5414611077565b600e55565b6109b5336110b3565b50565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0381166000908152600c602052604081205460ff166109fc5750600019919050565b506001600160a01b03166000908152600b602052604090205490565b600061084a82610aad565b6060600480546107b39061195d565b60003381610a408286610bfb565b905083811015610aa05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610991565b6108668286868403610ed9565b6001600160a01b038116600090815260076020526040812054610acf83610871565b61084a91906119e4565b6000336108448280fd5b6001600160a01b031660009081526008602052604090205460ff1690565b6000600a6000018281548110610b1957610b196119f7565b6000918252602090912001546001600160a01b031692915050565b337f0000000000000000000000000355dee512df170f4d63daf40eff93d7aa9701b66001600160a01b031614610b7c5760405162461bcd60e51b8152600401610991906119bf565b6001600160a01b0382166000908152600f6020526040902054610ba79060ff16151582151514611077565b6001600160a01b0382166000908152600f60205260409020805460ff191682151517905580610bf757610bd982611239565b50610be38261126e565b610bee8260006112b4565b610bf782611306565b5050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b337f0000000000000000000000000355dee512df170f4d63daf40eff93d7aa9701b66001600160a01b031614610c6e5760405162461bcd60e51b8152600401610991906119bf565b6001600160a01b0382166000908152600f602052604090205460ff16610bf757610c9782611436565b610ca182826112b4565b610caa82611239565b50610bf7826114b0565b806000808080808080610cc6886109d3565b9650600019955060008712610d2d57600d54871115610cf357600d54610cec9088611a0d565b9550610d2d565b6000600d54610d01600a5490565b11610d0d576000610d1d565b600d54600a54610d1d91906119e4565b9050610d298189611997565b9650505b610d3688610aad565b9450610d4188610871565b6001600160a01b038916600090815260106020526040902054909450925082610d6b576000610d78565b600e54610d78908461194a565b9150428211610d88576000610d92565b610d9242836119e4565b9050919395975091939597565b600080600080610dae600a5490565b905080600003610dc9575050600d5460009250829150610ed2565b600d546000805a90506000805b8984108015610de457508582105b15610ec15784610df381611a2d565b955050610dff600a5490565b8510610e0a57600094505b6000600a6000018681548110610e2257610e226119f7565b6000918252602080832090910154600e546001600160a01b039091168084526010909252604083205491935090610e5990426119e4565b10159050808015610e6e5750610e6e82611239565b15610e815782610e7d81611a2d565b9350505b83610e8b81611a2d565b94505060005a905080861115610eb7576000610ea782886119e4565b9050610eb3818961194a565b9750505b9450610dd6915050565b600d85905590975095509193505050505b9193909250565b6001600160a01b038316610f3b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610991565b6001600160a01b038216610f9c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610991565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006110098484610bfb565b9050600019811461107157818110156110645760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610991565b6110718484848403610ed9565b50505050565b80156109b55760405162461bcd60e51b815260206004820152600b60248201526a105b1c9958591e481cd95d60aa1b6044820152606401610991565b6000806110bf83610aad565b90508015611230576001600160a01b038316600090815260076020526040812080548392906110ef90849061194a565b909155506110fe905083610ae3565b6111e357826001600160a01b03167fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d8260405161113d91815260200190565b60405180910390a26000836001600160a01b031682610bb890604051600060405180830381858888f193505050503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b50509050806111dc576001600160a01b038416600090815260076020526040812080548492906111cd9084906119e4565b90915550600095945050505050565b5092915050565b6111ec816114f2565b826001600160a01b03167f3f7ae20ba919d7706fbd6dc76195345b62aba2e088a54878c89fa6fc809893fa8260405161122791815260200190565b60405180910390a25b50600092915050565b600080611245836110b3565b905080156112305750506001600160a01b03166000908152601060205260409020429055600190565b6001600160a01b03811660009081526008602052604090205460ff166109b5576001600160a01b0381166000908152600860205260409020805460ff1916600117905550565b60006112bf836109b8565b9050808211156112e15760006112d582846119e4565b9050611071848261152c565b808210156113015760006112f583836119e4565b90506110718482611575565b505050565b6001600160a01b0381166000908152600c6020526040902054600a9060ff1661132d575050565b6001600160a01b03821660009081526002820160209081526040808320805460ff191690556001808501909252822054835490929161136b916119e4565b90506000836000018281548110611384576113846119f7565b60009182526020808320909101546001600160a01b039081168084526001880190925260408084208790559088168352822091909155845490915081908590859081106113d3576113d36119f7565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055835484908061140d5761140d611a46565b600082815260209020810160001990810180546001600160a01b03191690550190555050505050565b6001600160a01b0381166000908152600c6020526040902054600a9060ff16610bf7576001600160a01b03821660008181526002830160209081526040808320805460ff19166001908117909155855486820184529184208290558101855584835291200180546001600160a01b03191690911790555050565b6001600160a01b03811660009081526008602052604090205460ff16156109b5576001600160a01b03166000908152600860205260409020805460ff19169055565b80156109b557600254611509600160801b83611911565b6115139190611928565b60056000828254611524919061194a565b909155505050565b61153682826115b5565b806005546115449190611911565b6001600160a01b0383166000908152600660205260408120805490919061156c908490611a0d565b90915550505050565b61157f8282611662565b8060055461158d9190611911565b6001600160a01b0383166000908152600660205260408120805490919061156c908490611997565b6001600160a01b03821661160b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610991565b806002600082825461161d919061194a565b90915550506001600160a01b03821660008181526020818152604080832080548601905551848152600080516020611a5d833981519152910160405180910390a35050565b6001600160a01b0382166116c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610991565b6001600160a01b038216600090815260208190526040902054818110156117365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610991565b6001600160a01b038316600081815260208181526040808320868603905560028054879003905551858152919291600080516020611a5d833981519152910160405180910390a3505050565b600060208083528351808285015260005b818110156117af57858101830151858201604001528201611793565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b03811681146109b557600080fd5b600080604083850312156117f857600080fd5b8235611803816117d0565b946020939093013593505050565b60006020828403121561182357600080fd5b813561182e816117d0565b9392505050565b60008060006060848603121561184a57600080fd5b8335611855816117d0565b92506020840135611865816117d0565b929592945050506040919091013590565b60006020828403121561188857600080fd5b5035919050565b600080604083850312156118a257600080fd5b82356118ad816117d0565b9150602083013580151581146118c257600080fd5b809150509250929050565b600080604083850312156118e057600080fd5b82356118eb816117d0565b915060208301356118c2816117d0565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761084a5761084a6118fb565b60008261194557634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561084a5761084a6118fb565b600181811c9082168061197157607f821691505b60208210810361199157634e487b7160e01b600052602260045260246000fd5b50919050565b80820182811260008312801582168215821617156119b7576119b76118fb565b505092915050565b6020808252600b908201526a139bdd08185b1b1bddd95960aa1b604082015260600190565b8181038181111561084a5761084a6118fb565b634e487b7160e01b600052603260045260246000fd5b81810360008312801583831316838312821617156111dc576111dc6118fb565b600060018201611a3f57611a3f6118fb565b5060010190565b634e487b7160e01b600052603160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205864e1664115b6f8fdbe880af7406d76f147e1be39617e6322b0f4c5726d8e6064736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000011536869656c64536b794469766964656e6400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035354440000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : dtName_ (string): ShieldSkyDividend
Arg [1] : dtSymbol_ (string): STD

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [3] : 536869656c64536b794469766964656e64000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [5] : 5354440000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.