Flap Tax Vault

Overview

When you use a smart contract as the "Funds Recipient Wallet", our system will try to parse it as a vault.

If you implement your smart contract following our Vault Specification, your Vault's information can be shown on our website.

Furthermore, if your vault is verified by our team or our auditing partners, your vault's "unverified" risk level can be updated to the corresponding risk level based on the audit results. And all audit reports will be uploaded to ipfs and available on our website for users to check. Users will be able to do their own research on the vaults before investing in your token.

circle-check

The Vault Specification

To be compatible with our VaultPortal system, your vault smart contract must inherit the VaultBase contract:

  • You must implement the description() method to return a dynamic string that describes your vault's current state. The description should change based on the vault's state (e.g., balance, status, etc.), we will learn an example from the following BlackHoleVault example.

  • If you have any permissioned functions that should be triggered by an external address, and it is not suitable to make them public (e.g., buyback which may be sandwich attacked), you MUST ALSO give the guardian address the permissions alongside other allowed addresses as a backup. The guardian can always call permissioned functions and must have the necessary roles/permissions. It should not be able to revoke guardian's any access to permissioned functions unless the guardian itself renounces the access. At this moment, the guardian is an empty but upgradeable contract managed by Flap. In the ideal case, we don't need to implement any functionality in the guardian contract. It just serves as a trusted address that can step in when necessary to protect users' funds. Check the Flap Guardian section for more details.

The Example Vault Implementation - BlackHoleVault

Here is an example vault implementation called BlackHoleVault that inherits from the VaultBase contract and implements the required description() method:

  • It inherits from VaultBase and implements the description() method to provide a dynamic description of the vault's state.

  • Since it does not have any permissioned functions, it does not need to be associated with the guardian address.

The Flap Guardian

The Flap Guardian is a privileged address that can always call permissioned functions in vault contracts that implement our Vault Specification. The guardian serves as a backup mechanism to ensure that critical functions can be executed even if the primary authorized addresses are unable to do so.

At this moment, the guardian is an empty but upgradeable contract managed by Flap as follows:

Ideally, we don't need to implement any functionality in the guardian contract. It just serves as a trusted address that can step in when necessary to protect users' funds.

Adapter for Legacy Vaults

If you have built a vault to receive tax token revenue before the Vault Specification was introduced, you can still make your vault compatible with our VaultPortal system by creating an adapter contract that inherits from VaultBase and wraps around your existing vault. The adapter will implement the description() method and forward calls to your legacy vault as needed. This way, you can leverage our VaultPortal features without modifying your original vault contract.

Please reach out to our team for assistance in creating an adapter for your legacy vault.

Get Your Vault Verified

Please reach out to our team if you want to get your vault or vault factory verified by us or our auditing partners.

Before reaching out, please make sure:

  • You have correctly implemented the Vault Specification in your vault contract. (The description() method, the guardian access to permissioned functions, etc.)

  • You have passed some basic AI auditing tools. Check the "How to use AI to audit your smart contracts" below for more details. Using such tools can help you resolve some critical vulnerabilities before submitting for manual review. We strongly recommend you to use AI auditing tools even before deploying your smart contracts and tokens

VaultPortal

The VaultPortal is a registry that manages vault factories and their deployed vaults. It provides a unified interface for interacting with vaults across different chains.

Deployed Addresses

Chain
VaultPortal Address

BNB mainnet

0x90497450f2a706f1951b5bdda52B4E5d16f34C06

BNB testnet

0x027e3704fC5C16522e9393d04C60A3ac5c0d775f

Get Vault Info

We have two methods for fetching the vault info of a token:

  • tryGetVault(address taxToken) : This method first tries to find the vault created through the VaultPortal. If not found, it will try to find the vault by searching all registered vault factories and manually verified vaults. You should use this method for most cases to avoid unnecessary reverts.

  • getVault(address taxToken) : This method returns vault that created through the VaultPortal.

Get Audit Reports for A token

For each token, you can get its audit reports with pagination support using the getAuditReports method. If the token itself has no audit reports, it will fall back to its vault's factory's audit reports.

VaultFactory

You can implement a vault factory that deploys vaults following our Vault Specification. Your vault factory must implement the IVaultFactory interface as follows:

  • Currently, we only support BNB (quoteToken == address(0)) as the quote token. But in the future, we may support other quote tokens as well. And your vault factory must implement the isQuoteTokenSupported method to indicate which quote tokens are supported.

  • The newVault method will be called by the VaultPortal when a new tax token is being created. Your factory must create a new vault instance for the predicted tax token address and return the vault address. Please note that the tax token does not exist yet when this method is called. The VaultPortal predicts the token address and passes it here. The actual token will be created AFTER the vault is created.

Note that if you want to get your vault factory verified by us or our auditing partners, you must follow the following guidelines:

  • The factory must implement the IVaultFactory interface correctly.

  • The factory contract can not be upgradeable. If you want to upgrade your factory in the future, you must deploy a new factory contract and get it verified again.

  • The Vault deployed from your factory can charge at most 10% as a fee from the tax revenue. The fee structure must be clearly described in the vault's description() method.

  • You need to at least pass some basic AI auditing tools before submitting for manual review. Check the "How to use AI to audit your smart contracts" below for more details. Using such tools can help you resolve some critical vulnerabilities before submitting for manual review. We strongly recommend you to use AI auditing tools even before deploying your smart contracts and tokens

FAQ

How to use AI to audit your smart contracts?

You can use any AI for auditing your smart contracts. For example, you can use google's AI studio which is free to usearrow-up-right. The prompt is as follows:

This could help you identify some common vulnerabilities and issues in your smart contracts. And if your comments are clear enough, it will even help you identify some logical issues. However, please note that AI tools are not perfect and may miss some vulnerabilities or provide incorrect suggestions. Alwaysreview your smart contracts before deploying them on mainnet.

Last updated