Skip to main content

Coinweb fees overview

L1 Network

L1 Network fees are paid by the L1 writer. The amount of fees is calculated by the writer separately for each Network.

  • Who pays? Paid by the broadcaster. Broadcaster gets the equivalent of paid L1 fees in CWEB's
  • Who receives? L1 network miners.
  • Why do we have that fee? We need to pay for embedding TX in L1 network
  • When calculated? During the composing L1 tx by L1 writer.
  • When paid?: Broadcaster pays L1 fees when embeds transaction to L1 network. Broadcaster gets refunds for L1 fees during processing the Send command by SmartContract. For CWEB-less operations: Send command is composed as a result of TokenizationBlock.
  • When validated?: We validate only refunds in CWEB for broadcaster. On the emulation stage by the wallet service before embedding TX.

L2 Gas

L2 gas is calculated by the smart contract during the composition of the tx by the wallet-lib. For now, it takes the constant fee per Smart Contract operation in that TX. The L2 fee is burnt, which is equivalent to providing a small payment to everyone by increasing the value of the left tokens in the network.

  • Who pays? The User who requests l2-computer computation.
  • Who receives? All users of the CWEB network.
  • Why do we have that fee? We need to pay for the computation power used to execute the current TX in the network.
  • When calculated? At the moment of the composition of L2 tx by the wallet-lib.
  • When paid?: During processing the Send command by SmartContract.
  • When validated? On the emulation stage by the wallet service before embedding TX.

Broadcaster

Broadcaster fees are paid to the broadcaster, so the broadcaster can pay the l1-fees and, in addition to that, make a bit of profit; this way in the future we'll incentive people to run their broadcaster and hence run coinweb nodes.

Note: broadcaster profit portion can be also used as a safety buffer for the case when we do operations on the bonding curve and the price of the token can change between validation and execution

wallet_fees = tx_fee + byte_fee * N_bytes

(wallet-lib/src/composefundtx.rs:compose_fund_tx_core())

  • Who pays? The user who initiates the transaction.
  • Who receives? The broadcaster who runs the wallet-service.
  • Why do we have that fee? Fees are paid to the broadcaster, so the broadcaster can pay the l1-fees and get a bit of profit.
  • When calculated? At the moment of the composition of L2 tx by the wallet-lib.
  • When paid? During processing the Send command by SmartContract.
  • When validated? On the emulation stage by the wallet service before embedding TX. The L1 gas and Broadcaster fees are always paid by the sender of the transaction. However, there are options for how to include fees in the transaction amount. We can either subtract or add fees from the initial TX amount. (Ex: when Bob sends 10 CWEB to Alice, either Bob pays 10 CWEB and Alice receives 9.9999 CWEB, or Bob pays 10.00001 and Alice receives 10) The way of including the fee should be chosen on the UI side.

Q: for user tokens, the TX amount is in TOKEN and fees are in CWEB. So we can't add or subtract these values cause they have different dimensions. So to support add/subtract fees functionality we need to perform it on the stage of the Tokenization Block when we know how many tokens we need for CWEB. So it's not possible to do it on the UI side

It is possible to pay L1 gas and Broadcaster fees with the tokens if there is not enough CWEB on the user's wallet and this option is enabled for the token. Then the needed amount of tokens will be sold on the bounding curve on the Tokenization Block stage and paid to the broadcaster.

CWEB-less operations

There are operations that allowed to be executed without CWEB tokens in the balance. For this type of operations, the calculation of the fees will go as for L2 gas and broadcaster fees. But at the moment of execution by Tokenization Block the amount of tokens will be sold to the CWEB to cover these fees.

Token fees:

Token fees are charged by the owner of the bounding curve for the buy/sell operations on it.

Note: These fees currently are not shown to the user at the moment of the TX composition.

  • Who pays? The user who operates with tokens.
  • Who receives? The owner of the token who has created the bonding curve or liquidity pool.
  • Why do we have that fee? To provide token owners revenue for managing bonding-curve or liquidity pool.
  • When calculated? At the moment of execution of the buy/sell operation in the Tokenization block

Commands

Commands that are supported by the TokenizationBlock

CommandCweb feesToken feesAdd fees (amount + fees)Subtract fees (amount - fees)
CreateToken+-+
UpdateBondingCurve++
TransferToken+++
UpdateToken++
MintToken++
BuyToken++
SellToken+++
BuyViaCweb++
SellViaCweb+++
BuyForToken+++
SellForToken+++
WithdrawCweb++
CreateCwebLiquidityPool++
UpdateLiquidityPoolCurve++
AddLiquidityPoolLiquidity++
RemoveLiquidityPoolLiquidity++


Coinweb © 2024