Verified contractExactMIT
SurveyAnchor
Address0x1e31f4504e4e20bdfd6cdc03113e35f927d98323
- Balance
0 ETH
- Transactions
321
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- No
- EVM version
- paris
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,418,243
- Creation transaction
- 0x0592990188…2141acf7c4
contracts/Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
/*
* Survey Blockchain Anchoring Contract
*
* 기능:
* - 설문 응답 해시 anchoring
* - 토큰 소모 이벤트 기록
* - 응답 무결성 검증을 위한 hash 조회 기능
*
* 개인정보 없이 재현 가능한 hash 기반 검증 구조.
* Arbitrum / Ethereum / Polygon 모두 호환.
*/
contract SurveyAnchor {
// 설문ID → 응답ID → 해시값
mapping(uint256 => mapping(uint256 => bytes32)) public responseHashes;
// --- Events -------------------------------------------------------------
// 토큰 소모 이벤트
event ResponseTokenConsumed(
uint256 indexed surveyId,
bytes32 indexed tokenHash,
uint256 blockNumber,
uint256 timestamp
);
// 응답 해시 anchoring 이벤트
event ResponseAnchored(
uint256 indexed surveyId,
uint256 indexed responseId,
bytes32 responseHash,
uint256 blockNumber,
uint256 timestamp
);
// --- Token consumption ---------------------------------------------------
/*
* 토큰이 소모되었음을 기록
* tokenHash: 서버에서 SHA256(token 문자열) 결과 (bytes32)
*/
function consumeToken(uint256 surveyId, bytes32 tokenHash) external {
emit ResponseTokenConsumed(
surveyId,
tokenHash,
block.number,
block.timestamp
);
}
// --- Response anchoring --------------------------------------------------
/*
* 응답 JSON 정규화 → SHA-256 → bytes32 로 변환된 해시를 저장
* responseId: 서버 DB의 응답 PK
*/
function anchorResponse(
uint256 surveyId,
uint256 responseId,
bytes32 responseHash
) external {
responseHashes[surveyId][responseId] = responseHash;
emit ResponseAnchored(
surveyId,
responseId,
responseHash,
block.number,
block.timestamp
);
}
// --- Hash 조회 ----------------------------------------------------------
function getResponseHash(
uint256 surveyId,
uint256 responseId
) external view returns (bytes32) {
return responseHashes[surveyId][responseId];
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"evmVersion": "paris"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.