mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
c51573f333
Implemented polygon->eth flow
29 lines
705 B
Solidity
29 lines
705 B
Solidity
// SPDX-License-Identifier: LGPL-3.0
|
|
|
|
pragma solidity ^0.8.6;
|
|
|
|
contract ChildSender {
|
|
address rootStateReceiver;
|
|
mapping(address => uint) public sent;
|
|
|
|
// MessageTunnel on L1 will get data from this event
|
|
event MessageSent(bytes message);
|
|
|
|
constructor(address childStateReceiver_) {
|
|
rootStateReceiver = childStateReceiver_;
|
|
}
|
|
|
|
function _sendMessageToRoot(bytes memory message) internal {
|
|
emit MessageSent(message);
|
|
}
|
|
|
|
function sendToRoot(uint amount) external {
|
|
uint total = sent[msg.sender];
|
|
sent[msg.sender] = total + amount;
|
|
|
|
_sendMessageToRoot(
|
|
abi.encode(rootStateReceiver, msg.sender, amount)
|
|
);
|
|
}
|
|
}
|