mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 10:32:19 +00:00
751f62615d
This request implements an end to end Polygon state sync in the devnet. It does this by deploying smart contracts ont the L2 & L2 chain which follow the polygon fx portal model with security checks removed to simplify the code. The sync events generated are routed through a local mock heimdal - to avoid the consensus process for testing purposes. The commit also includes support code to help the delivery of additional contract based scenratios.
36 lines
901 B
Solidity
36 lines
901 B
Solidity
// SPDX-License-Identifier: LGPL-3.0
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
contract faucet {
|
|
mapping (address => uint256) public sources;
|
|
mapping (address => uint256) public destinations;
|
|
|
|
constructor() {}
|
|
|
|
event sent(address _destination, uint256 _amount);
|
|
event received(address _source, uint256 _amount);
|
|
|
|
receive() external payable
|
|
{
|
|
sources[msg.sender] += msg.value;
|
|
emit received(msg.sender, msg.value);
|
|
}
|
|
|
|
function send(address payable _destination, uint256 _requested) public payable
|
|
{
|
|
uint256 amount = 0;
|
|
|
|
if (address(this).balance > _requested){
|
|
amount = _requested;
|
|
_destination.transfer(_requested);
|
|
}
|
|
else{
|
|
amount = address(this).balance;
|
|
_destination.transfer(amount);
|
|
}
|
|
|
|
destinations[_destination] += amount;
|
|
emit sent(_destination, amount);
|
|
}
|
|
} |