Skip to content
Verified contractExactMIT

XtrackSubscription

Address0x08b856e9e1d7c6c011cc116a8a28e3b3c2c5356d
Balance

0 ETH

 

Transactions

6

 

Compiler

solc 0.8.4

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.4+commit.c7e474f2
Language
solidity
Optimization
Yes, 500 runs
EVM version
istanbul
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
19,078,395
Creation transaction
0x9eae50aba7…02de75801e

contracts/XtrackSubscription.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;

/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%@%%%%%%####*#*##=++***+*+*+=+====================--------------------------------------------------------=:=------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@%@%@#*@%%%#*#  **%%##%=#%%%%#%%#########***********+****++=+++++=+====================================-
@@@@@@@@+=+*%=#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@=%%%%%@#@@@%%%#%%=*%#######%###%@@@##+*********++*+*++++*=++++++++==+=====+=======================-
@@*#*%#@@@@@@%%+=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%++%@%%%@@%%%%%@#-%%%%##%####%#%--@*#*##+********++***+++++++++++++++=============================-
@*%@###%%%%%#%%#%+=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@+*@%%%%%%%%%#-%@%%%%%##%%#%#%@*%#######**********+****++****+++++++++++++======================-
@=@#%%@@@@@@@@%%%@%*#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@@#=%@###+=++#%@%%%%%%%%#%##############+***********+*++++++++++++++============================-
@=@@%%@@@@@@@@@@%@#@-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@%@%@@@@@@@@#=#%%@@@@@@%%%@%%%%%%#%%#%%%%%#####*###+*****+++==+*****+*++*=++++=+==+==+==================-
@%@#@@@@@   @@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@%@@@%%%%%%%%%%%%#%%%%%%#######%###########***######****++++++++*+++++**+++++++==+============-
-@@%@@@@@@@@@@@@%%@-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@%%@%%%%@%%%%%%%%@%%%%%%%###########%#####***********+*****++++++=++++==+===+================-
=@@@%#%%@@@@@@@%#%#@@@@@@@@@@@@@@@@--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@%%%%%%##%%%%%%%%%##%###%######**+*+****++*++++*+*+++++++++=*==+====================-
@#=@@%@%%%%%%*#%@@+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@%@%%@@@@@@@@%%%@%%%%%%%@%%%%%%%%%%%%#%#############*********+*++*++++++++*++**+++==============+++=-
@@@@=#%@%%@@@@%++-*@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@@@@@@*#%@@@@@@@@@@@@@@@@@%%@@%%%%%%@%%%%%%%%%%%%%%%#%########*+*****+***+++***++++++++++++++++=+++========+::=-
@@@@@@-##*+===@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@%%@@@@@@%@@@@@@%%%%#%%%%%%%%%#####*#%#########*****##*****++*****++++++++++++++==========**#+-
@@@@@@@@%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@+.@@%@@%%%%#%%%%%%%####%%%##########*#*****#***+*+*++++++++++++++=+++=============-
=@@@@@@@@@@@@@@@@@@@#-*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@@@@@@@@@@#%@%@%%##%%%%%%%%%@@@@@#%%#####*#+******++***+++**+++++++++++##%###+=+=========-
@#-+@@@@@@@@@@@+=-+%@@@==@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@%@@%%%%%%%%%%%%%= =@####%####*##+*******+****++***++##@@#+=====%**==+=======-
%@@@-@@@@@@--*@@@@@@@%@@@-=@@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%@%%%%@%%@#%%%%%%%@@@%%####%########***@@@#*****++****%=======*+*==%*++=+=====-
%@@@-@@@@@@=@@@@@@@@%@@@@@@=-*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@%@%@@@@%%@%%%%%%%@@@@@@%%%%%%%%%%%%%%###%##%#########*@:=#***+**++++#==++=======+==@%*++++===-
%@@=%@@@@@+=@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@%@@@@@@@%%%%@@@@@%%##%%@%%%%%%%%%%%%@%%##%%%%%%%#%#############%@@#***#***+*%#=+*++*##*+=++*==#+=++*++-
%@@-@@@@@@-@@@@@@@# *#@@@@@@-=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@%%%%%%#@@@@@@@@@%%%#%###%############*********#@=#*++=# =#+===#==#+++==++-
%@@-@@@@@@-@@@@@@%= =%@@@@@@-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@%@%@@@@@@%@     @%%%%%@@@@%%@@@      @@%#########%#%########+*******%==#++*+@  **+=++=**=++++++-
@@%-@@@@@*@@@@@@@@@@@@@@@@@%-@@@@@@@@@@@@@@%+%@@@@@@@@@%@   @@@   @@%@@@@@@@@@@@     @@%@@@%%@@%%@   @@@   @#%%%%###%%###############****%==++=++##%#+==+=+#*++++++=-
-=%@@@@@@@-#@@@@@@@@@@@@%@@=@@@@@@@@@@@@@@@@%@@@@@@@@@@@@  @@@@@  =@@@@@@@@@@@%@@  =@@@%%%%@%%%%#@  @@@@@  @@%%%%%%####%##%%%#######*#+**%@@==#+=+++===%==%**+**=+++-
@@@@@@@@@@@@-=@@@%@%@@@@@@--@@@@@@@@%@@@@@@@@@@@@@@@@@%%@%   @@   @=+@@@@@@@%@@%@  @@@@@@@%%%%@#@@@   @@   @%%%%#%%%%%##%####%##@@@@@@@@@%##@==+*#===++==@*+++++++*+-
@@@@@@@@@@@@@@=-@@@@*=--=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@        @@@@@@@%@@@@%@  @@@@@%@@@@%@@@        @@@%%%%%%%%%%%###%##@@@%-----=-=@%##@@=====++%%@%**++++++++-
@@@@@@@@@@@@@@@@*--=@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@@@@%%@@%@@@@@@@@   @@@@@@@%@@@@  %@@%@%@-+@@@    @@@@@@@@@%%@@@@%%%%%%####%@--=*##%#*#*=*@%*%@@@%%***%@@@@%*++++++-
@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@   @@@@@@@@%@  %@@%@@@@@@+   @@@@@@%%%%%@@@=@@@%%%%%%%#%@-=##*#%%##*#+#=+%**+#@@@@@+=====%#*++++-
@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@     @@@@@@@@@%%@@@    @@@%@@%@  @@@%@@@@@   @@@@@%%%%%@%%@     @@%%%%%%%%@=##+#+**==+#+*@=%*#+@=:=%@%%=-+@=@%*+*+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@     @%%@@@@@%@@@%@@@   @@@@@%@  @@@@@%@   @@@@@%@@@@@@%%@@     @@%%%%@%#@==#*#*=  ==-*+#%=%+#@@=@---------@==@%*+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@     @%@@%@@@@@@@@@@@@  @@@@@%@  @@@%@%@  @@@@@@@@@@@@%@@%@     @@%%%##%%@-@*#*==**+==#+#=@@+%@=@=-=@@@@@=--=#=%#*-
@@@#=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@%@@@=  @@%@@@@@@@@@@@@@#@  @@@@@%@  %@@@%%@  @@%@@@@@%%%%%%@%@@@  @@@%%%##%%@-+@###*++***+%==%##%==*-=@+  #=@=--@=#++-
@@@#=@@@@@@@@@@@@@@@@%@@@@@@*+@@@@@@@%@@@@@%@@@@@%@   @@@@%@@%@@@@@@@%%@  @@@@@%@  %@%@@%@  @@%@@@@@%@%%%%%%%@@  @@%%%%%%%@@@@-=%%*##%@@%%-@@##%=%--=@*#=#=@--%=%#**-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@@@@@@@@@@@@%@   @%%@@@@@@@@@%@@%#@  @@#%%@@  @@@###@  @@%@@@@@@@@%%%%%%@@  @%%%%%%%%%%%%@*=*%++----%@@###@-%#--=@@@@@=-=+=@*#+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@@@@@@@@@@@@@@@@@%@   @%@%@@@ +@@@@@@@@@  @@@@@@@  =@@@@@@  @@@%%@@* @@%%%%%%@@  @%%%%%%%%%%%%%@@--#@@@@@@%%%%%@@*=@=-------=@=%#**+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@%%@@%@   @%@%%@   @@@@@@@@@                     @@@@@@   @%%%%%%@@  @%%%%%%%%%%%%%%@@@@%%%%%#######%@@-=%=*%@@===@%*+*+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%@@@@%@   @%%%@@@  @@                                    =@@@@%%%@@  @@%%%%%%%%%%%%@%@@@%%%%%%%#%%###%%@#---*#%@@%*###**-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@     @@@@@@@@@@%@   @@@@@@       +@=        @@@@@@@@         @@       @@@@@@@  @%@@@@@%%%%%@@@@@%#%%%%%%%%%%####%#@@@@@%%##*#####+-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%@%@     @@%@@@@@@@%@   @@      =@@@@@      @@@@@@@@@@@@@@@@       @@@@@      @@@  @%%@%-@%%%@@@   @%%%%%%%%%%%%%##%#%%#########%#*#*#=
@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@%@     @@@@@@@@%@@@=       @@@@@@@      @@@@@@@@@@@@@@@@@@@@      @@@@@@@=       @@@%@@@%%%%%@=  @%#@%%%%%#%%%%%##%###%#############=
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@      @@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@     @@@@@@@@@@      @@@@@@%%%%@+  @%#%#%##%*#%%%%%###%%%#%###%@@#####=
%@@@@@@@@@@@@@@@@@@@@@@@%%@@@@@@@@@%%@@@@@@@@        =@@@@@@@@@@@     @@@@@@@@        @@@@@@@@#     @@@@@@@@@@@        @@@@@@@=  @##%%%@##%%%%%%%%%#%##%###%%-+%####=
%@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@            @@@@@@@@@@@@     @@@@@@@            @@@@@@@     @@@@@@@@@@@@@            @@  @@@@@@@@@%%%%%%%%%%%##%####@=@#####=
#@@@@@%@%@@@@@ +@@@@@@@@@@@                        @@@@@@@@@@@@@     @@@@@@@             @@@@@@@    @@@@@@@@@@@@@@                       @@%%@#%%%%%%%%##%%%########=
#%%%%@%@%%%@@@@@@@@@@@@@@@@=                      @@@@@@@@@@@@@@     @@@@@@              @@@@@@@     @@@@@@@@@@@@@                       @%%%%%%%%#%%%%%%##%#%%#####=
#@@@@@@@@@%%%@@@@@%%@@@@@@@                        @@@@@@@@@@@@@     @@@@@@%             @@@@@@@    @@@@@@@@@@@@@@                       @%%%%%%%%%%%%%%%%%%#%%%#%%#=
#@@@@@@@@@@@@@@%@@%@@@%@@@@@@@@@@@@@  @             @@@@@@@@@@@@     @@@@@@@            @@@@@@@     @@@@@@@@@@@@@             @@@@@@@@@@@@%%%%%%%%%%%%%%%%%%##%#####=
#@%@@%%%%@@@@%%@@@@@@@%@%%@@@@@@@%@@  @@@@@@@        @@@@@@@@@@@@     @@@@@@@@        +@@@@@@@@     @@@@@@@@@@@        +@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%#%%%%%%%###%%%+
=@@@%@%@@%%@@@%@%@@%@@@@@@@@%%%%@%@%  @%@%@@@@@@@      =@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@     @@@@@@@@@@      @@@@@@@%#@     @@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##+
=*--@@@@@%%%%%%%@%@@@@@@@-@@@@@@@@@#  @%@@@@@@%@@@@=      =@@@@@@@      @@@@@@@@@@@@@@@@@@@@      @@@@@@@@       @@@@%%%%%@#@     @@%%%%%%%%%%%%%%%%%@%%%%@%%%%%%%%%+
=#%%+--#@@@@@%%@@@@@@---+##--@@@@%@=  @#@@@@@@%%%%@   @@      #@@@@*      @@@@@@@@@@@@@@@@       @@@@@      =@@  @@%@@%%%%%#@     @@%%%%%%%%%%%%%%%%%%%%%%%#%%%%%@@@%
=****%+%-#@#%%@@@---=%*+==#%%%--@@@@@@@%@@@%%%@@%#@   @@@@@@       @@        @@@@@@@@@@        @@@      =@@@@@@  @%%%%%%%@%%@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%%@#%%%%%--*
*@%%###%=*@#@%@%-@@%%##%%%##*@@@=%@@@@@@@@@@@@@@@%@   @%%#@@@  @                                     =@@@@@@%@@  @@@@%%%%@@@@@%%%%%%%%@@%%%%%@@@@@@@@@@@%%%@#@%%%@@@#
=@%%%#*%-*@@%@@+-#####@%@%%%###%--@@@@@@@@@@@@@@%@@   @%@%@@%  @@@@@@@                        @@@@@   @%@@@@@%@  @@@@%%%%%%%%%%@%@@@@@%%@%%@%%%%%%%%@%%%%%%%#%%#%%%@*
 %%%%##@-#@%%%@+*%##%#%- %%%%##%+%@@@@@@@@@@@@@@@@@   @%@%@@#  @@@@%%@@@  @@@@@=#  =+#@@@@  @@@@%#@   @%%%%%@@@  @@%%%@@@@@@@@@@@@#+=#@@@@%%@@%%%%@%%%%%%%%%%%%%#%%%+
+@%%#%#%-@@%%%@-####%%%%%@%%%%#%-@@@@@@@@@@@@@@@@%@   @%@@%@#  @@@@@%@%@  @@@@@@@  @@@@@%@  @@@@@%@   @%%%%@%@@  @@%%%%@@@@@@%#+=##%%%*+@@@@@%%@%%%%%%%%%%%%%%%%%%%%*
=%##*###-@@%%@@-@###%%@@@@@%###%-@@@@@@@@@@@@@@@@@@   @@@@@@   @@%@@@%%@  @@@@@%@  #@@@@%@  @@%%@%@   @%@%%%%@@  @@@@%@@@@@%+*@@@@%%%%%%*=%@@%%%%@@@%%%%%%%%%%%%%%@@#
=###=---@@%%%%@-=%%###%######%*-*@@@@@@@@@@@@@@@@@@=  @@%@@@@@@@@@@@@@@@  @@@@@%@  #@@@@@@  @@%@@@@@@@@@@@@@@@@  @@@@@@@@@@@%@%%%@@@@@%@%%%#@@@@@@@@%@@@%%%%%%%%%@@%=
==--%@@@@@%%%%@@@--*%%###%#*--#@@@@@@@@@@@@@@@@@@@     @@@@@@@@@@@@@@@@@  @@@@@@@  #@@@@%@  @@@@@@@@@@@%@@@@@     @@@@%@@@@*#@%%@@+*%@%%%%#%@%%%%%%%%@@%%@%%%%%%@@-==
=%@@@@%@@@@@@@%%@@@@--**=-=@@@@@@@@@@@@@@@@@@@@@%@     @@%@@@@@@@@@@@@@#  @@@@@@@  %@@@@@@   @@@@@@@@@@@@@@@@     @@@@@@@@@*@%@@@#--#%%@%#%%%@@@@@@@%%%@%%@@%%%%@=-@-
+@%%%@@@+-+--#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     @%@@@@@@@@@@@@@   @@@@@@@@  %@@@@@@@*   @@@@@@@%@@@@@@     +@@@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  +#@@@%-
=##%%%%####%%%%%%%%@@@%%%%%%%%%%%@=@=++%@@@@@@@#*+@*@%%@=@@*-*@@@@@@-*@%*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@@@@@@@@@==+*##******-=@@@@@@@#=+@@@@@%@#%@@@@@@@@@%%%#-
=######%#%####%%%%%+-@%%%%%%%%%%%@*@-*+@%@  @%%*=*==@%@@+@@+-@@  @%@**@##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*-###%@@@@%##+=+@@@#%##%%#***####%#@@%%%%%%%%%#-
=###*####%#%%#####%@@@%%%%%%%%%%%@-@-+*@@@@@@@%==@@@@@@@=@@-=@%@@@%@-*@#@@@@@@@@@@@@*-@@@@@@@@@@@@@@@%@@- @@%%@@@%%@@--#*%#% @###===-@%%#%####%@@@#%%##*%%%%%%%%%%%%-
-+**#######%%#%#%###%%%%%@%%%%%%%@+@-==+%%@%%+-=-@=%%@@@=@@--#@@@%+--@@=*@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+#%#@@@ @@@%##=%@%%%##*##@  @**####%@#%%%%@%%#%-
-******###*###%%%%#%%####%%%#@%%#@--@@-------=+@#-@@@%@%-#@@@@----@@@@+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%-###%%@@@%##*#=@@%#%@#*##%@@@**%*##%@%%%%%%#==%-
-#******+#######%%%#%%%%%%##%%%%%@@@%+-%%*+#@+-@@@@@@@@@@@+-*@@@@@@+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=-=+++=#**+++--@@%%*%%%###%%##%@+#%%%%%%%%#*=+*=
-+++**#*#*+*+##**##%#%%%%%#%#%##%%##%%@@*--=%@@@@@#=--%@@@@@@*---+@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%--**++---@@@@@@@@=-#@@%%%@@% =@%%%%%%###*#%*:
-+++++++*+##*****##***######%%%%%%%%%###@@@@@@@%--++*+++--@@@@@@@@@@@@@%%%%@%@@@%@%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=--#@@@@@=-+@@@@@%-#@%#  #@@@@%%%%##%%%##*:
-++++++**+*************##*###*##%%#%%%%###%@%=-=+=++++++=++-@@%@%%%%%%%%%%@@%%%%%@@@@@@@@@@@@@@%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#--*@@%+-#@@@@@--@@@@@%%%%%%##%%##+*+.
-++++++++++++++*+***********########%%%%%%@=====+**###**+=*-%@%%%%%%%@@%%%%%%%%@%%%%%%%%%%%%%%%%@@@@%%%@@@@@@@@@@@@@@@@@@@@@--*#@@%%%%@%%--@%@@@@%%%%%%%%%#%%%###*#*.
-===+++*++++++++**+++*******+@@%*+#*#*####@-=+=+**@%@%#*+++-%%%@%%%%%%%@@@%%%%%%@@%@@@@%%@@@@@@@%%%%@@@@%%%%%%@@@@@@@@@@@%@@-@@%%%@%@%%%%@*@@@%%%%%%%%%#%%#%%#%####*.
-========+*++++++++++*+*****#=:@*****#+###@##=++**@  #%#++#*@%%%%%%@%%%%=*@%%%%%%%%%%@@@%%@@=-@@@@%%%@@@@@@%@%%%*%@@@@@@@@@@-%%%%@@#%@%%#@-@%@%%%%%%%%@%%%#%######## 
-==+========++++++++++++++++#@@%********++%==+==**@@@@*+==*=#@%##%#%%%%%@%%@%%%%%%#%%%%%%%%@@@@%%%%@@@%@%@@%@%@@@%@@@@@@@@%@-@#%%%@ @@%##@-@%%%%%%%%%%#%%########### 
-================+++++++++=++++++++*++****%==++===++=+====*-@%#%#%%#%%%%%##%%%%%%%%%%%%%%%#%%%%%%%%%%%%%%%%%%@@@@@@%%%%%%%@@-@%##%%%%%%#%@-@%%%#%%%%%%%%#%%######+#: 
-=================+=+++++++++++=++*++*****%#==============@@@#*#######%#%#%%####%%%%%%#%%#%%%%#%%%%#%%%%%%%%%%%%%%%%%%%%%@@@-=@@@%%#%@%%#--@@%%#%%%%%###%%%#%#*##+-: 
-=======================+=++++=++++=++++++++%##========%@%#*****+##**########%%%######@%%%%%%%%%%%%%%%%%%%%@%%%%%%%%%%%%%%%@@@--+@@%%---@@@@%%%@%%%%#%%%%%%%*#**#*:  
-------------------------------------------------------------------===-==================+++*****+*******++++****************#%@@---=%%%%#*#**++++=++++====-----:    
*/

error SubscriptionWithThisIdAlreadyExists();
error DurationMustBeGreaterThanZero();
error SubscriptionWithThisIdDoesNotExist();
error InvalidAmount();
error OnlyOwnerCanCallThisFunction();
error ReentrancyAttackDetected();
error TransferFailed();

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
}

contract XtrackSubscription {
    address public owner;
    address public marketingAddress;
    bool private reentrancyLock = false;

    IERC20 public tokenContract;

    struct Subscription {
        uint256 id;
        string name;
        uint256 price;
        uint256 balance;
        uint256 createdAt;
        uint256 updatedAt;
    }

    struct UserSubscription {
        uint256 id;
        uint256 duration;
        uint256 createdAt;
        uint256 expiresAt;
    }

    mapping(uint256 => Subscription) public subscriptions;
    mapping(address => UserSubscription) public userSubscriptions;
    mapping(address => uint256) public referralCount;
    mapping(address => uint256) public totalEarnings;
    mapping(address => address) private currentReferrals;

    constructor(address _marketingAddress, address _tokenContractAddress) {
        owner = msg.sender;
        marketingAddress = _marketingAddress;
        tokenContract = IERC20(_tokenContractAddress);
    }

    modifier onlyOwner() {
        if (msg.sender != owner) revert OnlyOwnerCanCallThisFunction();
        _;
    }

    modifier validSubscriptionId(uint256 id) {
        if (subscriptions[id].id != id)
            revert SubscriptionWithThisIdDoesNotExist();
        _;
    }

    modifier validDuration(uint256 duration) {
        if (duration <= 0) revert DurationMustBeGreaterThanZero();
        _;
    }

    modifier validPrice(uint256 subscriptionId, uint256 duration) {
        if (subscriptions[subscriptionId].price * duration > msg.value)
            revert InvalidAmount();
        _;
    }

    modifier nonReentrant() {
        if (reentrancyLock) revert ReentrancyAttackDetected();
        reentrancyLock = true;
        _;
        reentrancyLock = false;
    }

    function _getBasePercentage(
        uint256 tokenBalance
    ) private pure returns (uint256) {
        uint256 basePercentage = 5;
        if (tokenBalance >= 150000 * 1e18) {
            basePercentage = 50;
        } else if (tokenBalance >= 50000 * 1e18) {
            basePercentage = 20;
        } else if (tokenBalance >= 25000 * 1e18) {
            basePercentage = 15;
        } else if (tokenBalance >= 12500 * 1e18) {
            basePercentage = 10;
        }
        return basePercentage;
    }

    function _getTotalPercentage(
        uint256 basePercentage,
        uint256 referralCountForUser
    ) private pure returns (uint256) {
        uint256 additionalPercentage = (referralCountForUser / 5) * 5;
        uint256 totalPercentage = basePercentage + additionalPercentage;

        if (basePercentage == 5 && totalPercentage > 30) {
            totalPercentage = 30;
        } else if (basePercentage == 10 && totalPercentage > 40) {
            totalPercentage = 40;
        } else if (basePercentage == 15 && totalPercentage > 45) {
            totalPercentage = 45;
        } else if (basePercentage == 20 && totalPercentage > 50) {
            totalPercentage = 50;
        } else if (basePercentage == 50) {
            totalPercentage = 50;
        }

        return totalPercentage;
    }

    function getAppropriateReferralPercentage(
        address _referral
    ) public view returns (uint256) {
        uint256 tokenBalance = tokenContract.balanceOf(_referral);
        UserSubscription memory subscription = userSubscriptions[_referral];
        if (subscription.expiresAt > block.timestamp) {
            Subscription memory subscriptionDetails = subscriptions[
                subscription.id
            ];
            tokenBalance += subscriptionDetails.balance;
        }
        uint256 referralCountForUser = referralCount[_referral];
        uint256 basePercentage = _getBasePercentage(tokenBalance);
        uint256 totalPercentage = _getTotalPercentage(
            basePercentage,
            referralCountForUser
        );

        return totalPercentage;
    }

    function addSubscription(
        uint256 _id,
        string memory _name,
        uint256 _price,
        uint256 _balance
    ) public onlyOwner {
        uint256 timestamp = block.timestamp;
        subscriptions[_id] = Subscription(
            _id,
            _name,
            _price,
            _balance,
            timestamp,
            timestamp
        );
    }

    function addMultipleSubscriptions(
        uint256[] memory _ids,
        string[] memory _names,
        uint256[] memory _prices,
        uint256[] memory _balances
    ) public onlyOwner {
        uint256 timestamp = block.timestamp;
        for (uint256 i = 0; i < _ids.length; i++) {
            subscriptions[_ids[i]] = Subscription(
                _ids[i],
                _names[i],
                _prices[i],
                _balances[i],
                timestamp,
                timestamp
            );
        }
    }

    function updateSubscription(
        uint256 _id,
        string memory _name,
        uint256 _price,
        uint256 _balance
    ) public onlyOwner validSubscriptionId(_id) {
        uint256 timestamp = block.timestamp;
        subscriptions[_id].name = _name;
        subscriptions[_id].price = _price;
        subscriptions[_id].updatedAt = timestamp;
        subscriptions[_id].balance = _balance;
    }

    function deleteSubscription(
        uint256 _id
    ) public onlyOwner validSubscriptionId(_id) {
        delete subscriptions[_id];
    }

    function subscribe(
        uint256 _id,
        uint256 _duration,
        address _referral
    )
        public
        payable
        validSubscriptionId(_id)
        validDuration(_duration)
        validPrice(_id, _duration)
        nonReentrant
    {
        uint256 timestamp = block.timestamp;
        uint256 expiresAt = timestamp + (_duration * 30 days);

        userSubscriptions[msg.sender] = UserSubscription(
            _id,
            _duration,
            timestamp,
            expiresAt
        );

        if (currentReferrals[msg.sender] != _referral) {
            referralCount[_referral]++;
            currentReferrals[msg.sender] = _referral;
        }

        uint256 referralPercentage = getAppropriateReferralPercentage(
            _referral
        );

        uint256 referralAmount = 0;

        if (referralPercentage > 0) {
            referralAmount = (msg.value * referralPercentage) / 100;
            (bool _success, ) = payable(_referral).call{value: referralAmount}(
                ""
            );
            if (!_success) {
                revert TransferFailed();
            }

            totalEarnings[_referral] += referralAmount;
        }

        (bool success, ) = payable(marketingAddress).call{
            value: msg.value - referralAmount
        }("");

        if (!success) {
            revert TransferFailed();
        }
    }

    function cancelSubscription(address _address) public onlyOwner {
        delete userSubscriptions[_address];
    }

    function setUserSubscriptionExpiry(
        address _address,
        uint256 _expiresAt
    ) public onlyOwner {
        userSubscriptions[_address].expiresAt = _expiresAt;
    }

    function setMarketingAddress(address _marketingAddress) public onlyOwner {
        marketingAddress = _marketingAddress;
    }

    function setTokenContractAddress(
        address _tokenContractAddress
    ) public onlyOwner {
        tokenContract = IERC20(_tokenContractAddress);
    }

    function retrieveFunds() external onlyOwner nonReentrant {
        uint256 contractBalance = address(this).balance;
        (bool success, ) = payable(owner).call{value: contractBalance}("");
        if (!success) {
            revert TransferFailed();
        }
    }

    receive() external payable {}
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 500,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.