Natrium docs
  • ๐ŸงชOverview
    • ๐Ÿ“–Introducing Natrium
    • ๐Ÿ”ฎVision
  • โš™๏ธProtocol Overview
    • ๐ŸŒProtocol architecture
      • โšœ๏ธNatrium Core & Enterprise
    • ๐ŸŒŠLiquidations
    • ๐Ÿ“ˆInterest Rate Models
    • โšกOracles
    • โš–๏ธProtocol Fees
  • ๐Ÿ’ฐTokenomics
    • ๐Ÿš€Presale & Launch
    • ๐ŸงฌNTM & NaCl
  • โš’๏ธDev Docs
    • ๐Ÿ”‘Contract specs
      • Isolated Pools (Layer 1)
        • Bucket config
        • Supply underlying asset
        • Withdraw underlying asset
        • Deposit OverCollateralized asset
        • Borrow
        • Repay
        • Withdraw OverCollaterlized asset
        • Liquidate
      • Shufflers (Layer 2)
        • Contract functionalities
          • Shuffler Creation
          • Shuffler Management
          • Supply Cap Management
          • Risk Exposure Management
      • Error Library
        • Error lib
  • ๐Ÿ“šLibrary
    • Brand Assets
    • Community Links
    • Legal Disclaimer
Powered by GitBook
On this page
  1. โš’๏ธDev Docs
  2. ๐Ÿ”‘Contract specs
  3. Shufflers (Layer 2)
  4. Contract functionalities

Shuffler Management

Setup and manage Shufflers

PreviousShuffler CreationNextSupply Cap Management

Last updated 1 year ago

CtrlK

Execute setCurator(0xNewCurator)

function setCurator(address newCurator) external onlyOwner {
        if (newCurator == curator) revert ErrorsLib.AlreadySet();

        curator = newCurator;

        emit EventsLib.SetCurator(newCurator);
    }

Execute setIsAllocator(0xNewAllocator, true). One can set the second attribute to false to revoke the allocation capacity.

function setIsAllocator(address newAllocator, bool newIsAllocator) external onlyOwner {
        if (isAllocator[newAllocator] == newIsAllocator) revert ErrorsLib.AlreadySet();

        isAllocator[newAllocator] = newIsAllocator;

        emit EventsLib.SetIsAllocator(newAllocator, newIsAllocator);
    }

Note that if no guardian is set, (which is the case at vault creation), submitting a new guardian sets it immediately as the guardian. Execute submitGuardian(0xNewGuardian)

function submitGuardian(address newGuardian) external onlyOwner {
        if (newGuardian == guardian) revert ErrorsLib.AlreadySet();
        if (pendingGuardian.validAt != 0) revert ErrorsLib.AlreadyPending();

        if (guardian == address(0)) {
            _setGuardian(newGuardian);
        } else {
            pendingGuardian.update(newGuardian, timelock);

            emit EventsLib.SubmitGuardian(newGuardian);
        }
    
  1. Execute setFeeRecipient(0xNewFeeRecipient)

  2. Execute setFee(10000000000000000) // 1%, FEE variable has 18 decimals.

function setFee(uint256 newFee) external onlyOwner {
        if (newFee == fee) revert ErrorsLib.AlreadySet();
        if (newFee > ConstantsLib.MAX_FEE) revert ErrorsLib.MaxFeeExceeded();
        if (newFee != 0 && feeRecipient == address(0)) revert ErrorsLib.ZeroFeeRecipient();

        // Accrue fee using the previous fee set before changing it.
        _updateLastTotalAssets(_accrueFee());

        // Safe "unchecked" cast because newFee <= MAX_FEE.
        fee = uint96(newFee);

        emit EventsLib.SetFee(_msgSender(), fee);
    }

    /// @inheritdoc INatriumBase
    function setFeeRecipient(address newFeeRecipient) external onlyOwner {
        if (newFeeRecipient == feeRecipient) revert ErrorsLib.AlreadySet();
        if (newFeeRecipient == address(0) && fee != 0) revert ErrorsLib.ZeroFeeRecipient();

        // Accrue fee to the previous fee recipient set before changing it.
        _updateLastTotalAssets(_accrueFee());

        feeRecipient = newFeeRecipient;

        emit EventsLib.SetFeeRecipient(newFeeRecipient);
    }

The skim recipient will receive all rewards that may have been allocated to the vault, while the latter earned them by allocating liquidity on Natrium markets.

function skim(address token) external {
        if (skimRecipient == address(0)) revert ErrorsLib.ZeroAddress();

        uint256 amount = IERC20(token).balanceOf(address(this));

        IERC20(token).safeTransfer(skimRecipient, amount);

        emit EventsLib.Skim(_msgSender(), token, amount);
    }