-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor and test: ability for L2TargetDispenser to migrate
- Loading branch information
Showing
11 changed files
with
203 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,7 +246,8 @@ struct StakingPoint { | |
uint8 stakingFraction; | ||
} | ||
|
||
/// @title Tokenomics - Smart contract for tokenomics logic with incentives for unit owners and discount factor regulations for bonds. | ||
/// @title Tokenomics - Smart contract for tokenomics logic with incentives for unit owners, discount factor | ||
/// regulations for bonds, and staking incentives. | ||
/// @author Aleksandr Kuperman - <[email protected]> | ||
/// @author Andrey Lebedev - <[email protected]> | ||
/// @author Mariapia Moscatiello - <[email protected]> | ||
|
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
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 |
---|---|---|
|
@@ -24,6 +24,8 @@ interface IBridge { | |
/// @author Andrey Lebedev - <[email protected]> | ||
/// @author Mariapia Moscatiello - <[email protected]> | ||
contract GnosisTargetDispenserL2 is DefaultTargetDispenserL2 { | ||
// Bridge payload length | ||
uint256 public constant BRIDGE_PAYLOAD_LENGTH = 32; | ||
// L2 token relayer address | ||
address public immutable l2TokenRelayer; | ||
|
||
|
@@ -53,12 +55,25 @@ contract GnosisTargetDispenserL2 is DefaultTargetDispenserL2 { | |
} | ||
|
||
/// @inheritdoc DefaultTargetDispenserL2 | ||
function _sendMessage(uint256 amount, bytes memory) internal override { | ||
function _sendMessage(uint256 amount, bytes memory bridgePayload) internal override { | ||
// Check for the bridge payload length | ||
if (bridgePayload.length != BRIDGE_PAYLOAD_LENGTH) { | ||
revert IncorrectDataLength(BRIDGE_PAYLOAD_LENGTH, bridgePayload.length); | ||
} | ||
|
||
// Get the gas limit from the bridge payload | ||
uint256 gasLimitMessage = abi.decode(bridgePayload, (uint256)); | ||
|
||
// Check the gas limit value | ||
if (gasLimitMessage < GAS_LIMIT) { | ||
gasLimitMessage = GAS_LIMIT; | ||
} | ||
|
||
// Assemble AMB data payload | ||
bytes memory data = abi.encodeWithSelector(RECEIVE_MESSAGE, abi.encode(amount)); | ||
|
||
// Send message to L1 | ||
bytes32 iMsg = IBridge(l2MessageRelayer).requireToPassMessage(l1DepositProcessor, data, GAS_LIMIT); | ||
bytes32 iMsg = IBridge(l2MessageRelayer).requireToPassMessage(l1DepositProcessor, data, gasLimitMessage); | ||
|
||
emit MessagePosted(uint256(iMsg), msg.sender, l1DepositProcessor, amount); | ||
} | ||
|
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
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