爆发 BaofaBaofa Documentation
中文 Open the App

Fees Reference

The generated interface of BaofaFees, the module that holds fee rates, sharing configurations, social and donation accounts and buyback sweeps.

Updated 2026-11-04Contracts baofa-rewrite-2026-11-04-a727bfe

Generated from the compiled ABI: BaofaFees.json · 62 function · 29 events · 61 errors

BaofaFees is read by the core on every trade for the applicable rates, and called directly by creators and their shareholders for fee sharing. It also holds the social fee accounts, donation accounts and the buyback sweep. The tables below are generated from the deployment package's ABI.

Common Flows#

Flow Calls, in order
Split the creator share createFeeSharingConfig(coin) then updateFeeShares(coin, next) once; anyone calls distributeCreatorFees(coin) on the core to pay out
Read the rates for a trade getFeesWithQuoteClass(consumer, isCanonical, marketCap, quoteClass); feeConfig and the tier reads expose the tables themselves
Social fee claim the social claim authority calls claimSocialFee(key, quoteAsset, recipient) for a verified identity
Donation account createDonationAccount(coin, configId), fundDonation(coin, configId, units), crankDonation(coin, configId)

See Creator Fees and Sharing for the rules each flow follows.

Write Functions#

Function Inputs Returns Selector
acceptOwnership none none 0x79ba5097
adminCtoSharingConfig address coin, address newAdminOrZero bool reset 0xd8619c87
attachAmmModule address ammModule none 0x38b86d8b
claimSocialFee bytes32 key, address quoteAsset, address recipient uint64 amount 0x6288e2a0
configureFeesModules address coreModule, address ammModule, address relayModule, address frenzyModule, address wrappedNative none 0x7a595ec7
crankDonation address coin, bytes32 configId uint64 amount 0x4505168c
createDonationAccount address coin, bytes32 configId bytes32 key 0xb41f9dd4
createFeeSharingConfig address coin none 0x8bb80284
createSocialFeeAccount string userId, uint8 platform bytes32 key 0x17035fcf
creditBuyback uint8 index, address quoteAsset, uint64 amount none 0x06b9344c
creditFrenzyFee uint8 index, address quoteAsset, uint64 amount none 0x97333a76
diamondCut (address,uint8,bytes4[])[] _diamondCut, address _init, bytes _calldata none 0x1f931c1c
fundDonation (payable) address coin, bytes32 configId, uint64 units none 0x4dd49d7a
fundReferral (payable) address user, address quoteAsset, uint64 units none 0x7a84d668
fundSocialFee (payable) bytes32 key, address quoteAsset, uint64 units none 0x59abecab
initializeBuyback uint8 index none 0x9165cd1a
initializeFeeConfig uint8 consumer none 0x060fb485
initializeFeeProgramGlobal address socialClaimAuthority, uint8 disableFlags, uint64 claimRateLimit none 0x1345daec
renounceOwnership none none 0x715018a6
rescueNative address to none 0xc8df4230
setClaimRateLimit uint64 claimRateLimit none 0x8122e7cb
setDisableFlags uint8 disableFlags none 0xc44d69c3
setExoticFlatFees uint8 consumer, (uint64,uint64,uint64) exoticFlatFees none 0x06114d45
setFeeAuthority address newAuthority none 0x8a957929
setSocialClaimAuthority address socialClaimAuthority none 0x1def7443
sweepBuyback uint8 index, address quoteAsset, address destination uint64 amount 0x9cc2c930
transferOwnership address _newOwner none 0xf2fde38b
updateBuybackAuthority uint8 index, address newAuthority none 0xf151820d
updateBuybackClaimRateLimit uint8 index, int64 claimRateLimit none 0x7b7b42f9
updateFeeAdmin uint8 consumer, address newAdmin none 0x42de7b83
updateFeeConfig uint8 consumer, (uint128,(uint64,uint64,uint64))[] feeTiers, (uint64,uint64,uint64) flatFees none 0xcfebd9c4
updateFeeShares address coin, (address,uint16)[] next none 0xcd1d8fa8
updateStableFeeConfig uint8 consumer, (uint128,(uint64,uint64,uint64))[] stableFeeTiers none 0x1a32bd04
upsertFeeTiers uint8 consumer, (uint128,(uint64,uint64,uint64))[] feeTiers, uint8 offset none 0xb3884653
upsertStableFeeTiers uint8 consumer, (uint128,(uint64,uint64,uint64))[] stableFeeTiers, uint8 offset none 0xf3eaa9b5
withdrawFrenzyFee uint8 index, address quoteAsset, uint64 amount, address to none 0x808b6751
withdrawReferral address quoteAsset uint64 amount 0xf705ca75

Read Functions#

Function Inputs Returns Selector
buybackBalance uint8 index, address quoteAsset uint64 0xb77918c7
buybackVault uint8 index (bool,address,uint64,uint64,uint64,int64,int64) 0xfea5632d
donationAccount address coin, bytes32 configId (uint8,bytes32,address,address,address,uint64,int64) 0x9f724157
donationBalance address coin, bytes32 configId uint64 0x913d2ccd
facetAddress bytes4 _functionSelector address 0xcdffacc6
facetAddresses none address[] 0x52ef6b2c
facetFunctionSelectors address _facet bytes4[] 0xadfca15e
facets none (address,bytes4[])[] facets_ 0x7a0ed627
feeConfig uint8 consumer bool initialized, address admin, ((uint64,uint64,uint64),(uint128,(uint64,uint64,uint64))[],(uint128,(uint64,uint64,uint64))[],(uint64,uint64,uint64)) config 0x798cfec8
feeProgramGlobal none (bool,address,uint8,address,uint64) 0x596217dc
feesModules none address coreModule, address ammModule, address relayModule, address frenzyModule, address wrappedNative 0x562a4193
frenzyFeeBalance uint8 index, address quoteAsset uint64 0xcfe76a9c
getFees uint8 consumer, bool isCanonical, uint128 marketCap, bool isNewQuote (uint64,uint64,uint64) 0x4378b903
getFeesWithQuoteClass uint8 consumer, bool isCanonical, uint128 marketCap, uint8 quoteClass (uint64,uint64,uint64) 0xb582c914
owner none address 0x8da5cb5b
pendingOwner none address 0xe30c3978
referralBalance address user, address quoteAsset uint64 0x5dbcc60b
sharingActive address coin bool 0x79b7e8f4
sharingAdmin address coin address 0x3d98ebd2
sharingConfig address coin (uint8,uint8,address,bool,(address,uint16)[]) 0xffd1a3b7
sharingConfigExists address coin bool 0x8bcbd8e2
sharingShareholders address coin (address,uint16)[] 0x0c172951
socialBalance bytes32 key, address quoteAsset uint64 0x760d5995
socialFeeAccount bytes32 key (uint8,uint8,string,uint64,uint64,uint64) 0xd9a9c524
supportsInterface bytes4 _interfaceId bool 0x01ffc9a7

Events#

Name Parameters Topic 0
CreateFeeSharingConfigEvent uint64 timestamp, address indexed coin, address bondingCurve, address pool, address sharingConfig, address indexed admin, (address,uint16)[] initialShareholders, uint8 status 0x8442f81b35844e26a02991adc200310762be672b5547701120ddab4cb5abd54e
DiamondCut (address,uint8,bytes4[])[] _diamondCut, address _init, bytes _calldata 0x8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673
DonationAccountCranked uint64 timestamp, address indexed signer, bytes32 indexed donationAccount, bytes32 configId, address indexed coin, address quoteAsset, address creator, uint64 amount 0x3efc2295db606f84acb8c8cf6c24fd5cfdcd3ac478b9eb763f101015825d40d4
DonationAccountCreated uint64 timestamp, address indexed createdBy, bytes32 indexed donationAccount, bytes32 configId, address indexed coin, address quoteAsset, address creator 0x4efbc7ea740ae624d4216495e7ea4e2b21e3bdc99aa8d65d30b8c8dedac89819
FeesAmmModuleAttached address ammModule 0x91ba91c5853b7f0162e974ce5d735d7998247621e3ab4a72d576d4bc5b9d9dc5
FeesModulesConfigured address coreModule, address ammModule, address relayModule, address frenzyModule, address wrappedNative 0x149871c94609e436ab7121ede47d6910c963bca1c51705d71f81766048930c39
InitializeFeeConfigEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig 0xc011dc44ebe5476366dce4d5b21c20e02c4b7aff9915c89f9cc278dc3e8da211
InitializeFeeProgramGlobalEvent uint64 timestamp, address authority, address socialClaimAuthority, uint8 disableFlags, uint64 claimRateLimit 0xce1485a94b8333e8cdbc5b866944971befab5e7148304f054a54c1f1e5cd74c5
LedgerFunded uint64 timestamp, bytes32 indexed key, address indexed quoteAsset, uint64 amount, address indexed funder 0x2dee31f6aec4ef4c77afc69d717845495b2164189ad3e5dd9473449a2a45dbce
NativePayoutWrapped address indexed recipient, uint256 amount 0xbeddea0f11ec7dfe2b2f45fe56fb380da6a6597eff6e3e57d9df9cf8cb0c0917
NativeRescued address indexed to, uint256 amount 0xe3eb98b7fe2a0c1d490b92af73eeae611e9b00ab3c3f70b20bd7bb43f67a0f43
OwnershipTransferred address indexed previousOwner, address indexed newOwner 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
OwnershipTransferStarted address indexed previousOwner, address indexed newOwner 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700
ResetFeeSharingConfigEvent uint64 timestamp, address indexed coin, address sharingConfig, address indexed oldAdmin, (address,uint16)[] oldShareholders, address indexed newAdmin, (address,uint16)[] newShareholders, uint8 oldVersion, uint8 newVersion 0x7ad59f8a288e0f0e313f5034a3018c0fa4f140e82fe6b6ac2834ec4650fc7777
SetAuthorityEvent uint64 timestamp, address indexed oldAuthority, address indexed newAuthority 0xd341a8d378bb8130c56f5b4ae35c11afe1a66541b39ce5e5d7a5bd64cca8a58f
SetClaimRateLimitEvent uint64 timestamp, uint64 claimRateLimit 0x4287d8f0f2bba620c01c67d0cbabd986fcccb309e042f55780466b674a3611a3
SetDisableFlagsEvent uint64 timestamp, uint8 disableFlags 0x738a4da57ccaab5a2dba7ffa5f8fbb06babc4c9aaa997e1790349e1f2cd99fe2
SetExoticFlatFeesEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig, (uint64,uint64,uint64) exoticFlatFees 0x8f74c149ff024de68596af7f63ffb8dc2b125fe85ad451d7d2729482c7d3b3df
SetSocialClaimAuthorityEvent uint64 timestamp, address socialClaimAuthority 0x46d9154f5ad5a186ffd722effb566e90838b0cf2539443d18b3d3305a45a918f
SocialFeeAccountClaimed bytes32 indexed socialFeeAccount, address indexed recipient, (uint64,string,uint8,address,uint64,uint64,uint64,uint64,uint64,address,uint64) data 0xdfe71537310e456bba65043e67fb0c9a05946e6af2b73ec317f457d5d0586e95
SocialFeeAccountCreated uint64 timestamp, string userId, uint8 platform, bytes32 indexed socialFeeAccount, address indexed createdBy 0x2b4bfd3e1fdd52eda2d9283b9aa22518075ddecb010ea2aecc5be03b46611568
SweepBuybackEvent uint64 timestamp, uint8 indexed index, uint64 nativeAmount, uint64 tokenAmount, address indexed destination, address indexed quoteAsset 0x34f341542a58c23b85173bf8a79219b3c25c93b1ae06797de9a51294d5005edf
UpdateAdminEvent uint64 timestamp, address indexed oldAdmin, address indexed newAdmin 0x9de9c772cd749f2d8fc7bd7c1c5db3f5dcf9ad6a6f850e9c5b2dc21af65f3ff9
UpdateFeeConfigEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig, (uint128,(uint64,uint64,uint64))[] feeTiers, (uint64,uint64,uint64) flatFees 0x5cfc37c6d6f41fbdca81e67aa4d76bf5e6a35124b7b26eb9ed9bee311f0e532c
UpdateFeeSharesEvent uint64 timestamp, address indexed coin, address sharingConfig, address indexed admin, (address,uint16)[] newShareholders, uint8 version 0x1dbd3fad75cd45b55a204457675643ad26ff9b8128f90c85f8f0fdc116ea4579
UpdateStableFeeConfigEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig, (uint128,(uint64,uint64,uint64))[] stableFeeTiers, (uint64,uint64,uint64) flatFees 0x447c1291312c46b564d3c94aba82605c89c3ad0e8c8f5bb613f36061fa015e59
UpsertFeeTiersEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig, (uint128,(uint64,uint64,uint64))[] feeTiers, uint8 offset 0x11e0b1f4670e11f86f4ed86245d68024108d0213adc06aa70425bddc99ac9dc3
UpsertStableFeeTiersEvent uint64 timestamp, address indexed admin, uint8 indexed feeConfig, (uint128,(uint64,uint64,uint64))[] stableFeeTiers, uint8 offset 0x9610d03eacbb15064b2a0c455dcbe5ce822600feff5850336da5579b8fced37f
WithdrawEvent uint64 timestamp, address indexed user, address indexed quoteAsset, uint64 amount 0x7fa9f117115173abf04fa9c7d9f4feb7b73a18bddfab496a94ff2b5476dfd8da

Errors#

Name Parameters Selector
AlreadyInitialized none 0x0dc149f0
BuybackNotInitialized none 0x46b768c4
CannotAddFunctionToDiamondThatAlreadyExists bytes4 selector 0xebbf5d07
CannotAddSelectorsToZeroAddress bytes4[] selectors 0x0ae3681c
CannotRemoveFunctionThatDoesNotExist bytes4 selector 0x7a08a22d
CannotRemoveImmutableFunction bytes4 selector 0x6fafeb08
CannotReplaceFunctionsFromFacetWithZeroAddress bytes4[] selectors 0xcd98a96f
CannotReplaceFunctionThatDoesNotExists bytes4 selector 0x7479f939
CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet bytes4 selector 0x358d9d1a
CannotReplaceImmutableFunction bytes4 selector 0x520300da
ClaimRateLimitExceeded none 0xa0b51039
DonationAccountNotFound none 0x84b34701
DuplicateShareholder none 0x6d413098
FeatureDeactivated none 0x55fe236e
FeeConfigTooShort none 0x96f98ab8
FeeSharesAlreadyUpdated none 0x2466db83
FeeTiersEmpty none 0x749ebf21
FeeTiersNotSorted none 0x972eea02
IncorrectFacetCutAction uint8 action 0x7fe9a41e
InitializationFunctionReverted address init, bytes data 0x192105d7
InsufficientValue none 0x11011294
InvalidAdmin none 0xb5eba9f0
InvalidBuybackIndex none 0x50689106
InvalidCoin none 0xe77c05c1
InvalidFeeTotal none 0x1b2e1be0
InvalidPool none 0x2083cd40
InvalidShareTotal none 0x8b0422b2
InvalidSharingConfig none 0x5d78bdd2
MathOverflow none 0x9d565d4e
NoBytecodeAtAddress address target, string message 0x919834b9
NoCreatorOverrideHeadroom none 0xc7755380
NoFeeTiers none 0xa274661c
NoSelectorsProvidedForFacet address facet 0x0a7d736a
NoShareholders none 0x81a9440e
NotAuthorized none 0xea8e4eb5
NotContractOwner address caller, address owner 0xff4127cb
NothingToRescue none 0x00f6b210
NothingToWithdraw none 0xd0d04f60
NotInitialized none 0x87138d5c
NotPendingOwner address caller, address pendingOwner 0x3c29cbb6
OffsetNotContinuous none 0x1cfe4f14
PoolCreatorFeesNotSwept none 0xa9eb5c15
PoolRequiredForGraduatedCoin none 0xcff9308f
ReentrancyGuardReentrantCall none 0x3ee5aeb5
RemoveFacetAddressMustBeZeroAddress address facet 0xd091bc81
RescueFailed address to, uint256 amount 0xd68f8239
SafeERC20FailedOperation address token 0x5274afe7
ShareCalculationOverflow none 0x705aaa32
SharingConfigAdminRevoked none 0xc058a69a
SharingConfigNotActive none 0xb7f5b0ee
SharingConfigNotFound none 0x75196a8d
SocialAccountNotFound none 0xfebefc41
StringsInsufficientHexLength uint256 value, uint256 length 0xe22e27eb
TooManyFeeTiers none 0x08498ba1
TooManyShareholders none 0x4695201f
UnauthorizedCaller none 0x5c427cd9
UnsupportedQuoteAsset none 0x6c6c4b88
UserIdTooLong none 0xc3b3a7cb
ZeroAddress none 0xd92e233d
ZeroShareholderNotAllowed none 0x1e31afb9
ZeroShareNotAllowed none 0x87536237

Baofa Documentation. Built from the launch contracts package baofa-rewrite-2026-11-04-a727bfe · 2026-11-04

baofa.fun · X @baofadotfun