You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1009 B
Solidity

2 years ago
//SPDX-License-Identifier: GLP-3.0
2 years ago
pragma solidity ^0.8.0;
2 years ago
import "./database.sol";
2 years ago
2 years ago
contract filecoin is database {
2 years ago
mapping(bytes32 => bytes) public pathToHash;
2 years ago
function download(
2 years ago
bytes memory repoName,
bytes memory path
2 years ago
) external view override returns (bytes memory, bool) {
bytes32 fullName = keccak256(bytes.concat(repoName, "/", path));
2 years ago
// call flat directory(FD)
2 years ago
return (pathToHash[fullName], true);
2 years ago
}
function upload(
bytes memory repoName,
bytes memory path,
bytes calldata data
2 years ago
) external payable override {
bytes32 fullName = keccak256(bytes.concat(repoName, "/", path));
2 years ago
pathToHash[fullName] = data;
}
2 years ago
2 years ago
function uploadChunk(
2 years ago
bytes memory repoName,
bytes memory path,
uint256 chunkId,
bytes calldata data
) external payable override {
2 years ago
repoName;
path;
chunkId;
data;
2 years ago
revert("unsupport uploadChunk");
}
2 years ago
}