gas-payments
gas-payments.tolk Tolk standard library file
Definitions
getGasConsumedAtTheMoment
fun getGasConsumedAtTheMoment(): intReturns amount of gas (in gas units) consumed in current Computation Phase.
Source codeacceptExternalMessage
fun acceptExternalMessage(): voidThis function is required to be called when you process an external message (from an outer world) and "accept" it to blockchain. Without calling this function, an external message would be discarded. As an effect, the current smart contract agrees to buy some gas to finish the current transaction. For more details, check accept_message effects.
Source codesetGasLimitToMaximum
fun setGasLimitToMaximum(): voidWhen processing an internal message, by default, the limit of gas consumption is determined by incoming message.
Functions setGasLimit and setGasLimitToMaximum allow you to change this behavior.
Sets current gas limit gl to its maximal allowed value gm, and resets the gas credit gc to zero,
decreasing the value of gr by gc in the process.
setGasLimit
fun setGasLimit(limit: int): voidWhen processing an internal message, by default, the limit of gas consumption is determined by incoming message.
Functions setGasLimit and setGasLimitToMaximum allow you to change this behavior.
Sets current gas limit gl to the minimum of limit and gm, and resets the gas credit gc to zero.
If the gas consumed so far (including the present instruction) exceeds the resulting value of gl,
an (unhandled) out of gas exception is thrown before setting new gas limits.
calculateGasFee
@pure
fun calculateGasFee(workchain: int8, gasUsed: int): coinsCalculates fee (amount in nanotoncoins to be paid) for a transaction which consumed gasUsed gas units.
calculateGasFeeWithoutFlatPrice
@pure
fun calculateGasFeeWithoutFlatPrice(workchain: int8, gasUsed: int): coinsSame as calculateGasFee, but without flat price. Docs about fees
Source codecalculateStorageFee
fun calculateStorageFee(workchain: int8, seconds: int, bits: int, cells: int): coinsCalculates amount of nanotoncoins you should pay for storing a contract of provided size for seconds.
bits and cells represent contract state (code + data).
calculateForwardFee
@pure
fun calculateForwardFee(workchain: int8, bits: int, cells: int): coinsCalculates amount of nanotoncoins you should pay to send a message of a specified size.
Source codecalculateForwardFeeWithoutLumpPrice
@pure
fun calculateForwardFeeWithoutLumpPrice(workchain: int8, bits: int, cells: int): coinsSame as calculateForwardFee, but without lump price. Docs about fees
Source codecalculateOriginalForwardFee
@deprecated("use modern `onInternalMessage` and access `in.originalForwardFee` directly")
fun calculateOriginalForwardFee(workchain: int8, incomingFwdFee: coins): coinsCalculates fee that was paid by the sender of an incoming internal message.
Source codecontract.getStorageDuePayment
@pure
fun contract.getStorageDuePayment(): coinsReturns the amount of nanotoncoins current contract debts for storage. ("due" and "debt" are synonyms)
If it has no debt, 0 is returned.
contract.getStoragePaidPayment
@pure
fun contract.getStoragePaidPayment(): coinsReturns the amount of nanotoncoins charged for storage. (during the storage phase preceding the current computation phase)
Source codeLast updated on