---
# System prepended metadata

title: Pallet Specifications

---

# Pallet Specifications

Below are the expected calls for a substrate pallet to integrate Band Protocol's data feed.

```rust
#[pallet::call]
impl<T: Config> Pallet<T> {
    pub fn relay(origin: OriginFor<T>, symbols: Vec<String>, rates: Vec<u64>, resolve_time: u64, request_id: u64):
        // Relays a list of symbols and their associated rates along with the resolve time and request id on BandChain. 
        // This function should contain two guards:
        //  - One that checks the latest resolve time for a particular symbol to assure that old rates are not allowed to be relayed 
        //  - is_relayer() guard
        // The function should just ignore symbols and rates of which the resolve_time is lower than the already saved values and continue to 
        // update the other rates.

    pub fn force_relay(origin: OriginFor<T>, symbols: Vec<String>, rates: Vec<u64>, resolve_time: u64, request_id: u64):
        // Optional Emergency function. Implementation is recommend.
        // Should contain is_relayer() guard
        // Similar to relay() but without the resolve time guard.

    pub fn add_relayer(origin:OriginFor<T>, account_id: Vec<T::AccountId>):
        // add accounts as authorized relayer, should implement is_owner() guard and only allow owners to use this function.
    
    pub fn remove_relayer(origin:OriginFor<T>, account_id: Vec<T::AccountId>):
        // remove accounts from authorized relayer, should implement is_owner() guard and only allow owners to use this function.
    
```

While not mandatory, to prevent overlapping tickers from different asset categories i.e. stocks, cryptocurrencies and forexes, a new pallet should be instantiated for each asset category.

Our CosmWasm implementation which is in Rust can be found [here](https://github.com/bandprotocol/band-std-reference-contracts-cosmwasm/blob/main/contracts/std-reference-basic/src/contract.rs) if a reference is needed. The implementation for this pallet should be relatively similar. 