Commit ecb45314 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

feat: getters for ctc extradata (#204)

* feat: getters for ctc extradata

* contracts: lint fix

* contracts: fix build
parent d6b85865
...@@ -158,10 +158,42 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -158,10 +158,42 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
uint40 uint40
) )
{ {
(, uint40 nextQueueIndex,,) = _getBatchExtraData(); (,uint40 nextQueueIndex,,) = _getBatchExtraData();
return nextQueueIndex; return nextQueueIndex;
} }
/**
* Returns the timestamp of the last transaction.
* @return Timestamp for the last transaction.
*/
function getLastTimestamp()
override
public
view
returns (
uint40
)
{
(,,uint40 lastTimestamp,) = _getBatchExtraData();
return lastTimestamp;
}
/**
* Returns the blocknumber of the last transaction.
* @return Blocknumber for the last transaction.
*/
function getLastBlockNumber()
override
public
view
returns (
uint40
)
{
(,,,uint40 lastBlockNumber) = _getBatchExtraData();
return lastBlockNumber;
}
/** /**
* Gets the queue element at a particular index. * Gets the queue element at a particular index.
* @param _index Index of the queue element to access. * @param _index Index of the queue element to access.
......
...@@ -10,9 +10,9 @@ import { iOVM_ChainStorageContainer } from "../../iOVM/chain/iOVM_ChainStorageCo ...@@ -10,9 +10,9 @@ import { iOVM_ChainStorageContainer } from "../../iOVM/chain/iOVM_ChainStorageCo
/** /**
* @title OVM_ChainStorageContainer * @title OVM_ChainStorageContainer
* @dev The Chain Storage Container provides its owner contract with read, write and delete functionality. * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.
* This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used
* in a fraud proof due to the fraud window having passed, and the associated chain state or * in a fraud proof due to the fraud window having passed, and the associated chain state or
* transactions being finalized. * transactions being finalized.
* Three disctint Chain Storage Containers will be deployed on Layer 1: * Three disctint Chain Storage Containers will be deployed on Layer 1:
* 1. Stores transaction batches for the Canonical Transaction Chain * 1. Stores transaction batches for the Canonical Transaction Chain
...@@ -42,7 +42,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes ...@@ -42,7 +42,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
/*************** /***************
* Constructor * * Constructor *
***************/ ***************/
/** /**
* @param _libAddressManager Address of the Address Manager. * @param _libAddressManager Address of the Address Manager.
* @param _owner Name of the contract that owns this container (will be resolved later). * @param _owner Name of the contract that owns this container (will be resolved later).
...@@ -61,7 +61,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes ...@@ -61,7 +61,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
/********************** /**********************
* Function Modifiers * * Function Modifiers *
**********************/ **********************/
modifier onlyOwner() { modifier onlyOwner() {
require( require(
msg.sender == resolve(owner), msg.sender == resolve(owner),
...@@ -187,7 +187,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes ...@@ -187,7 +187,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
{ {
return buffer.get(uint40(_index)); return buffer.get(uint40(_index));
} }
/** /**
* @inheritdoc iOVM_ChainStorageContainer * @inheritdoc iOVM_ChainStorageContainer
*/ */
...@@ -202,7 +202,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes ...@@ -202,7 +202,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
uint40(_index) uint40(_index)
); );
} }
/** /**
* @inheritdoc iOVM_ChainStorageContainer * @inheritdoc iOVM_ChainStorageContainer
*/ */
......
...@@ -133,6 +133,28 @@ interface iOVM_CanonicalTransactionChain { ...@@ -133,6 +133,28 @@ interface iOVM_CanonicalTransactionChain {
Lib_OVMCodec.QueueElement memory _element Lib_OVMCodec.QueueElement memory _element
); );
/**
* Returns the timestamp of the last transaction.
* @return Timestamp for the last transaction.
*/
function getLastTimestamp()
external
view
returns (
uint40
);
/**
* Returns the blocknumber of the last transaction.
* @return Blocknumber for the last transaction.
*/
function getLastBlockNumber()
external
view
returns (
uint40
);
/** /**
* Get the number of queue elements which have not yet been included. * Get the number of queue elements which have not yet been included.
* @return Number of pending queue elements. * @return Number of pending queue elements.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment