prosopo/provider

Identify why batch transactions have a very high transfer associated with them

Closed this issue · 2 comments

It seems like this is unrelated to batch transactions and is simply the cost for storing data in the contract.

Storing the following Transfer struct costs 480 UNIT on the dev node.

faucetWithStore response.storageDeposit { Charge: '480.0000 Unit' }

    /// Event emitted when a token transfer occurs.
    #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)]
    #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
    pub struct Transfer {
        from: AccountId,
        to: AccountId,
        value: Balance,
    }

Changing the storage to a tuple reduces this by >75% to 112 UNIT

    transfers: Mapping<(AccountId, AccountId, Timestamp), Balance>,

The fees are sent to a contract deposit account that is not a contract. The fees are refunded to the caller when the contract is terminated, after the storage has been deleted.

Investigate storing Transfer in Lazy vector