Skip to content

Instantly share code, notes, and snippets.

@clemsos
Last active November 29, 2024 14:23
Show Gist options
  • Save clemsos/dc92a351d47fad26115f8e3905f9a31d to your computer and use it in GitHub Desktop.
Save clemsos/dc92a351d47fad26115f8e3905f9a31d to your computer and use it in GitHub Desktop.
List all events in contract ABi (human-readable format)
const { ethers } = require('hardhat')
async function main() {
const { interface } = await ethers.getContractFactory(
'contracts/PublicLock.sol:PublicLock'
)
const events = interface.fragments.filter((f) => f.type === 'event')
console.log(ethers.FormatType)
console.log(
`
PublicLock events (${events.length}):
${events.map((f) => `- \`${f.format('full')}\``).join('\n')}
`
)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})

PublicLock events (30):

  • event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)
  • event CancelKey(uint256 indexed tokenId, address indexed owner, address indexed sendTo, uint256 refund)
  • event EventHooksUpdated(address onKeyPurchaseHook, address onKeyCancelHook, address onValidKeyHook, address onTokenURIHook, address onKeyTransferHook, address onKeyExtendHook, address onKeyGrantHook, address onHasRoleHook)
  • event ExpirationChanged(uint256 indexed tokenId, uint256 prevExpiration, uint256 newExpiration)
  • event ExpireKey(uint256 indexed tokenId)
  • event GasRefundValueChanged(uint256 refundValue)
  • event GasRefunded(address indexed receiver, uint256 refundedAmount, address tokenAddress)
  • event Initialized(uint8 version)
  • event KeyExtended(uint256 indexed tokenId, uint256 newTimestamp)
  • event KeyGranterAdded(address indexed account)
  • event KeyGranterRemoved(address indexed account)
  • event KeyManagerChanged(uint256 indexed _tokenId, address indexed _newManager)
  • event KeysMigrated(uint256 updatedRecordsCount)
  • event LockConfig(uint256 expirationDuration, uint256 maxNumberOfKeys, uint256 maxKeysPerAcccount)
  • event LockManagerAdded(address indexed account)
  • event LockManagerRemoved(address indexed account)
  • event LockMetadata(string name, string symbol, string baseTokenURI)
  • event OwnershipTransferred(address previousOwner, address newOwner)
  • event PaymentReceipt(uint256[] tokenIds, uint256 purchases, uint256 extensions, address payer, address tokenAddress, uint256 totalPaid)
  • event PricingChanged(uint256 oldKeyPrice, uint256 keyPrice, address oldTokenAddress, address tokenAddress)
  • event ReferrerFee(address indexed referrer, uint256 fee)
  • event ReferrerPaid(address tokenAddress, address referrer, uint256 fee)
  • event RefundPenaltyChanged(uint256 freeTrialLength, uint256 refundPenaltyBasisPoints)
  • event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
  • event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
  • event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
  • event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
  • event TransferFeeChanged(uint256 transferFeeBasisPoints)
  • event UnlockCallFailed(address indexed lockAddress, address unlockAddress)
  • event Withdrawal(address indexed sender, address indexed tokenAddress, address indexed recipient, uint256 amount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment