IFdcRequestFeeConfigurations
Interface for managing FDC request fee configuration.
Sourced from IFdcRequestFeeConfigurations.sol
on GitHub.
Overview
The IFdcRequestFeeConfigurations interface provides functionality for managing and retrieving fees associated with attestation requests in the Flare Data Connector (FDC) system. It allows for querying the base fee required for specific attestation requests.
Functions
getRequestFee
Method to get the base fee for an attestation request. It reverts if the request is not supported.
function getRequestFee(
bytes _data
) external view returns (
uint256
);
Parameters
_data
: ABI encoded attestation request
Returns
uint256
: The base fee required for the specified attestation request
Events
TypeAndSourceFeeRemoved
Emitted when a fee configuration for a specific attestation type and source is removed.
event TypeAndSourceFeeRemoved(
bytes32 attestationType,
bytes32 source
)
Parameters
attestationType
: The type of attestationsource
: The source identifier
TypeAndSourceFeeSet
Emitted when a fee configuration for a specific attestation type and source is set.
event TypeAndSourceFeeSet(
bytes32 attestationType,
bytes32 source,
uint256 fee
)
Parameters
attestationType
: The type of attestationsource
: The source identifierfee
: The fee amount set for the attestation type and source
Usage Example
FeeChecker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import {ContractRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ContractRegistry.sol";
import {IFdcHub} from "@flarenetwork/flare-periphery-contracts/coston2/IFdcHub.sol";
import {IFdcRequestFeeConfigurations} from "@flarenetwork/flare-periphery-contracts/coston2/IFdcRequestFeeConfigurations.sol";
contract FeeChecker {
function getRequestFee(
bytes calldata _attestationData
) external view returns (uint256) {
// Use the registry to find the FdcHub
IFdcHub fdcHub = ContractRegistry.getFdcHub();
// From the FdcHub, get the current fee configuration contract
IFdcRequestFeeConfigurations feeConfigs = fdcHub
.fdcRequestFeeConfigurations();
// Return the fee for the given request data
return feeConfigs.getRequestFee(_attestationData);
}
}