mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-10 05:18:05 +00:00
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 {}
|
||
|
}
|