Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Commit 77d30d6

Browse files
authored
feat: getters for ctc extradata (#204)
* feat: getters for ctc extradata * contracts: lint fix * contracts: fix build
1 parent 2a12492 commit 77d30d6

File tree

3 files changed

+61
-7
lines changed

3 files changed

+61
-7
lines changed

contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,42 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
158158
uint40
159159
)
160160
{
161-
(, uint40 nextQueueIndex,,) = _getBatchExtraData();
161+
(,uint40 nextQueueIndex,,) = _getBatchExtraData();
162162
return nextQueueIndex;
163163
}
164164

165+
/**
166+
* Returns the timestamp of the last transaction.
167+
* @return Timestamp for the last transaction.
168+
*/
169+
function getLastTimestamp()
170+
override
171+
public
172+
view
173+
returns (
174+
uint40
175+
)
176+
{
177+
(,,uint40 lastTimestamp,) = _getBatchExtraData();
178+
return lastTimestamp;
179+
}
180+
181+
/**
182+
* Returns the blocknumber of the last transaction.
183+
* @return Blocknumber for the last transaction.
184+
*/
185+
function getLastBlockNumber()
186+
override
187+
public
188+
view
189+
returns (
190+
uint40
191+
)
192+
{
193+
(,,,uint40 lastBlockNumber) = _getBatchExtraData();
194+
return lastBlockNumber;
195+
}
196+
165197
/**
166198
* Gets the queue element at a particular index.
167199
* @param _index Index of the queue element to access.

contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { iOVM_ChainStorageContainer } from "../../iOVM/chain/iOVM_ChainStorageCo
1010

1111
/**
1212
* @title OVM_ChainStorageContainer
13-
* @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.
13+
* @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.
1414
* This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used
15-
* in a fraud proof due to the fraud window having passed, and the associated chain state or
15+
* in a fraud proof due to the fraud window having passed, and the associated chain state or
1616
* transactions being finalized.
1717
* Three disctint Chain Storage Containers will be deployed on Layer 1:
1818
* 1. Stores transaction batches for the Canonical Transaction Chain
@@ -42,7 +42,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
4242
/***************
4343
* Constructor *
4444
***************/
45-
45+
4646
/**
4747
* @param _libAddressManager Address of the Address Manager.
4848
* @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
6161
/**********************
6262
* Function Modifiers *
6363
**********************/
64-
64+
6565
modifier onlyOwner() {
6666
require(
6767
msg.sender == resolve(owner),
@@ -187,7 +187,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
187187
{
188188
return buffer.get(uint40(_index));
189189
}
190-
190+
191191
/**
192192
* @inheritdoc iOVM_ChainStorageContainer
193193
*/
@@ -202,7 +202,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
202202
uint40(_index)
203203
);
204204
}
205-
205+
206206
/**
207207
* @inheritdoc iOVM_ChainStorageContainer
208208
*/

contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,28 @@ interface iOVM_CanonicalTransactionChain {
133133
Lib_OVMCodec.QueueElement memory _element
134134
);
135135

136+
/**
137+
* Returns the timestamp of the last transaction.
138+
* @return Timestamp for the last transaction.
139+
*/
140+
function getLastTimestamp()
141+
external
142+
view
143+
returns (
144+
uint40
145+
);
146+
147+
/**
148+
* Returns the blocknumber of the last transaction.
149+
* @return Blocknumber for the last transaction.
150+
*/
151+
function getLastBlockNumber()
152+
external
153+
view
154+
returns (
155+
uint40
156+
);
157+
136158
/**
137159
* Get the number of queue elements which have not yet been included.
138160
* @return Number of pending queue elements.

0 commit comments

Comments
 (0)