watcher-ts/packages/lighthouse-watcher/test/contracts/Lighthouse.sol
Ashwin Phatak 4fb0d95135
Lighthouse watcher (#205)
* 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>
2021-08-11 17:27:49 +05:30

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 {}
}