Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ library SecurityLib {
if (
!s.api_payers.contains(caller) &&
caller != LibDiamond.contractOwner() &&
caller != s.adminApiPayerAccount
caller != s.adminApiPayerAccount &&
caller != s.configOperator
Comment on lines 133 to +137
) {
revert AppStorage.OnlyApiPayerOrOwner(caller);
}
Expand All @@ -158,20 +159,22 @@ library SecurityLib {
if (
!s.api_payers.contains(caller) &&
caller != LibDiamond.contractOwner() &&
caller != s.adminApiPayerAccount
caller != s.adminApiPayerAccount &&
caller != s.configOperator
) {
revert AppStorage.OnlyApiPayerOrOwner(caller);
}
}

/// @notice Non-reverting predicate: true if caller is an api payer, the
/// diamond owner, or the admin api payer account.
/// diamond owner, the admin api payer account, or the config operator.
function isApiPayerOrOwner(address caller) internal view returns (bool) {
AppStorage.AccountConfigStorage storage s = AppStorage.getStorage();
return
s.api_payers.contains(caller) ||
caller == LibDiamond.contractOwner() ||
caller == s.adminApiPayerAccount;
caller == s.adminApiPayerAccount ||
caller == s.configOperator;
}

/// @notice Resolve any API key hash (master or usage) to the master account hash.
Expand Down
26 changes: 26 additions & 0 deletions lit-static/dapps/monitor/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ const ACCOUNT_CONFIG_VIEW_ABI = [
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'configOperator',
outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
// ERC-173 owner() — served by the diamond's OwnershipFacet.
inputs: [],
Expand Down Expand Up @@ -636,6 +643,8 @@ async function fetchContractValues() {
setValue('val-contract-owner', '…', false);
setValue('val-pricing-operator', '…', false);
setValue('val-pricing-operator-balance', '', false);
setValue('val-config-operator', '…', false);
setValue('val-config-operator-balance', '', false);
setValue('val-admin-api-payer', '…', false);
setValue('val-admin-api-payer-balance', '', false);
setValue('val-payer-count', '…', false);
Expand All @@ -660,6 +669,23 @@ async function fetchContractValues() {
setValue('val-pricing-operator', pricingOperator ?? '—', !pricingOperator);
setValue('val-admin-api-payer', adminApiPayer ?? '—', !adminApiPayer);

// configOperator() may be absent on older diamonds — fetch separately so a
// missing selector doesn't blank the rest of the card.
contract.configOperator()
.then(addr => {
setValue('val-config-operator', addr ?? '—', !addr);
if (addr && addr !== ethers.ZeroAddress) {
provider.getBalance(addr).then(wei => {
const node = el('val-config-operator-balance');
if (node) {
node.textContent = parseFloat(ethers.formatEther(wei)).toFixed(6) + ' ETH';
node.style.color = '';
}
}).catch(() => {});
}
})
.catch(() => setValue('val-config-operator', '—', true));

// owner() lives on the OwnershipFacet — fetch it separately so a diamond
// deployed without that facet doesn't blank the rest of the card.
contract.owner()
Expand Down
5 changes: 5 additions & 0 deletions lit-static/dapps/monitor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,11 @@ <h2>Contract values</h2>
><span class="result-value" id="val-pricing-operator">—</span
><span class="result-value" id="val-pricing-operator-balance" style="color:var(--muted);margin-left:auto"></span>
</div>
<div class="result-row">
<span class="result-label">config operator</span
><span class="result-value" id="val-config-operator">—</span
><span class="result-value" id="val-config-operator-balance" style="color:var(--muted);margin-left:auto"></span>
</div>
<div class="result-row">
<span class="result-label">admin Payer</span
><span class="result-value" id="val-admin-api-payer">—</span
Expand Down
Loading