Description:
Smart contract deployed on Ethereum.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
contract Film {
struct Frame {
bytes32 imageHash; //SHA256 of the .jpg image
string ipfsCID; //IPFS CID of this image
uint256 blocknumber; //block number when it was captured
}
address constant deafbeef_addr = 0x7ccd2EE72a75F7e4776f598c1Be11A119fD8d191;
address public attester;
bytes32 public startBlockhash;
uint16 public numFrames = 0;
string public attestation;
address _owner;
bool public locked = false;
mapping (uint16 => Frame) public frames;
modifier onlyOwner() {
require(msg.sender==_owner,"denied");
_;
}
modifier notLocked() {
require(locked == false);
_;
}
constructor() {
_owner = msg.sender;
}
// Let deafbeef.eth address attest they made this contract
string constant m = "I photographed the animation frames recorded in this contract.";
function attest() public {
require(msg.sender == deafbeef_addr);
attester = msg.sender;
attestation = m;
}
function captureFrame(bytes32 imageHash, string memory ipfsCID) public onlyOwner notLocked {
numFrames++; // frame indexing starts at 1
frames[numFrames].imageHash = imageHash;
frames[numFrames].ipfsCID = ipfsCID;
frames[numFrames].blocknumber = block.number;
if (numFrames==2) startBlockhash = blockhash(frames[1].blocknumber); // save blockhash of 1st captured frame
}
function lock() public onlyOwner notLocked {
locked = true;
}
}
Submitted on: 2025-09-19 10:43:22
Comments
Log in to comment.
No comments yet.