Use Case

Farcaster is a social media platform that allows users to post messages to a decentralized network. Although it’s not a DeFi protocol with a lot of funds at stake, it’s still important to make sure that messages are valid and usernames are unique.

It is a basic requirement for a social media platform to make sure that usernames are unique, but if there’s a way to circumvent this invariant, it could break the platform.

Explanation

Check that a username is unique.

Code Example

post: Check if username is unique, if not fail assertion