Skip to content

Commit 4a3fd36

Browse files
Add documentation to the Transacrion struct in part of EIP-1559
1 parent 65c9007 commit 4a3fd36

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Sources/web3swift/Transaction/EthereumTransaction.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,24 @@ public struct EthereumTransaction: CustomStringConvertible {
1212
public var gasPrice: BigUInt = 0
1313
public var gasLimit: BigUInt = 0
1414

15-
// EIP-1559
15+
// MARK: - EIP-1559
16+
/// Value of the tip to the miner for transaction processing.
17+
///
18+
/// Full amount of this variable goes to a miner.
1619
public var maxPriorityFeePerGas: BigUInt = 0
20+
21+
/// Value of the fee for one gas unit
22+
///
23+
/// This value should be greather than sum of:
24+
/// - `Block.nextBlockBaseFeePerGas` - baseFee which will burnt during the transaction processing
25+
/// - `self.maxPriorityFeePerGas` - explicit amount of a tip to the miner of the given block which will include this transaction
26+
///
27+
/// If amount of this will be **greather** than sum of `Block.baseFeePerGas` and `maxPriorityFeePerGas`
28+
/// all exceed funds will be returned to the sender.
29+
///
30+
/// If amount of this will be **lower** than sum of `Block.baseFeePerGas` and `maxPriorityFeePerGas`
31+
/// miner will recieve amount of the follow equation: `maxFeePerGas - Block.baseFeePerGas` if any,
32+
/// where Block is a block to which transaction will be included.
1733
public var maxFeePerGas: BigUInt = 0
1834

1935
// The destination address of the message, left undefined for a contract-creation transaction.

Sources/web3swift/Web3/Web3+Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ extension Web3 {
2424
static let BaseFeeChangeDenominator: BigUInt = 8 // Bounds the amount the base fee can change between blocks.
2525
static let ElasticityMultiplier: BigUInt = 2 // Bounds the maximum gas limit an EIP-1559 block may have.
2626
static let InitialBaseFee: BigUInt = 1000000000 // Initial base fee for EIP-1559 blocks.
27-
}
27+
}

0 commit comments

Comments
 (0)