-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(katana): gas oracle skeleton (#2643)
- Loading branch information
Showing
15 changed files
with
239 additions
and
74 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,24 @@ | ||
{ | ||
"number": 0, | ||
"parentHash": "0x999", | ||
"timestamp": 5123512314, | ||
"stateRoot": "0x99", | ||
"sequencerAddress": "0x100", | ||
"gasPrices": { | ||
"ETH": 1111, | ||
"STRK": 2222 | ||
}, | ||
"feeToken": { | ||
"address": "0x55", | ||
"name": "ETHER", | ||
"symbol": "ETH", | ||
"decimals": 18, | ||
"storage": { | ||
"0x111": "0x1", | ||
"0x222": "0x2" | ||
} | ||
}, | ||
"universalDeployer": { | ||
"address": "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf", | ||
"storage": { | ||
"0x10": "0x100" | ||
} | ||
}, | ||
"accounts": { | ||
"0x66efb28ac62686966ae85095ff3a772e014e7fbf56d4c5f6fac5606d4dde23a": { | ||
"publicKey": "0x1", | ||
"balance": "0xD3C21BCECCEDA1000000", | ||
"nonce": "0x1", | ||
"storage": { | ||
"0x1": "0x1", | ||
"0x2": "0x2" | ||
} | ||
} | ||
}, | ||
"contracts": { | ||
}, | ||
"classes": [ | ||
] | ||
"number": 0, | ||
"parentHash": "0x999", | ||
"timestamp": 5123512314, | ||
"stateRoot": "0x99", | ||
"sequencerAddress": "0x100", | ||
"gasPrices": { | ||
"ETH": 9999, | ||
"STRK": 8888 | ||
}, | ||
"accounts": { | ||
"0x66efb28ac62686966ae85095ff3a772e014e7fbf56d4c5f6fac5606d4dde23a": { | ||
"publicKey": "0x1", | ||
"balance": "0xD3C21BCECCEDA1000000", | ||
"nonce": "0x1", | ||
"storage": { | ||
"0x1": "0x1", | ||
"0x2": "0x2" | ||
} | ||
} | ||
}, | ||
"contracts": {}, | ||
"classes": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use katana_primitives::block::GasPrices; | ||
|
||
// TODO: implement a proper gas oracle function - sample the l1 gas and data gas prices | ||
// currently this just return the hardcoded value set from the cli or if not set, the default value. | ||
#[derive(Debug)] | ||
pub struct L1GasOracle { | ||
gas_prices: GasPrices, | ||
data_gas_prices: GasPrices, | ||
} | ||
|
||
impl L1GasOracle { | ||
pub fn fixed(gas_prices: GasPrices, data_gas_prices: GasPrices) -> Self { | ||
Self { gas_prices, data_gas_prices } | ||
} | ||
|
||
/// Returns the current gas prices. | ||
pub fn current_gas_prices(&self) -> GasPrices { | ||
self.gas_prices.clone() | ||
} | ||
|
||
/// Returns the current data gas prices. | ||
pub fn current_data_gas_prices(&self) -> GasPrices { | ||
self.data_gas_prices.clone() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.