BalancerMaxis / multisig-ops

17 stars 27 forks source link

Chainlink gas station + monitoring for Chainlink Automation #1120

Closed gosuto-inzasheru closed 3 months ago

gosuto-inzasheru commented 4 months ago

https://docs.google.com/spreadsheets/d/1llp09QrN1cdMTMQP9rLplYfpaiFIJ-Hn3C4z-07aFQE/

gosuto-inzasheru commented 4 months ago
  /**
   * @dev calculates LINK paid for gas spent plus a configure premium percentage
   */
  function _calculatePaymentAmount(
    uint256 gasLimit,
    uint256 gasWei,
    uint256 linkEth
  ) private view returns (uint96 payment) {
    uint256 weiForGas = gasWei * (gasLimit + REGISTRY_GAS_OVERHEAD);
    uint256 premium = PPB_BASE + s_storage.paymentPremiumPPB;
    uint256 total = ((weiForGas * (1e9) * (premium)) / (linkEth)) + (uint256(s_storage.flatFeeMicroLink) * (1e12));
    if (total > LINK_TOTAL_SUPPLY) revert PaymentGreaterThanAllLINK();
    return uint96(total); // LINK_TOTAL_SUPPLY < UINT96_MAX
  }
gosuto-inzasheru commented 3 months ago

moved remaining checklist items to: