๐Ÿช„Fee Collector

The local fee collector collects the fees for usage of the pool and vault network on a specific blockchain. Part of the collected fees goes back to the depositors of the White Whale pools and/or the single asset flash loan vaults. The remainder is sent to the interchain collector as protocol revenue. The protocol revenue is then distributed to WHALE stakers in the form of token buybacks.

The code for the fee collector contract can be found here.


The following are the messages that can be executed on the fee collector:

Instantiate

Instantiates the fee collector.

{}

Migrate

Migrates the fee collector.

{}

ExecuteMsg

Collect fees

Collects the fees accrued by the pools or vaults. It can be triggered in different ways:

  • Fees can be collected for specific contracts, specifying the address and contract type (pool or vault)

  • Fees can be collected for pools, specifying the pool factory address and factory type (pool)

  • Fees can be collected for vaults, specifying the vault factory address and factory type (vault)

{
  "collect_fees": {
    "collect_fees_for": {
      "contracts": {
        "contracts": [
          {
            "address": "migaloo1...",
            "contract_type": {
              "vault": {}
            }
          },
          {
            "address": "migaloo1...",
            "contract_type": {
              "pool": {}
            }
          }
        ]
      }
    }
  }
}
KeyTypeDescription

collect_fees_for

FeesFor

Enum specifiying to collect fees for either Contracts or Factory

contracts

Vec<Contract>

Contracts to collect fees from

Update config

Updates the configuration of the fee collector.

{
  "update_config": {
    "owner": "migaloo1...",
    "pool_router": "migaloo1...",
    "fee_distributor": "migaloo1...",
    "pool_factory": "migaloo1...",
    "vault_factory": "migaloo1..."
  }
}
KeyTypeDescription

owner

Option<String>

New owner of the contract

pool_router

Option<String>

New pool router contract

fee_distributor

Option<String>

New fee distributor contract

pool_factory

Option<String>

New pool factory contract

vault_factory

Option<String>

New vault factory contract

Aggregate fees

Aggregates the fees in the fee collector.

{
  "aggregate_fees": {
    "aggregate_fees_for": {
      "factory": {
        "factory_addr": "migaloo1...",
        "factory_type": {
          "pool": {}
        }
      }
    }
  }
}
KeyTypeDescription

aggregate_fees_for

FeesFor

Enum specifiying to collect fees for either Contracts or Factory

factory

Factory

Factory data to collect fees from

Forward fees

Forward fees to the fee distributor. This is called when creating a new epoch on the fee distributor. this will collect and aggregate the fees, to send them back to the fee distributor.

Note: can only be called by the owner of the contract or the fee distributor.

{
  "forward_fees": {
    "epoch": {
      "id": "1",
      "start_time": "1698851118",
      "total": [
        {
          "amount": "1000",
          "info": {
            "native_token": {
              "denom": "uwhale"
            }
          }
        }
      ],
      "available": [
        {
          "amount": "300",
          "info": {
            "native_token": {
              "denom": "uwhale"
            }
          }
        }
      ],
      "claimed": [
        {
          "amount": "700",
          "info": {
            "native_token": {
              "denom": "uwhale"
            }
          }
        }
      ],
      "global_index": {
        "bonded_amount": "3000",
        "bonded_assets": [
          {
            "info": {
              "native_token": {
                "denom": "ampWHALE"
              }
            },
            "amount": "1500"
          },
          {
            "info": {
              "native_token": {
                "denom": "bWHALE"
              }
            },
            "amount": "1500"
          }
        ],
        "timestamp": "1698851118",
        "weight": "1500000"
      }
    },
    "forward_fees_as": {
      "native_token": {
        "denom": "uwhale"
      }
    }
  }
}
KeyTypeDescription

epoch

Epoch

Epoch to be created once the msg is succesful. This variable is prebuilt on the fee distributor when calling new_epoch

forward_fees_as

AssetInfo

The asset to forward fees as. Currently not used, value taken from the fee distributor config.

Queries

Config

Retrieves the configuration of the contract in a Config response.

{
  "config": {}
}

Fees

Queries the fees collected by individual contracts, whether they are pools or vaults. Additionally, it can query the fees collected by a given pool or vault factory's children.

{
  "fees": {
    "query_fees_for": {
      "contracts": {
        "contracts": [
          {
            "address": "migaloo1...",
            "contract_type": {
              "pool": {}
            }
          },
          {
            "address": "migaloo1...",
            "contract_type": {
              "vault": {}
            }
          }
        ]
      }
    },
    "all_time": true
  }
}
KeyTypeDescription

query_fees_for

QueryFeesFor

Enum specifying to query fees for either Contracts or Factory

contracts

Vec<Contract>

Contracts to query fees from

all_time

Option<bool>

If true, it will return the fees collected since the inception of the pool/vault. On the other hand, if false, only the fees that has been accrued by the pool/vault but not collected by the fee collector will be returned

Last updated