Skip to main content

Use Case & Applications

Prevents unauthorized ownership transfers, which could allow attackers to take complete control of the protocol. Critical for DeFi protocols with owner-controlled administrative functions, lending protocols, yield aggregators, cross-chain bridges, and governance systems. For example, in the Radiant Capital hack, the attacker gained control over 3 signers of the multisig, which allowed them to change ownership of the lending pools and ultimately drain the protocol. This assertion would have prevented such an attack.

Explanation

Monitors changes to the owner address storage slot in contracts using:
  • ph.forkPreTx() / ph.forkPostTx(): Compare owner address before and after transaction
  • getStateChangesAddress(): Track all changes to the owner address slot during transaction execution
  • registerStorageChangeTrigger(): Trigger when owner address changes
The assertion performs both direct pre/post comparison and verification of all intermediate state changes to detect unauthorized ownership modifications. For more information about cheatcodes, see the Cheatcodes Documentation.

Code Example

Full examples with tests available in the Phylax Assertion Examples Repository.