mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-19 20:36:19 +00:00
4fb0d95135
* Implement watcher for Lighthouse StorageRequest event. * Add smoke test for lighthouse watcher. * Add fileCost as value to Lighthouse store call. Co-authored-by: nabarun <nabarun@deepstacksoft.com>
34 lines
826 B
Solidity
34 lines
826 B
Solidity
pragma solidity >=0.4.22 <0.8.0;
|
|
|
|
contract Lighthouse {
|
|
address owner = msg.sender;
|
|
|
|
struct Content {
|
|
string cid;
|
|
string config;
|
|
uint fileCost;
|
|
}
|
|
|
|
event StorageRequest(address uploader, string cid, string config, uint fileCost);
|
|
|
|
mapping(address => mapping(string => Content)) public requests;
|
|
|
|
function store(string calldata cid, string calldata config)
|
|
external
|
|
payable
|
|
{
|
|
uint fileCost = msg.value;
|
|
requests[msg.sender][cid] = Content(cid, config, fileCost);
|
|
emit StorageRequest(msg.sender, cid, config, msg.value);
|
|
}
|
|
|
|
function getPaid(uint amount, address payable recipient)
|
|
external
|
|
{
|
|
require(msg.sender == owner);
|
|
recipient.transfer(amount);
|
|
}
|
|
|
|
fallback () external payable {}
|
|
}
|