public void Construct(
        TradableAssetPriceManager tradableAssetPriceManager,
        CurrencyManager currencyManager,
        LockPRPSManager lockPRPSManager,
        LockedPRPSManager lockedPRPSManager,
        GasPriceObserver gasPriceObserver,
        EtherBalanceObserver etherBalanceObserver,
        Hodler hodlerContract,
        UserWalletManager userWalletManager,
        ButtonClickObserver buttonClickObserver)
    {
        this.lockedPRPSManager    = lockedPRPSManager;
        this.etherBalanceObserver = etherBalanceObserver;
        this.userWalletManager    = userWalletManager;
        this.hodlerContract       = hodlerContract;
        this.buttonClickObserver  = buttonClickObserver;
        etherBalanceObserver.SubscribeObservable(this);
        buttonClickObserver.SubscribeObservable(this);

        Gas    = new GasManager(tradableAssetPriceManager, currencyManager, lockPRPSManager, gasPriceObserver, slider, transactionFeeText, this);
        Amount = new AmountManager(lockPRPSManager, maxToggle, amountInputField, prpsBalanceText, dubiBalanceText, dubiRewardText, tooltipItems[2]);
        Time   = new TimeManager(Amount, threeMonthsButton, sixMonthsButton, twelveMonthsButton, dubiRewardText);

        if (lockPRPSManager.PRPSBalance == 0)
        {
            maxToggle.SetInteractable(false);
            maxText.color = UIColors.LightGrey;
        }

        bool showTooltips = SecurePlayerPrefs.GetBool(PlayerPrefConstants.SETTING_SHOW_TOOLTIPS);

        foreach (TooltipItem tooltip in tooltipItems)
        {
            if (showTooltips)
            {
                tooltip.PopupManager = popupManager;
            }
            else if (tooltip.infoIcon)
            {
                tooltip.gameObject.SetActive(false);
            }
            else
            {
                tooltip.enabled = false;
            }
        }
    }
Exemple #2
0
        /// <summary>
        /// Initializes the GasMAnager by assigning required dependencies.
        /// </summary>
        /// <param name="tradableAssetPriceManager"> The active TradableAssetPriceManager. </param>
        /// <param name="currencyManager"> The active CurrencyManager. </param>
        /// <param name="lockPRPSManager"> The active LockPRPSManager. </param>
        /// <param name="gasPriceObserver"> The active GasPriceObserver. </param>
        /// <param name="slider"> The slider for controlling the gas prices. </param>
        /// <param name="transactionFeeText"> The text used for displaying the gas cost of the transaction. </param>
        /// <param name="lockPRPSPopup"></param>
        public GasManager(
            TradableAssetPriceManager tradableAssetPriceManager,
            CurrencyManager currencyManager,
            LockPRPSManager lockPRPSManager,
            GasPriceObserver gasPriceObserver,
            Slider slider,
            TMP_Text transactionFeeText,
            LockPRPSPopup lockPRPSPopup)
        {
            this.tradableAssetPriceManager = tradableAssetPriceManager;
            this.currencyManager           = currencyManager;
            this.lockPRPSManager           = lockPRPSManager;
            this.transactionFeeText        = transactionFeeText;
            this.lockPRPSPopup             = lockPRPSPopup;

            transactionSpeedSlider = new TransactionSpeedSlider(gasPriceObserver, slider, UpdateGasPriceEstimate);
            transactionSpeedSlider.Start();
        }
Exemple #3
0
    public void Construct(
        UserWalletManager userWalletManager,
        EthereumTransactionManager ethereumTransactionManager,
        EthereumTransactionButtonManager ethereumTransactionButtonManager,
        TradableAssetManager tradableAssetManager,
        TradableAssetButtonManager tradableAssetButtonManager,
        TradableAssetNotificationManager tradableAssetNotificationManager,
        LockedPRPSManager lockedPRPSManager,
        LockPRPSManager lockPRPSManager)
    {
        this.userWalletManager                = userWalletManager;
        this.ethereumTransactionManager       = ethereumTransactionManager;
        this.ethereumTransactionButtonManager = ethereumTransactionButtonManager;
        this.tradableAssetManager             = tradableAssetManager;
        this.tradableAssetButtonManager       = tradableAssetButtonManager;
        this.tradableAssetNotificationManager = tradableAssetNotificationManager;
        this.lockedPRPSManager                = lockedPRPSManager;
        this.lockPRPSManager = lockPRPSManager;

        bool showTooltips = SecurePlayerPrefs.GetBool(PlayerPrefConstants.SETTING_SHOW_TOOLTIPS);

        foreach (TooltipItem tooltip in tooltipItems)
        {
            if (showTooltips)
            {
                tooltip.PopupManager = popupManager;
            }
            else if (tooltip.infoIcon)
            {
                tooltip.gameObject.SetActive(false);
            }
            else
            {
                tooltip.enabled = false;
            }
        }
    }
        /// <summary>
        /// Initializes the <see cref="AmountManager"/> by assigning the references to the popup, max toggle, and amount input field.
        /// </summary>
        /// <param name="lockPRPSManager"> The active LockPRPSManager. </param>
        /// <param name="maxToggle"> The toggle for switching between maximum sendable amount and the entered amount. </param>
        /// <param name="amountInputField"> The input field used for entering the sendable amount. </param>
        /// <param name="prpsBalanceText"> Text component used for displaying the current purpose balance. </param>
        /// <param name="dubiBalanceText"> Text component used for displaying the current dubi balance. </param>
        /// <param name="dubiRewardText"> Text component used for displaying the dubi reward. </param>
        /// <param name="buttonTooltipItem"> The lock button tooltip item </param>
        public AmountManager(
            LockPRPSManager lockPRPSManager,
            Toggle maxToggle,
            HopeInputField amountInputField,
            TMP_Text prpsBalanceText,
            TMP_Text dubiBalanceText,
            TMP_Text dubiRewardText,
            TooltipItem buttonTooltipItem)
        {
            this.lockPRPSManager   = lockPRPSManager;
            this.maxToggle         = maxToggle;
            this.amountInputField  = amountInputField;
            this.prpsBalanceText   = prpsBalanceText;
            this.dubiBalanceText   = dubiBalanceText;
            this.dubiRewardText    = dubiRewardText;
            this.buttonTooltipItem = buttonTooltipItem;

            lockPRPSManager.OnAmountsUpdated += BalancesUpdated;

            maxToggle.AddToggleListener(MaxChanged);
            amountInputField.OnInputUpdated += _ => AmountFieldChanged();

            BalancesUpdated();
        }