ETH Price: $3,337.65 (-1.10%)

Contract

0xddc55e390841021b0E99179322F66d3A17E070E1
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim And Refund195734082024-04-03 6:17:11268 days ago1712125031IN
0xddc55e39...A17E070E1
0 ETH0.0013330419.90920319
Claim And Refund195216532024-03-26 22:48:11276 days ago1711493291IN
0xddc55e39...A17E070E1
0 ETH0.0023695935.39036713
Claim And Refund195109342024-03-25 10:34:59277 days ago1711362899IN
0xddc55e39...A17E070E1
0 ETH0.0013340919.92490654
Claim And Refund195096092024-03-25 6:05:11277 days ago1711346711IN
0xddc55e39...A17E070E1
0 ETH0.0024364836.38937618
Claim And Refund194665612024-03-19 4:56:59283 days ago1710824219IN
0xddc55e39...A17E070E1
0 ETH0.0012857919.20356349
Claim And Refund194653342024-03-19 0:48:23284 days ago1710809303IN
0xddc55e39...A17E070E1
0 ETH0.0020503230.62194131
Claim And Refund194568412024-03-17 20:08:35285 days ago1710706115IN
0xddc55e39...A17E070E1
0 ETH0.0019531229.17027718
Claim And Refund194465162024-03-16 9:18:11286 days ago1710580691IN
0xddc55e39...A17E070E1
0 ETH0.0018500127.63028269
Claim And Refund194456152024-03-16 6:13:59286 days ago1710569639IN
0xddc55e39...A17E070E1
0 ETH0.0017522126.16963022
Claim And Refund194399072024-03-15 10:59:59287 days ago1710500399IN
0xddc55e39...A17E070E1
0 ETH0.0020577530.73294988
Claim And Refund194257742024-03-13 11:12:35289 days ago1710328355IN
0xddc55e39...A17E070E1
0 ETH0.004486367.00370695
Claim And Refund194194702024-03-12 14:02:59290 days ago1710252179IN
0xddc55e39...A17E070E1
0 ETH0.0044838866.96758298
Claim And Refund194111472024-03-11 10:05:59291 days ago1710151559IN
0xddc55e39...A17E070E1
0 ETH0.0051984477.63974418
Claim And Refund194059862024-03-10 16:47:59292 days ago1710089279IN
0xddc55e39...A17E070E1
0 ETH0.005503182.18985839
Claim And Refund193996842024-03-09 19:39:23293 days ago1710013163IN
0xddc55e39...A17E070E1
0 ETH0.0045848568.47564982
Claim And Refund193940112024-03-09 0:38:35294 days ago1709944715IN
0xddc55e39...A17E070E1
0 ETH0.002988144.62793564
Claim And Refund193893572024-03-08 8:49:11294 days ago1709887751IN
0xddc55e39...A17E070E1
0 ETH0.0031684547.32142177
Claim And Refund191694732024-02-06 13:24:35325 days ago1707225875IN
0xddc55e39...A17E070E1
0 ETH0.0029259843.70018262
Claim And Refund191539122024-02-04 8:59:23327 days ago1707037163IN
0xddc55e39...A17E070E1
0 ETH0.0009120313.62147748
Claim And Refund191524462024-02-04 4:01:11328 days ago1707019271IN
0xddc55e39...A17E070E1
0 ETH0.000911513.61351283
Claim And Refund191523802024-02-04 3:47:35328 days ago1707018455IN
0xddc55e39...A17E070E1
0 ETH0.000829912.39477652
Claim And Refund191523242024-02-04 3:36:11328 days ago1707017771IN
0xddc55e39...A17E070E1
0 ETH0.0007715411.52323278
Claim And Refund191506502024-02-03 21:58:11328 days ago1706997491IN
0xddc55e39...A17E070E1
0 ETH0.0011604815.30802251
Claim And Refund191403552024-02-02 11:16:35329 days ago1706872595IN
0xddc55e39...A17E070E1
0 ETH0.0013641320.37354264
Claim And Refund191277182024-01-31 16:42:35331 days ago1706719355IN
0xddc55e39...A17E070E1
0 ETH0.0021705632.4177758
View all transactions

Latest 10 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
189469422024-01-06 8:18:23356 days ago1704529103
0xddc55e39...A17E070E1
0.02975896 ETH
189469422024-01-06 8:18:23356 days ago1704529103
0xddc55e39...A17E070E1
0.02975896 ETH
189469272024-01-06 8:15:23356 days ago1704528923
0xddc55e39...A17E070E1
0.02975896 ETH
189469132024-01-06 8:12:35356 days ago1704528755
0xddc55e39...A17E070E1
0.02975896 ETH
189469132024-01-06 8:12:35356 days ago1704528755
0xddc55e39...A17E070E1
0.02975896 ETH
189468922024-01-06 8:08:23356 days ago1704528503
0xddc55e39...A17E070E1
0.02975896 ETH
189468922024-01-06 8:08:23356 days ago1704528503
0xddc55e39...A17E070E1
0.02975896 ETH
189468732024-01-06 8:04:35356 days ago1704528275
0xddc55e39...A17E070E1
0.03033674 ETH
189468732024-01-06 8:04:35356 days ago1704528275
0xddc55e39...A17E070E1
0.03033674 ETH
189468442024-01-06 7:58:47356 days ago1704527927
0xddc55e39...A17E070E1
0.03033674 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x64774180...C4808219c
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PooledDepositEscrow

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : PooledDepositEscrow.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

// Structs
import {UserRequest} from "./core/Structs.sol";

/// Utils /////
import {BaseChecker} from "./utils/BaseChecker.sol";
import {Ownable} from "./utils/Ownable.sol";

//Interfaces
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import {IFyde} from "./interfaces/IFyde.sol";
import {IGovernanceModule} from "./interfaces/IGovernanceModule.sol";
import {IOracle} from "./interfaces/IOracle.sol";
import {IRelayer} from "./interfaces/IRelayer.sol";

///@title PooledDepositEscrow
///@notice The purpose of this contract is to pool assets from different users to be deposited into
/// fyde at
/// once in order to bootstrap the pool and/or save deposit taxes.
///@dev Following flow -> owner deploys Escrow with whitelisted assets/govAssets -> owner whitelists
/// users -> user deposit assets with/without governance -> escrow period is over and deposits are
/// disabled, start of freeze period -> owner decides how much of the deposited assets they want to
/// keep (setConcentrations) -> freeze period ends -> depositToFyde() requestDeposits on the relayer
/// to transfer funds into fyde (works in batches of 5 assets, has to be called multiple times due
/// to gas limitations) -> wait until fyde has processed transactions -> updateInternalAccounting
/// gets the correct TRSY price after calculated by gelato -> user claim assets, gets TRSY sTRSY and
/// refunds (can claim whenever they want)
/// REVOKE: If owner decides that something is wrong after escrow period, can revoke. Users can then
/// get 100% of deposits refunded
contract PooledDepositEscrow is Ownable, BaseChecker {
  using SafeERC20 for IERC20;

  error CannotClaimForAsset(address);
  error EscrowPeriodEnded();
  error InvalidTimePeriod();
  error InsufficientBalance(address);
  error OnlyDuringFreeze();
  error FydeDepositCompleted();
  error FydeDepositNotCompleted();
  error Revoked();
  error NotRevoked();
  error NotSupportedAsset(address);
  error InternalAccountingNotUpdated();
  error DepositsMightStillBeProcessed();
  error ConcentrationsNotSet();
  error TaxFactorNotZero();
  error PriceNotAvailable(address asset);

  ///@notice Used for precision of division
  uint256 constant SCALING_FACTOR = 1e18;

  ///@notice Max number assets accepted in one request
  uint128 public constant MAX_ASSET_TO_REQUEST = 5;

  ///@notice max gas required for deposit, should correspondent to gov deposit of 5 assets + proxy
  /// creation
  uint128 public constant GAS_TO_FORWARD = 2e6;

  ///@notice timestamp until which users can deposit
  uint128 public immutable ESCROW_PERIOD;

  ///@notice timestamp until owner can set concentrations or revoke
  uint128 public immutable FREEZE_PERIOD;

  ///@notice fyde interface
  IFyde public immutable FYDE;
  ///@notice relayer interface
  IRelayer public immutable RELAYER;
  ///@notice governance module interface
  IGovernanceModule public immutable GOVERNANCE_MODULE;
  ///@notice oracle module interface
  IOracle public immutable ORACLE;

  /// -----------------------------
  ///         Storage
  /// -----------------------------

  // bools used to ensure actions are called in correct order

  ///@notice owner has set concentration
  bool public concentrationsSet;
  ///@notice requested deposit on relayer for all assets
  bool public fydeDepositCompleted;
  ///@notice owner has abborted escrow process
  bool public revoked;
  ///@notice trsy price updated after deposits are processed
  bool public internalAccountingUpdated;
  ///@notice amount of assets deposited to fyde (since done in multiple tx)
  uint256 public assetsTransferred;
  ///@notice measure of expected TRSY when requesting depositing, rescaled to correct value
  uint256 public totalExpectedTrsy;
  ///notice assets allowed for deposit
  address[] public assets;

  ///@dev splits slot into uint128 for std and gov deposit values
  struct Slot {
    uint128 std;
    uint128 gov;
  }

  ///@notice user authorization, can use deposit
  mapping(address => bool) public isUser;

  ///@notice is asset allowed in escrow
  mapping(address => bool) public supportedAssets;
  ///@notice is asset allowed in governance
  mapping(address => bool) public keepGovAllowed;
  ///@notice total token balance in escrow
  mapping(address => Slot) public totalBalance;
  ///@notice amount of token to be deposited into fyde (chosen by escrow owner)
  mapping(address => Slot) public concentrationAmounts;
  ///@notice token amount accepted for fyde / amount deposited into escrow
  mapping(address => Slot) public finalPercentages;
  ///@notice TRSY received for each asset
  mapping(address => Slot) public TRSYBalancesPerAsset;
  ///@notice escrow deposits per user and asset;
  mapping(address => mapping(address => Slot)) public deposits;

  /// -----------------------------
  ///         Events
  /// -----------------------------

  event AssetDeposited(address indexed account, address indexed asset, uint256 amount);
  event ClaimedAndRefunded(address indexed account);
  event ConcentrationAmountsSet(uint128[] amounts, uint128[] govAmounts);
  event FydeDeposit();
  event Refunded(address indexed account, address indexed asset, uint256 refund);
  event EscrowRevoked();
  event InternalAccountingUpdated();

  ///@notice Deploys escrow and sets the assets for deposit and the timing for the scrow.
  ///@param _assets Addresses of whitelisted assets
  ///@param _keepGovAllowed is asset whitelisted for gov deposit true/false
  ///@param _fyde Address of fyde contract
  ///@param _relayer Address of relayer contract
  ///@param _governanceModule Address of governance Module contract
  ///@param _oracle Address of oracle module contract
  ///@param _escrowPeriod length of escrow period in seconds after depoyment
  ///@param _freezePeriod length of freeze period in seconds after freeze period
  constructor(
    address[] memory _assets,
    bool[] memory _keepGovAllowed,
    address _fyde,
    address _relayer,
    address _governanceModule,
    address _oracle,
    uint128 _escrowPeriod,
    uint128 _freezePeriod
  ) Ownable(msg.sender) {
    if (_assets.length != _keepGovAllowed.length) revert InconsistentLengths();

    FYDE = IFyde(_fyde);
    RELAYER = IRelayer(_relayer);
    GOVERNANCE_MODULE = IGovernanceModule(_governanceModule);
    ORACLE = IOracle(_oracle);

    ESCROW_PERIOD = uint128(block.timestamp) + _escrowPeriod;
    FREEZE_PERIOD = ESCROW_PERIOD + _freezePeriod;

    assets = _assets;

    // Activate supported assets
    for (uint256 i = 0; i < _assets.length; ++i) {
      supportedAssets[_assets[i]] = true;
      if (_keepGovAllowed[i]) keepGovAllowed[_assets[i]] = true;
    }
  }

  ///@notice Adds users to whitelist of allwoed depositors
  ///@param _user addresses to whitelist
  function addUser(address[] calldata _user) external onlyOwner {
    for (uint256 i; i < _user.length; ++i) {
      isUser[_user[i]] = true;
    }
  }

  ///@notice Removes users from whitelist
  ///@param _user addresses to remove from
  function removeUser(address[] calldata _user) external onlyOwner {
    for (uint256 i; i < _user.length; ++i) {
      isUser[_user[i]] = false;
    }
  }

  ///@notice Collect ETH from the contract, in case extra eth
  function collectEth(address payable _recipient) external onlyOwner {
    uint256 ethBalance = address(this).balance;
    (bool sent,) = _recipient.call{value: ethBalance}("");
    require(sent);
  }

  ///@notice Deposits asset into escrow
  ///@param asset Asset to deposit
  ///@param amount Amount to deposit
  ///@param keepGovRights standard or governance deposit
  function deposit(address asset, uint128 amount, bool keepGovRights) external onlyUser {
    if (amount == 0) revert ZeroParameter();
    if (uint128(block.timestamp) > ESCROW_PERIOD) revert EscrowPeriodEnded();
    if ((keepGovRights && !keepGovAllowed[asset]) || !supportedAssets[asset]) {
      revert NotSupportedAsset(asset);
    }
    IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
    if (keepGovRights) {
      deposits[msg.sender][asset].gov += amount;
      totalBalance[asset].gov += amount;
    } else {
      deposits[msg.sender][asset].std += amount;
      totalBalance[asset].std += amount;
    }

    emit AssetDeposited(msg.sender, asset, amount);
  }

  ///@notice Sets amount of tokens to accept into fyde
  ///@param amounts Amount of tokens for standard deposit
  ///@param govAmounts Amount of tokens for governance deposit
  ///@dev inputs have to be of same length and order as storage variable assets
  function setConcentrationAmounts(uint128[] calldata amounts, uint128[] calldata govAmounts)
    external
    onlyOwner
  {
    if (amounts.length != assets.length || govAmounts.length != assets.length) {
      revert InconsistentLengths();
    }
    uint128 time = uint128(block.timestamp);
    if (time < ESCROW_PERIOD || time > FREEZE_PERIOD) revert InvalidTimePeriod();
    for (uint256 i = 0; i < amounts.length; ++i) {
      address asset = assets[i];

      uint128 assetAmount = amounts[i];
      uint128 govAmount = govAmounts[i];

      if (assetAmount == 0 && govAmount == 0) continue;

      uint128 balance = totalBalance[asset].std;
      uint128 govBalance = totalBalance[asset].gov;

      if (assetAmount > balance || govAmount > govBalance) revert InsufficientBalance(asset);

      if (assetAmount != 0) {
        finalPercentages[asset].std =
          uint128(uint256(assetAmount) * SCALING_FACTOR / uint256(balance));
        concentrationAmounts[asset].std = assetAmount;
      }

      if (govAmount != 0) {
        finalPercentages[asset].gov =
          uint128(uint256(govAmount) * SCALING_FACTOR / uint256(govBalance));
        concentrationAmounts[asset].gov = govAmount;
      }
    }
    concentrationsSet = true;
    emit ConcentrationAmountsSet(amounts, govAmounts);
  }

  ///@notice Requests deposit of assets into fyde
  ///@dev due to gas limitations deposits a maximum of 5 assets with and without governance, has to
  /// be called multiple times until all assets are transferred
  function depositToFyde() external payable {
    if (uint128(block.timestamp) <= FREEZE_PERIOD) revert InvalidTimePeriod();
    if (!concentrationsSet) revert ConcentrationsNotSet();
    if (fydeDepositCompleted) revert FydeDepositCompleted();
    if (revoked) revert Revoked();
    (, uint72 taxFactor,,,,) = FYDE.protocolData();
    if (taxFactor != 0) revert TaxFactorNotZero();

    address[] memory assetsList = assets;

    uint256 assetsToTransfer = assetsList.length - assetsTransferred;
    assetsToTransfer =
      assetsToTransfer < MAX_ASSET_TO_REQUEST ? assetsToTransfer : MAX_ASSET_TO_REQUEST;

    uint256 stdRequestLength;
    uint256 govRequestLength;
    for (uint256 i = assetsTransferred; i < assetsTransferred + assetsToTransfer; ++i) {
      if (keepGovAllowed[assetsList[i]] && concentrationAmounts[assetsList[i]].gov != 0) {
        govRequestLength += 1;
      }
      if (concentrationAmounts[assetsList[i]].std != 0) stdRequestLength += 1;
    }

    UserRequest[] memory stdRequest = new UserRequest[](stdRequestLength);
    UserRequest[] memory govRequest = new UserRequest[](govRequestLength);

    uint256 sIdx;
    uint256 gIdx;
    uint256 totalUSDValue;
    for (uint256 i = assetsTransferred; i < assetsTransferred + assetsToTransfer; ++i) {
      uint256 totalAmount = 0;
      if (concentrationAmounts[assetsList[i]].std != 0) {
        // populate request array
        stdRequest[sIdx].asset = assetsList[i];
        stdRequest[sIdx].amount = concentrationAmounts[assetsList[i]].std;
        totalAmount += stdRequest[sIdx].amount;
        // track deposited value
        uint256 usdValue = FYDE.getQuote(stdRequest[sIdx].asset, stdRequest[sIdx].amount);
        if (usdValue == 0) revert PriceNotAvailable(assetsList[i]);
        totalUSDValue += usdValue;
        TRSYBalancesPerAsset[stdRequest[sIdx].asset].std = uint128(usdValue);

        sIdx += 1;
      }

      if (keepGovAllowed[assetsList[i]] && concentrationAmounts[assetsList[i]].gov != 0) {
        govRequest[gIdx].asset = assetsList[i];
        govRequest[gIdx].amount = concentrationAmounts[assetsList[i]].gov;
        totalAmount += govRequest[gIdx].amount;
        gIdx += 1;
      }

      IERC20(assetsList[i]).forceApprove(address(FYDE), totalAmount);
    }

    totalExpectedTrsy += totalUSDValue;

    uint256 ETHToForward = ORACLE.getGweiPrice() * GAS_TO_FORWARD;
    if (stdRequestLength != 0) RELAYER.requestDeposit{value: ETHToForward}(stdRequest, false, 0);
    if (govRequestLength != 0) RELAYER.requestDeposit{value: ETHToForward}(govRequest, true, 0);

    assetsTransferred += assetsToTransfer;
    if (assetsTransferred == assetsList.length) {
      fydeDepositCompleted = true;
      emit FydeDeposit();
    }
  }

  ///@notice Rescale TrsyBalance to be correct. Has to be called after bootstrapLiquidity and before
  /// claiming
  ///@dev At the time of transferring funds into fyde, we dont know the current AUM/TRSY price to
  /// get the amount of trsy we got per asset.
  /// We therefore only store the USD values which are proportional to the correct TRSY balance in
  /// TRSYBalancesPerAsset. After the deposit has been processed,
  /// This function is called to check the actual amount of TRSY minted and rescale the balances
  function updateInternalAccounting() external {
    if (!fydeDepositCompleted) revert FydeDepositNotCompleted();
    // make sure rescale is not called when processing still in progress by checking queue is empty
    if (RELAYER.getNumPendingRequest() != 0) revert DepositsMightStillBeProcessed();

    uint256 actualTrsyBalance = IERC20(address(FYDE)).balanceOf(address(this));

    // SCALING_FACTOR to ensure precision when dividing
    uint256 scalingFactor;
    if (totalExpectedTrsy != 0) {
      scalingFactor = SCALING_FACTOR * actualTrsyBalance / totalExpectedTrsy;
    }

    for (uint256 i; i < assets.length; ++i) {
      address asset = assets[i];
      uint128 rescaledTrsy =
        uint128(uint256(TRSYBalancesPerAsset[asset].std) * scalingFactor / SCALING_FACTOR);
      TRSYBalancesPerAsset[asset].std = rescaledTrsy;
      // for governance we exactly know the balance for each asset - the sTRSY.balanceOf
      if (keepGovAllowed[asset]) {
        TRSYBalancesPerAsset[asset].gov =
          uint128(GOVERNANCE_MODULE.strsyBalance(address(this), asset));
      }
    }

    internalAccountingUpdated = true;
    emit InternalAccountingUpdated();
  }

  ///@notice User claim their TRSY, sTRSY and refund
  ///@param assetsToClaim Assets for which to claim
  function claimAndRefund(address[] calldata assetsToClaim) external {
    if (revoked) revert Revoked();
    if (!fydeDepositCompleted) revert FydeDepositNotCompleted();
    if (!internalAccountingUpdated) revert InternalAccountingNotUpdated();
    uint256 totalClaimedTrsy;
    for (uint256 i; i < assetsToClaim.length; ++i) {
      address asset = assetsToClaim[i];
      uint256 standardDeposit = deposits[msg.sender][asset].std;
      uint256 govDeposit = deposits[msg.sender][asset].gov;
      uint256 totalDeposit = standardDeposit + govDeposit;
      if (totalDeposit == 0) revert CannotClaimForAsset(asset);
      // Update their orginal deposit balance
      uint256 refundAmount = totalDeposit;

      if (standardDeposit > 0) {
        deposits[msg.sender][asset].std = 0;
        uint256 standardFundsUsed =
          standardDeposit * uint256(finalPercentages[asset].std) / SCALING_FACTOR;
        uint256 claimTRSY;
        if (concentrationAmounts[asset].std != 0) {
          claimTRSY = standardFundsUsed * uint256(TRSYBalancesPerAsset[asset].std)
            / uint256(concentrationAmounts[asset].std);
        }
        totalClaimedTrsy += claimTRSY;
        refundAmount -= standardFundsUsed;
      }

      if (govDeposit > 0) {
        deposits[msg.sender][asset].gov = 0;
        uint256 govFundsUsed = govDeposit * uint256(finalPercentages[asset].gov) / SCALING_FACTOR;
        uint256 claimStakedTRSY;
        if (concentrationAmounts[asset].gov != 0) {
          claimStakedTRSY = govFundsUsed * uint256(TRSYBalancesPerAsset[asset].gov)
            / uint256(concentrationAmounts[asset].gov);
        }
        refundAmount -= govFundsUsed;
        IERC20(GOVERNANCE_MODULE.assetToStrsy(asset)).transfer(msg.sender, claimStakedTRSY);
      }
      // Refund user, make sure balance not exceeded in case of rounding error
      if (refundAmount > 0) {
        uint256 escrowBalance = IERC20(asset).balanceOf(address(this));
        refundAmount = escrowBalance > refundAmount ? refundAmount : escrowBalance;
        IERC20(asset).safeTransfer(msg.sender, refundAmount);
      }
    }

    // send all standard TRSY
    IERC20(address(FYDE)).transfer(msg.sender, totalClaimedTrsy);

    emit ClaimedAndRefunded(msg.sender);
  }

  ///@notice User claim their refund if escrow has been revoked
  function refund(address[] calldata assetsToRefund) external {
    if (!revoked) revert NotRevoked();
    for (uint256 i; i < assetsToRefund.length; ++i) {
      address asset = assetsToRefund[i];
      uint256 totalDeposit = deposits[msg.sender][asset].std + deposits[msg.sender][asset].gov;
      deposits[msg.sender][asset].std = 0;
      deposits[msg.sender][asset].gov = 0;
      IERC20(asset).safeTransfer(msg.sender, totalDeposit);
      emit Refunded(msg.sender, asset, totalDeposit);
    }
  }

  ///@notice Abort escrow period and allows user to claim their refund
  function revoke() external onlyOwner {
    uint128 time = uint128(block.timestamp);
    if (time < ESCROW_PERIOD || time > FREEZE_PERIOD) revert OnlyDuringFreeze();
    revoked = true;
    emit EscrowRevoked();
  }

  ///@notice Recovers funds in case something goes wrong
  function returnStuckFunds(address _asset, address _to, uint256 _amount) external onlyOwner {
    IERC20(_asset).safeTransfer(_to, _amount);
  }

  function get_assets() external view returns (address[] memory) {
    return assets;
  }

  ///@notice Returns estimated TRSY for user
  ///@dev Have to be call for front end purpose after updateInternalAccounting
  function getEstimatedTrsy(address _user, address _asset) public view returns (uint256, uint256) {
    Slot memory balance = totalBalance[_asset];
    Slot memory trsy = TRSYBalancesPerAsset[_asset];
    Slot memory dep = deposits[_user][_asset];

    uint256 stdExpTrsy =
      trsy.std != 0 ? uint256(trsy.std) * uint256(dep.std) / (uint256(balance.std)) : 0;
    uint256 govExpTrsy =
      trsy.gov != 0 ? uint256(trsy.gov) * uint256(dep.gov) / (uint256(balance.gov)) : 0;

    return (stdExpTrsy, govExpTrsy);
  }

  ///@dev checks whitelist to allow deposits
  modifier onlyUser() {
    if (!isUser[address(0x0)] && !isUser[msg.sender]) revert Unauthorized();
    _;
  }
}

File 2 of 12 : Structs.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

struct AssetInfo {
  uint72 targetConcentration;
  address uniswapPool;
  int72 incentiveFactor;
  uint8 assetDecimals;
  uint8 quoteTokenDecimals;
  address uniswapQuoteToken;
  bool isSupported;
}

struct ProtocolData {
  ///@notice Protocol AUM in USD
  uint256 aum;
  ///@notice multiplicator for the tax equation, 100% = 100e18
  uint72 taxFactor;
  ///@notice Max deviation allowed between AUM from keeper and registry
  uint16 maxAumDeviationAllowed; // Default val 200 == 2 %
  ///@notice block number where AUM was last updated
  uint48 lastAUMUpdateBlock;
  ///@notice annual fee on AUM, in % per year 100% = 100e18
  uint72 managementFee;
  ///@notice last block.timestamp when fee was collected
  uint48 lastFeeCollectionTime;
}

struct UserRequest {
  address asset;
  uint256 amount;
}

struct RequestData {
  uint32 id;
  address requestor;
  address[] assetIn;
  uint256[] amountIn;
  address[] assetOut;
  uint256[] amountOut;
  bool keepGovRights;
  uint256 slippageChecker;
}

struct RequestQ {
  uint64 start;
  uint64 end;
  mapping(uint64 => RequestData) requestData;
}

struct ProcessParam {
  uint256 targetConc;
  uint256 currentConc;
  uint256 usdValue;
  uint256 taxableAmount;
  uint256 taxInUSD;
  uint256 sharesBeforeTax;
  uint256 sharesAfterTax;
}

struct RebalanceParam {
  address asset;
  uint256 assetTotalAmount;
  uint256 assetProxyAmount;
  uint256 assetPrice;
  uint256 sTrsyTotalSupply;
  uint256 trsyPrice;
}

File 3 of 12 : BaseChecker.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

abstract contract BaseChecker {
  error ZeroParameter();
  error InconsistentLengths();

  function _checkZeroValue(uint256 val) internal pure {
    if (val == 0) revert ZeroParameter();
  }

  function _checkZeroAddress(address addr) internal pure {
    if (addr == address(0x0)) revert ZeroParameter();
  }

  function _checkForConsistentLength(address[] memory arr1, uint256[] memory arr2) internal pure {
    if (arr1.length != arr2.length) revert InconsistentLengths();
  }
}

File 4 of 12 : Ownable.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

///@title Ownable contract
/// @notice Simple 2step owner authorization combining solmate and OZ implementation
abstract contract Ownable {
  /*//////////////////////////////////////////////////////////////
                             STORAGE
    //////////////////////////////////////////////////////////////*/

  ///@notice Address of the owner
  address public owner;

  ///@notice Address of the pending owner
  address public pendingOwner;

  /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

  event OwnershipTransferred(address indexed user, address indexed newOner);
  event OwnershipTransferStarted(address indexed user, address indexed newOwner);
  event OwnershipTransferCanceled(address indexed pendingOwner);

  /*//////////////////////////////////////////////////////////////
                                 ERROR
    //////////////////////////////////////////////////////////////*/

  error Unauthorized();

  /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

  constructor(address _owner) {
    owner = _owner;

    emit OwnershipTransferred(address(0), _owner);
  }

  /*//////////////////////////////////////////////////////////////
                             OWNERSHIP LOGIC
    //////////////////////////////////////////////////////////////*/

  ///@notice Transfer ownership to a new address
  ///@param newOwner address of the new owner
  ///@dev newOwner have to acceptOwnership
  function transferOwnership(address newOwner) external onlyOwner {
    pendingOwner = newOwner;
    emit OwnershipTransferStarted(msg.sender, pendingOwner);
  }

  ///@notice NewOwner accept the ownership, it transfer the ownership to newOwner
  function acceptOwnership() external {
    if (msg.sender != pendingOwner) revert Unauthorized();
    address oldOwner = owner;
    owner = pendingOwner;
    delete pendingOwner;
    emit OwnershipTransferred(oldOwner, owner);
  }

  ///@notice Cancel the ownership transfer
  function cancelTransferOwnership() external onlyOwner {
    emit OwnershipTransferCanceled(pendingOwner);
    delete pendingOwner;
  }

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

File 5 of 12 : 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 12 : 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 12 : IFyde.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

import {RequestData, RebalanceParam, ProcessParam} from "src/core/Structs.sol";

interface IFyde {
  function protocolData() external view returns (uint256, uint72, uint16, uint48, uint72, uint48);

  function isAnyNotSupported(address[] calldata _assets) external view returns (address);

  function isSwapAllowed(address[] calldata _assets) external view returns (address);

  function computeProtocolAUM() external view returns (uint256);

  function getProtocolAUM() external view returns (uint256);

  function updateProtocolAUM(uint256) external;

  function processDeposit(uint256, RequestData calldata) external returns (uint256);

  function processWithdraw(uint256, RequestData calldata) external returns (uint256);

  function totalAssetAccounting(address) external view returns (uint256);

  function proxyAssetAccounting(address) external view returns (uint256);

  function standardAssetAccounting(address) external view returns (uint256);

  function getQuote(address, uint256) external view returns (uint256);

  function getAssetDecimals(address) external view returns (uint8);

  function collectManagementFee() external;

  function processSwap(uint256, RequestData calldata) external returns (int256);

  function getProcessParamDeposit(RequestData memory _req, uint256 _protocolAUM)
    external
    view
    returns (
      ProcessParam[] memory processParam,
      uint256 sharesToMint,
      uint256 taxInTRSY,
      uint256 totalUsdDeposit
    );

  // GOVERNANCE ACCESS FUNCTIONS

  function transferAsset(address _asset, address _recipient, uint256 _amount) external;

  function getRebalanceParams(address _asset) external view returns (RebalanceParam memory);

  function updateAssetProxyAmount(address _asset, uint256 _amount) external;
}

File 8 of 12 : IGovernanceModule.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

interface IGovernanceModule {
  function fyde() external view returns (address);

  function proxyImplementation() external view returns (address);

  function proxyBalance(address proxy, address asset) external view returns (uint256);

  function strsyBalance(address _user, address _govToken) external view returns (uint256 balance);

  function assetToStrsy(address _asset) external view returns (address);

  function userToProxy(address _user) external view returns (address);

  function proxyToUser(address _proxy) external view returns (address);

  function isOnGovernanceWhitelist(address _asset) external view returns (bool);

  function getAllGovUsers() external view returns (address[] memory);

  function isAnyNotOnGovWhitelist(address[] calldata _assets) external view returns (address);

  function getUserGTAllowance(uint256 _TRSYAmount, address _token) external view returns (uint256);

  function govDeposit(
    address _depositor,
    address[] calldata _govToken,
    uint256[] calldata _amount,
    uint256[] calldata _amountTRSY,
    uint256 _totalTRSY
  ) external returns (address proxy);

  function govWithdraw(
    address _user,
    address _asset,
    uint256 _amountToWithdraw,
    uint256 _trsyToBurn
  ) external;

  function onStrsyTransfer(address sender, address _recipient) external;

  function unstakeGov(uint256 _amount, address _asset) external;

  function rebalanceProxy(address _proxy, address _asset, address[] memory _usersToRebalance)
    external;
}

File 9 of 12 : IOracle.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

import {AssetInfo} from "../core/Structs.sol";

interface IOracle {
  function getPriceInUSD(address, AssetInfo calldata) external view returns (uint256);

  function getGweiPrice() external view returns (uint256);
}

File 10 of 12 : IRelayer.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

import {RequestData, UserRequest} from "../core/Structs.sol";

interface IRelayer {
  function getNumPendingRequest() external view returns (uint256);

  function getRequest(uint64 idx) external view returns (RequestData memory);

  function requestGovernanceWithdraw(
    UserRequest memory _userRequest,
    address _user,
    uint256 _maxTRSYToPay
  ) external payable;

  function requestWithdraw(UserRequest[] memory _userRequest, uint256 _maxTRSYToPay)
    external
    payable;

  function requestDeposit(
    UserRequest[] memory _userRequest,
    bool _keepGovRights,
    uint256 _minTRSYExpected
  ) external payable;

  function requestSwap(
    address _assetIn,
    uint256 _amountIn,
    address _assetOut,
    uint256 _minAmountOut
  ) external payable;

  function processRequests(uint256 _protocolAUM) external;

  function isQuarantined(address _asset) external view returns (bool);

  function isIncentiveManager(address _incentiveManager) external view returns (bool);

  function MAX_ASSET_TO_REQUEST() external view returns (uint8);

  function actionToGasUsage(bytes32 _actionHash) external view returns (uint256);

  function isUser(address _asset) external view returns (bool);

  function isAnyQuarantined(address[] memory _assets) external view returns (address);
}

File 11 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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.
 */
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].
     */
    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 12 of 12 : 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);
        }
    }
}

Settings
{
  "remappings": [
    "@uniswap/v3-core/=lib/v3-core/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/",
    "synthetix-v3/=lib/synthetix-v3/",
    "v3-core/=lib/v3-core/contracts/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"bool[]","name":"_keepGovAllowed","type":"bool[]"},{"internalType":"address","name":"_fyde","type":"address"},{"internalType":"address","name":"_relayer","type":"address"},{"internalType":"address","name":"_governanceModule","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"uint128","name":"_escrowPeriod","type":"uint128"},{"internalType":"uint128","name":"_freezePeriod","type":"uint128"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"CannotClaimForAsset","type":"error"},{"inputs":[],"name":"ConcentrationsNotSet","type":"error"},{"inputs":[],"name":"DepositsMightStillBeProcessed","type":"error"},{"inputs":[],"name":"EscrowPeriodEnded","type":"error"},{"inputs":[],"name":"FydeDepositCompleted","type":"error"},{"inputs":[],"name":"FydeDepositNotCompleted","type":"error"},{"inputs":[],"name":"InconsistentLengths","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InternalAccountingNotUpdated","type":"error"},{"inputs":[],"name":"InvalidTimePeriod","type":"error"},{"inputs":[],"name":"NotRevoked","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"NotSupportedAsset","type":"error"},{"inputs":[],"name":"OnlyDuringFreeze","type":"error"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"PriceNotAvailable","type":"error"},{"inputs":[],"name":"Revoked","type":"error"},{"inputs":[],"name":"TaxFactorNotZero","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroParameter","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"ClaimedAndRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"indexed":false,"internalType":"uint128[]","name":"govAmounts","type":"uint128[]"}],"name":"ConcentrationAmountsSet","type":"event"},{"anonymous":false,"inputs":[],"name":"EscrowRevoked","type":"event"},{"anonymous":false,"inputs":[],"name":"FydeDeposit","type":"event"},{"anonymous":false,"inputs":[],"name":"InternalAccountingUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipTransferCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"refund","type":"uint256"}],"name":"Refunded","type":"event"},{"inputs":[],"name":"ESCROW_PERIOD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FREEZE_PERIOD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FYDE","outputs":[{"internalType":"contract IFyde","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAS_TO_FORWARD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNANCE_MODULE","outputs":[{"internalType":"contract IGovernanceModule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ASSET_TO_REQUEST","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER","outputs":[{"internalType":"contract IRelayer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"TRSYBalancesPerAsset","outputs":[{"internalType":"uint128","name":"std","type":"uint128"},{"internalType":"uint128","name":"gov","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_user","type":"address[]"}],"name":"addUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"assets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetsTransferred","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"assetsToClaim","type":"address[]"}],"name":"claimAndRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_recipient","type":"address"}],"name":"collectEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"concentrationAmounts","outputs":[{"internalType":"uint128","name":"std","type":"uint128"},{"internalType":"uint128","name":"gov","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"concentrationsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bool","name":"keepGovRights","type":"bool"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositToFyde","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"deposits","outputs":[{"internalType":"uint128","name":"std","type":"uint128"},{"internalType":"uint128","name":"gov","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"finalPercentages","outputs":[{"internalType":"uint128","name":"std","type":"uint128"},{"internalType":"uint128","name":"gov","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fydeDepositCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_asset","type":"address"}],"name":"getEstimatedTrsy","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"get_assets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"internalAccountingUpdated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isUser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"keepGovAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assetsToRefund","type":"address[]"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_user","type":"address[]"}],"name":"removeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"returnStuckFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint128[]","name":"govAmounts","type":"uint128[]"}],"name":"setConcentrationAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedAssets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalBalance","outputs":[{"internalType":"uint128","name":"std","type":"uint128"},{"internalType":"uint128","name":"gov","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalExpectedTrsy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateInternalAccounting","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x6080604052600436106102455760003560e01c8063979edeba11610139578063c68a18a2116100b6578063e5ec13321161007a578063e5ec13321461081b578063e78923aa1461083f578063eb01fb8114610860578063f2fde38b14610894578063f6164a37146108b4578063fa52733a146108d457600080fd5b8063c68a18a214610784578063cdfca7f21461079b578063cf35bdd0146107bb578063e02cec51146107db578063e30c3978146107fb57600080fd5b8063b2e59075116100fd578063b2e59075146106de578063b6549f75146106fe578063bd81579e14610713578063c272def914610743578063c67546c11461076357600080fd5b8063979edeba1461062b5780639ba9bed914610640578063a1fbabf714610675578063a2c70ef81461067d578063aace75f01461069d57600080fd5b80636eacd398116101c75780638178d0841161018b5780638178d0841461051d578063823c82ca1461055e5780638da5cb5b146105aa5780638f601f66146105ca57806392fede001461061657600080fd5b80636eacd39814610462578063769315a4146104a357806379ba5097146104c35780637bf4595e146104d85780637f876b621461050857600080fd5b80634209fff11161020e5780634209fff11461038a57806344bdb041146103ca5780634b62f62f146103ec5780634fcce4361461042057806363d256ce1461044157600080fd5b80626725b81461024a5780631a366bb7146102755780632483e715146102c157806336e45067146102f557806338013f0214610356575b600080fd5b34801561025657600080fd5b5061025f6108ea565b60405161026c9190612f7d565b60405180910390f35b34801561028157600080fd5b506102a97f000000000000000000000000c6f50903a058f3807111619bd4b24ca64b8239e181565b6040516001600160a01b03909116815260200161026c565b3480156102cd57600080fd5b506102a97f00000000000000000000000094194de310b99d3c8a5b8c0768cfce7aef81d9be81565b34801561030157600080fd5b50610336610310366004612fe2565b6009602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b0393841681529290911660208301520161026c565b34801561036257600080fd5b506102a97f0000000000000000000000009b122361e8708be33b785e44fce4d6ca86ab6c5a81565b34801561039657600080fd5b506103ba6103a5366004612fe2565b60056020526000908152604090205460ff1681565b604051901515815260200161026c565b3480156103d657600080fd5b506103ea6103e536600461304b565b61094c565b005b3480156103f857600080fd5b506102a97f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee81565b34801561042c57600080fd5b506001546103ba90600160a81b900460ff1681565b34801561044d57600080fd5b506001546103ba90600160b01b900460ff1681565b34801561046e57600080fd5b5061033661047d366004612fe2565b6008602052600090815260409020546001600160801b0380821691600160801b90041682565b3480156104af57600080fd5b506103ea6104be3660046130b7565b610ced565b3480156104cf57600080fd5b506103ea610d8c565b3480156104e457600080fd5b506103ba6104f3366004612fe2565b60076020526000908152604090205460ff1681565b34801561051457600080fd5b506103ea610e10565b34801561052957600080fd5b50610336610538366004612fe2565b600b602052600090815260409020546001600160801b0380821691600160801b90041682565b34801561056a57600080fd5b506105927f000000000000000000000000000000000000000000000000000000006599034b81565b6040516001600160801b03909116815260200161026c565b3480156105b657600080fd5b506000546102a9906001600160a01b031681565b3480156105d657600080fd5b506103366105e53660046130f9565b600c6020908152600092835260408084209091529082529020546001600160801b0380821691600160801b90041682565b34801561062257600080fd5b506103ea611165565b34801561063757600080fd5b50610592600581565b34801561064c57600080fd5b5061066061065b3660046130f9565b6111d9565b6040805192835260208301919091520161026c565b6103ea61131b565b34801561068957600080fd5b506103ea61069836600461315c565b611e4c565b3480156106a957600080fd5b506103366106b8366004612fe2565b600a602052600090815260409020546001600160801b0380821691600160801b90041682565b3480156106ea57600080fd5b506103ea6106f93660046130b7565b612186565b34801561070a57600080fd5b506103ea612715565b34801561071f57600080fd5b506103ba61072e366004612fe2565b60066020526000908152604090205460ff1681565b34801561074f57600080fd5b506103ea61075e3660046131a5565b612808565b34801561076f57600080fd5b506001546103ba90600160a01b900460ff1681565b34801561079057600080fd5b50610592621e848081565b3480156107a757600080fd5b506103ea6107b63660046130b7565b612846565b3480156107c757600080fd5b506102a96107d63660046131e6565b6128e0565b3480156107e757600080fd5b506103ea6107f63660046130b7565b61290a565b34801561080757600080fd5b506001546102a9906001600160a01b031681565b34801561082757600080fd5b5061083160035481565b60405190815260200161026c565b34801561084b57600080fd5b506001546103ba90600160b81b900460ff1681565b34801561086c57600080fd5b506105927f0000000000000000000000000000000000000000000000000000000065950ecb81565b3480156108a057600080fd5b506103ea6108af366004612fe2565b612a3f565b3480156108c057600080fd5b506103ea6108cf366004612fe2565b612ab5565b3480156108e057600080fd5b5061083160025481565b6060600480548060200260200160405190810160405280929190818152602001828054801561094257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610924575b5050505050905090565b6000546001600160a01b03163314610976576040516282b42960e81b815260040160405180910390fd5b6004548314158061098957506004548114155b156109a75760405163b1f40f7760e01b815260040160405180910390fd5b426001600160801b037f0000000000000000000000000000000000000000000000000000000065950ecb81169082161080610a1357507f000000000000000000000000000000000000000000000000000000006599034b6001600160801b0316816001600160801b0316115b15610a31576040516329fc802760e11b815260040160405180910390fd5b60005b84811015610c9457600060048281548110610a5157610a516131ff565b60009182526020822001546001600160a01b03169150878784818110610a7957610a796131ff565b9050602002016020810190610a8e9190613215565b90506000868685818110610aa457610aa46131ff565b9050602002016020810190610ab99190613215565b90506001600160801b038216158015610ad957506001600160801b038116155b15610ae657505050610c84565b6001600160a01b0383166000908152600860205260409020546001600160801b0380821691600160801b90048116908416821080610b355750806001600160801b0316836001600160801b0316115b15610b635760405163112fed8b60e31b81526001600160a01b03861660048201526024015b60405180910390fd5b6001600160801b03841615610bf257816001600160801b0316670de0b6b3a7640000856001600160801b0316610b999190613246565b610ba3919061325d565b6001600160a01b0386166000908152600a6020908152604080832080546001600160801b03199081166001600160801b0396871617909155600990925290912080549091169186169190911790555b6001600160801b03831615610c7e57806001600160801b0316670de0b6b3a7640000846001600160801b0316610c289190613246565b610c32919061325d565b6001600160a01b0386166000908152600a6020908152604080832080546001600160801b03908116600160801b9682168702179091556009909252909120805482169186169092021790555b50505050505b610c8d8161327f565b9050610a34565b506001805460ff60a01b1916600160a01b1790556040517fc885e67a5ab806d06599567b2c4d083854da530e10250730e8368db39b4b877290610cde9087908790879087906132df565b60405180910390a15050505050565b6000546001600160a01b03163314610d17576040516282b42960e81b815260040160405180910390fd5b60005b81811015610d8757600060056000858585818110610d3a57610d3a6131ff565b9050602002016020810190610d4f9190612fe2565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610d808161327f565b9050610d1a565b505050565b6001546001600160a01b03163314610db6576040516282b42960e81b815260040160405180910390fd5b60008054600180546001600160a01b038082166001600160a01b031980861682178755909216909255604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600154600160a81b900460ff16610e3a5760405163463c6fbd60e01b815260040160405180910390fd5b7f00000000000000000000000094194de310b99d3c8a5b8c0768cfce7aef81d9be6001600160a01b031663708968c16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebc9190613306565b15610eda57604051631adc0a4560e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000907f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee6001600160a01b0316906370a0823190602401602060405180830381865afa158015610f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f659190613306565b90506000600354600014610f9557600354610f8883670de0b6b3a7640000613246565b610f92919061325d565b90505b60005b60045481101561112457600060048281548110610fb757610fb76131ff565b60009182526020808320909101546001600160a01b0316808352600b9091526040822054909250670de0b6b3a764000090610ffc9086906001600160801b0316613246565b611006919061325d565b6001600160a01b0383166000908152600b6020908152604080832080546001600160801b0319166001600160801b038616179055600790915290205490915060ff16156111115760405163539dc25160e11b81523060048201526001600160a01b0383811660248301527f000000000000000000000000c6f50903a058f3807111619bd4b24ca64b8239e1169063a73b84a290604401602060405180830381865afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd9190613306565b6001600160a01b0383166000908152600b6020526040902080546001600160801b03928316600160801b0292169190911790555b50508061111d9061327f565b9050610f98565b506001805460ff60b81b1916600160b81b1790556040517f9e552eea18086580e2bb8ecee4ccbf2e71a66167d8fe4e5abd58a5f35af61cd090600090a15050565b6000546001600160a01b0316331461118f576040516282b42960e81b815260040160405180910390fd5b6001546040516001600160a01b03909116907f6ecd4842251bedd053b09547c0fabaab9ec98506ebf24469e8dd5560412ed37f90600090a2600180546001600160a01b0319169055565b6001600160a01b0380821660008181526008602090815260408083208151808301835290546001600160801b038082168352600160801b91829004811683860152868652600b85528386208451808601865290548083168252839004821681870152978a168652600c85528386209686529584528285208351808501909452548087168452048516928201929092528451929485949293909285911681036112825760006112ab565b8351825184516001600160801b03928316926112a19281169116613246565b6112ab919061325d565b9050600083602001516001600160801b03166000036112cb576000611309565b84602001516001600160801b031683602001516001600160801b031685602001516001600160801b03166112ff9190613246565b611309919061325d565b919650909450505050505b9250929050565b7f000000000000000000000000000000000000000000000000000000006599034b6001600160801b0316426001600160801b03161161136d576040516329fc802760e11b815260040160405180910390fd5b600154600160a01b900460ff16611397576040516349107c6b60e01b815260040160405180910390fd5b600154600160a81b900460ff16156113c257604051637926658760e01b815260040160405180910390fd5b600154600160b01b900460ff16156113ed576040516344825a4b60e01b815260040160405180910390fd5b60007f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee6001600160a01b031663d7691f8f6040518163ffffffff1660e01b815260040160c060405180830381865afa15801561144d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611471919061334e565b505050509150508068ffffffffffffffffff166000146114a4576040516306dd5d2560e01b815260040160405180910390fd5b600060048054806020026020016040519081016040528092919081815260200182805480156114fc57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116114de575b505050505090506000600254825161151491906133c4565b905060058110611525576005611527565b805b9050600080600060025490505b8360025461154291906133d7565b811015611653576007600086838151811061155f5761155f6131ff565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1680156115da5750600960008683815181106115a3576115a36131ff565b6020908102919091018101516001600160a01b0316825281019190915260400160002054600160801b90046001600160801b031615155b156115ed576115ea6001836133d7565b91505b60096000868381518110611603576116036131ff565b6020908102919091018101516001600160a01b03168252810191909152604001600020546001600160801b031615611643576116406001846133d7565b92505b61164c8161327f565b9050611534565b5060008267ffffffffffffffff81111561166f5761166f6133ea565b6040519080825280602002602001820160405280156116b457816020015b604080518082019091526000808252602082015281526020019060019003908161168d5790505b50905060008267ffffffffffffffff8111156116d2576116d26133ea565b60405190808252806020026020018201604052801561171757816020015b60408051808201909152600080825260208201528152602001906001900390816116f05790505b50905060008060008060025490505b8860025461173491906133d7565b811015611c11576000600960008c8481518110611753576117536131ff565b6020908102919091018101516001600160a01b03168252810191909152604001600020546001600160801b031615611a0a578a8281518110611797576117976131ff565b60200260200101518786815181106117b1576117b16131ff565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050600960008c84815181106117eb576117eb6131ff565b6020908102919091018101516001600160a01b031682528101919091526040016000205487516001600160801b039091169088908790811061182f5761182f6131ff565b60200260200101516020018181525050868581518110611851576118516131ff565b6020026020010151602001518161186891906133d7565b905060007f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee6001600160a01b03166382c0ab218988815181106118ad576118ad6131ff565b6020026020010151600001518a89815181106118cb576118cb6131ff565b6020026020010151602001516040518363ffffffff1660e01b81526004016119089291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa158015611925573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119499190613306565b905080600003611996578b8381518110611965576119656131ff565b602002602001015160405163e5f633bf60e01b8152600401610b5a91906001600160a01b0391909116815260200190565b6119a081856133d7565b935080600b60008a89815181106119b9576119b96131ff565b602090810291909101810151516001600160a01b0316825281019190915260400160002080546001600160801b0319166001600160801b0392909216919091179055611a066001876133d7565b9550505b600760008c8481518110611a2057611a206131ff565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff168015611a9b5750600960008c8481518110611a6457611a646131ff565b6020908102919091018101516001600160a01b0316825281019190915260400160002054600160801b90046001600160801b031615155b15611ba9578a8281518110611ab257611ab26131ff565b6020026020010151868581518110611acc57611acc6131ff565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050600960008c8481518110611b0657611b066131ff565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000160109054906101000a90046001600160801b03166001600160801b0316868581518110611b6057611b606131ff565b60200260200101516020018181525050858481518110611b8257611b826131ff565b60200260200101516020015181611b9991906133d7565b9050611ba66001856133d7565b93505b611c007f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee828d8581518110611be057611be06131ff565b60200260200101516001600160a01b0316612b3f9092919063ffffffff16565b50611c0a8161327f565b9050611726565b508060036000828254611c2491906133d7565b925050819055506000621e84806001600160801b03167f0000000000000000000000009b122361e8708be33b785e44fce4d6ca86ab6c5a6001600160a01b031663e3a031bf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc9190613306565b611cc69190613246565b90508715611d54576040516332758a4f60e21b81526001600160a01b037f00000000000000000000000094194de310b99d3c8a5b8c0768cfce7aef81d9be169063c9d6293c908390611d21908a906000908190600401613400565b6000604051808303818588803b158015611d3a57600080fd5b505af1158015611d4e573d6000803e3d6000fd5b50505050505b8615611de1576040516332758a4f60e21b81526001600160a01b037f00000000000000000000000094194de310b99d3c8a5b8c0768cfce7aef81d9be169063c9d6293c908390611dae908990600190600090600401613400565b6000604051808303818588803b158015611dc757600080fd5b505af1158015611ddb573d6000803e3d6000fd5b50505050505b8860026000828254611df391906133d7565b9091555050895160025403611e3f576001805460ff60a81b1916600160a81b1790556040517fd6538235da08d97cc9982bb595ff5afec87439ef60cedecd8027b3d98ecd7c9f90600090a15b5050505050505050505050565b6000805260056020527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc5460ff16158015611e9757503360009081526005602052604090205460ff16155b15611eb4576040516282b42960e81b815260040160405180910390fd5b816001600160801b0316600003611ede5760405163339d6ef160e21b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000065950ecb6001600160801b0316426001600160801b03161115611f315760405163ad66ce3560e01b815260040160405180910390fd5b808015611f5757506001600160a01b03831660009081526007602052604090205460ff16155b80611f7b57506001600160a01b03831660009081526006602052604090205460ff16155b15611fa45760405163c89009d160e01b81526001600160a01b0384166004820152602401610b5a565b611fc26001600160a01b03841633306001600160801b038616612c07565b801561208c57336000908152600c602090815260408083206001600160a01b03871684529091529020805483919060109061200e908490600160801b90046001600160801b0316613461565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b038516600090815260086020526040902080548593509091601091612063918591600160801b900416613461565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550612138565b336000908152600c602090815260408083206001600160a01b0387168452909152812080548492906120c89084906001600160801b0316613461565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b03851660009081526008602052604081208054869450909261211391859116613461565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505b6040516001600160801b03831681526001600160a01b0384169033907f01527be533d184d44e3111afa7800fa60ced6e1b44bd025f8b457deb8ce0ce359060200160405180910390a3505050565b600154600160b01b900460ff16156121b1576040516344825a4b60e01b815260040160405180910390fd5b600154600160a81b900460ff166121db5760405163463c6fbd60e01b815260040160405180910390fd5b600154600160b81b900460ff1661220857604051600162da483b60e01b0319815260040160405180910390fd5b6000805b82811015612652576000848483818110612228576122286131ff565b905060200201602081019061223d9190612fe2565b336000908152600c602090815260408083206001600160a01b03851684529091528120549192506001600160801b0380831692600160801b9004169061228382846133d7565b9050806000036122b1576040516395c12ac560e01b81526001600160a01b0385166004820152602401610b5a565b8083156123a757336000908152600c602090815260408083206001600160a01b0389168452825280832080546001600160801b0319169055600a909152812054670de0b6b3a76400009061230e906001600160801b031687613246565b612318919061325d565b6001600160a01b038716600090815260096020526040812054919250906001600160801b03161561238c576001600160a01b038716600090815260096020908152604080832054600b909252909120546001600160801b039182169161237f911684613246565b612389919061325d565b90505b612396818a6133d7565b98506123a282846133c4565b925050505b82156125a257336000908152600c602090815260408083206001600160a01b0389168452825280832080546001600160801b03908116909155600a909252822054670de0b6b3a76400009161240491600160801b90041686613246565b61240e919061325d565b6001600160a01b03871660009081526009602052604081205491925090600160801b90046001600160801b031615612492576001600160a01b038716600090815260096020908152604080832054600b909252909120546001600160801b03600160801b9283900481169261248592041684613246565b61248f919061325d565b90505b61249c82846133c4565b60405163074caa8760e11b81526001600160a01b0389811660048301529194507f000000000000000000000000c6f50903a058f3807111619bd4b24ca64b8239e190911690630e99550e90602401602060405180830381865afa158015612507573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252b9190613488565b60405163a9059cbb60e01b8152336004820152602481018390526001600160a01b03919091169063a9059cbb906044016020604051808303816000875af115801561257a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259e91906134a5565b5050505b801561263c576040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa1580156125ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126139190613306565b90508181116126225780612624565b815b915061263a6001600160a01b0387163384612c3f565b505b50505050508061264b9061327f565b905061220c565b5060405163a9059cbb60e01b8152336004820152602481018290527f00000000000000000000000087cc45fff5c0933bb6af6bae7fc013b7ec7df2ee6001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156126c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e491906134a5565b5060405133907fcb250587370f33927d55e32e7179848ac061ee566b09bec555e9969b40e5dcd990600090a2505050565b6000546001600160a01b0316331461273f576040516282b42960e81b815260040160405180910390fd5b426001600160801b037f0000000000000000000000000000000000000000000000000000000065950ecb811690821610806127ab57507f000000000000000000000000000000000000000000000000000000006599034b6001600160801b0316816001600160801b0316115b156127c957604051637297e6a160e11b815260040160405180910390fd5b6001805460ff60b01b1916600160b01b1790556040517f5aadfea8cbffad0010bfde113179e0294f86136149cd37226668dd2ebdab377690600090a150565b6000546001600160a01b03163314612832576040516282b42960e81b815260040160405180910390fd5b610d876001600160a01b0384168383612c3f565b6000546001600160a01b03163314612870576040516282b42960e81b815260040160405180910390fd5b60005b81811015610d8757600160056000858585818110612893576128936131ff565b90506020020160208101906128a89190612fe2565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556128d98161327f565b9050612873565b600481815481106128f057600080fd5b6000918252602090912001546001600160a01b0316905081565b600154600160b01b900460ff16612934576040516339fbd58f60e11b815260040160405180910390fd5b60005b81811015610d87576000838383818110612953576129536131ff565b90506020020160208101906129689190612fe2565b336000908152600c602090815260408083206001600160a01b0385168452909152812054919250906129ac906001600160801b03600160801b820481169116613461565b336000818152600c602090815260408083206001600160a01b03881680855292528220919091556001600160801b039290921692506129ec919083612c3f565b6040518181526001600160a01b0383169033907fec1e5ed733e00f1a00915d56caef57b4f52312dde4f9b3165f213319a0da156b9060200160405180910390a3505080612a389061327f565b9050612937565b6000546001600160a01b03163314612a69576040516282b42960e81b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270090600090a350565b6000546001600160a01b03163314612adf576040516282b42960e81b815260040160405180910390fd5b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114612b2c576040519150601f19603f3d011682016040523d82523d6000602084013e612b31565b606091505b5050905080610d8757600080fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612b908482612c6f565b612c01576040516001600160a01b038416602482015260006044820152612bf790859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d18565b612c018482612d18565b50505050565b6040516001600160a01b0380851660248301528316604482015260648101829052612c019085906323b872dd60e01b90608401612bc0565b6040516001600160a01b038316602482015260448101829052610d8790849063a9059cbb60e01b90606401612bc0565b6000806000846001600160a01b031684604051612c8c91906134e6565b6000604051808303816000865af19150503d8060008114612cc9576040519150601f19603f3d011682016040523d82523d6000602084013e612cce565b606091505b5091509150818015612cf8575080511580612cf8575080806020019051810190612cf891906134a5565b8015612d0d57506001600160a01b0385163b15155b925050505b92915050565b6000612d6d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ded9092919063ffffffff16565b9050805160001480612d8e575080806020019051810190612d8e91906134a5565b610d875760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b5a565b6060612dfc8484600085612e04565b949350505050565b606082471015612e655760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b5a565b600080866001600160a01b03168587604051612e8191906134e6565b60006040518083038185875af1925050503d8060008114612ebe576040519150601f19603f3d011682016040523d82523d6000602084013e612ec3565b606091505b5091509150612ed487838387612edf565b979650505050505050565b60608315612f4e578251600003612f47576001600160a01b0385163b612f475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b5a565b5081612dfc565b612dfc8383815115612f635781518083602001fd5b8060405162461bcd60e51b8152600401610b5a9190613502565b6020808252825182820181905260009190848201906040850190845b81811015612fbe5783516001600160a01b031683529284019291840191600101612f99565b50909695505050505050565b6001600160a01b0381168114612fdf57600080fd5b50565b600060208284031215612ff457600080fd5b8135612fff81612fca565b9392505050565b60008083601f84011261301857600080fd5b50813567ffffffffffffffff81111561303057600080fd5b6020830191508360208260051b850101111561131457600080fd5b6000806000806040858703121561306157600080fd5b843567ffffffffffffffff8082111561307957600080fd5b61308588838901613006565b9096509450602087013591508082111561309e57600080fd5b506130ab87828801613006565b95989497509550505050565b600080602083850312156130ca57600080fd5b823567ffffffffffffffff8111156130e157600080fd5b6130ed85828601613006565b90969095509350505050565b6000806040838503121561310c57600080fd5b823561311781612fca565b9150602083013561312781612fca565b809150509250929050565b80356001600160801b038116811461314957600080fd5b919050565b8015158114612fdf57600080fd5b60008060006060848603121561317157600080fd5b833561317c81612fca565b925061318a60208501613132565b9150604084013561319a8161314e565b809150509250925092565b6000806000606084860312156131ba57600080fd5b83356131c581612fca565b925060208401356131d581612fca565b929592945050506040919091013590565b6000602082840312156131f857600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561322757600080fd5b612fff82613132565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417612d1257612d12613230565b60008261327a57634e487b7160e01b600052601260045260246000fd5b500490565b60006001820161329157613291613230565b5060010190565b8183526000602080850194508260005b858110156132d4576001600160801b036132c183613132565b16875295820195908201906001016132a8565b509495945050505050565b6040815260006132f3604083018688613298565b8281036020840152612ed4818587613298565b60006020828403121561331857600080fd5b5051919050565b805168ffffffffffffffffff8116811461314957600080fd5b805165ffffffffffff8116811461314957600080fd5b60008060008060008060c0878903121561336757600080fd5b865195506133776020880161331f565b9450604087015161ffff8116811461338e57600080fd5b935061339c60608801613338565b92506133aa6080880161331f565b91506133b860a08801613338565b90509295509295509295565b81810381811115612d1257612d12613230565b80820180821115612d1257612d12613230565b634e487b7160e01b600052604160045260246000fd5b606080825284519082018190526000906020906080840190828801845b8281101561344d57815180516001600160a01b03168552850151858501526040909301929084019060010161341d565b505050941515908301525060400152919050565b6001600160801b0381811683821601908082111561348157613481613230565b5092915050565b60006020828403121561349a57600080fd5b8151612fff81612fca565b6000602082840312156134b757600080fd5b8151612fff8161314e565b60005b838110156134dd5781810151838201526020016134c5565b50506000910152565b600082516134f88184602087016134c2565b9190910192915050565b60208152600082518060208401526135218160408501602087016134c2565b601f01601f1916919091016040019291505056fea2646970667358221220ccb2d0999714f6b4361d1b87289993f305ae8f3fe67878d408d1975b9ee60d3164736f6c63430008130033

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  ]
[ 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.