forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avm): implement avm state getter opcodes within noir contracts (A…
…ztecProtocol#4402) Part of AztecProtocol#4313
- Loading branch information
Showing
6 changed files
with
273 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
mod context; |
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,50 @@ | ||
use dep::protocol_types::address::{ | ||
AztecAddress, | ||
EthAddress, | ||
}; | ||
|
||
// Getters that will be converted by the transpiler into their | ||
// own opcodes | ||
struct AvmContext {} | ||
|
||
// No new function as this struct is entirely static getters | ||
impl AvmContext { | ||
#[oracle(address)] | ||
pub fn address() -> AztecAddress {} | ||
|
||
#[oracle(storageAddress)] | ||
pub fn storage_address() -> AztecAddress {} | ||
|
||
#[oracle(origin)] | ||
pub fn origin() -> AztecAddress {} | ||
|
||
#[oracle(sender)] | ||
pub fn sender() -> AztecAddress {} | ||
|
||
#[oracle(portal)] | ||
pub fn portal() -> EthAddress {} | ||
|
||
#[oracle(feePerL1Gas)] | ||
pub fn fee_per_l1_gas() -> Field {} | ||
|
||
#[oracle(feePerL2Gas)] | ||
pub fn fee_per_l2_gas() -> Field {} | ||
|
||
#[oracle(feePerDaGas)] | ||
pub fn fee_per_da_gas() -> Field {} | ||
|
||
#[oracle(chainId)] | ||
pub fn chain_id() -> Field {} | ||
|
||
#[oracle(version)] | ||
pub fn version() -> Field {} | ||
|
||
#[oracle(blockNumber)] | ||
pub fn block_number() -> Field {} | ||
|
||
#[oracle(timestamp)] | ||
pub fn timestamp() -> Field {} | ||
|
||
// #[oracle(contractCallDepth)] | ||
// pub fn contract_call_depth() -> Field {} | ||
} |
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,4 +1,5 @@ | ||
mod abi; | ||
mod avm; | ||
mod context; | ||
mod hash; | ||
mod history; | ||
|
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