From 060549db76badb8ac053fe607459293e0a1a3f4f Mon Sep 17 00:00:00 2001 From: apenzk Date: Tue, 11 Feb 2025 15:28:18 +0100 Subject: [PATCH] superblock and l1block for staking contract --- .../contracts/src/staking/MovementStaking.sol | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol b/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol index 2fcb4a2fe..9429669c7 100644 --- a/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol +++ b/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol @@ -64,8 +64,8 @@ contract MovementStaking is address domain = msg.sender; if (domainGenesisAccepted[domain]) revert GenesisAlreadyAccepted(); domainGenesisAccepted[domain] = true; - // roll over from 0 (genesis) to current epoch by block time - currentEpochByDomain[domain] = getEpochByBlockTime(domain); + // roll over from 0 (genesis) to current epoch by L1Block time + currentEpochByDomain[domain] = getEpochByL1BlockTime(domain); for (uint256 i = 0; i < attestersByDomain[domain].length(); i++) { address attester = attestersByDomain[domain].at(i); @@ -145,12 +145,12 @@ contract MovementStaking is epochUnstakesByDomain[domain][epoch][custodian][attester] = amount; } - // gets the would be epoch for the current block time - function getEpochByBlockTime(address domain) public view returns (uint256) { + // gets the would be epoch for the current L1Block time + function getEpochByL1BlockTime(address domain) public view returns (uint256) { return block.timestamp / epochDurationByDomain[domain]; } - // gets the current epoch up to which blocks have been accepted + // gets the current epoch up to which superBlocks have been accepted function getCurrentEpoch(address domain) public view returns (uint256) { return currentEpochByDomain[domain]; } @@ -160,11 +160,11 @@ contract MovementStaking is return getCurrentEpoch(domain) == 0 ? 0 : getCurrentEpoch(domain) + 1; } - function getNextEpochByBlockTime( + function getNextEpochByL1BlockTime( address domain ) public view returns (uint256) { return - getCurrentEpoch(domain) == 0 ? 0 : getEpochByBlockTime(domain) + 1; + getCurrentEpoch(domain) == 0 ? 0 : getEpochByL1BlockTime(domain) + 1; } // gets the stake for a given attester at a given epoch @@ -263,7 +263,7 @@ contract MovementStaking is // set the attester to stake for the next epoch _addStake( domain, - getNextEpochByBlockTime(domain), + getNextEpochByL1BlockTime(domain), address(custodian), msg.sender, amount @@ -290,7 +290,7 @@ contract MovementStaking is // note: by tracking in the next epoch we need to make sure when we roll over an epoch we check the amount rolled over from stake by the unstake in the next epoch _addUnstake( domain, - getNextEpochByBlockTime(domain), + getNextEpochByL1BlockTime(domain), custodian, msg.sender, amount