Some improvements to the CFT smart contract
parent
888d9a8e55
commit
7b871ff9d6
|
@ -13,7 +13,6 @@ contract CCTF9 is Verifier{
|
|||
address public admin;
|
||||
uint256 public volStart;
|
||||
uint256 public volMaxPoints;
|
||||
uint256 public powDiff;
|
||||
bool public started;
|
||||
|
||||
enum PlayerStatus {
|
||||
|
@ -56,10 +55,9 @@ contract CCTF9 is Verifier{
|
|||
event FlagRemoved(uint256 indexed flagId);
|
||||
event FlagSolved(uint256 indexed flagId, address indexed solver);
|
||||
|
||||
constructor(uint256 _volMaxPoints, uint256 _powDiff) {
|
||||
constructor(uint256 _volMaxPoints) {
|
||||
admin = msg.sender;
|
||||
volMaxPoints = _volMaxPoints;
|
||||
powDiff = _powDiff;
|
||||
started = false;
|
||||
}
|
||||
|
||||
|
@ -77,15 +75,9 @@ contract CCTF9 is Verifier{
|
|||
emit FlagAdded(_flagId, _flagHash);
|
||||
}
|
||||
|
||||
function setPowDiff(uint256 _powDiff) external onlyAdmin {
|
||||
powDiff = _powDiff;
|
||||
}
|
||||
|
||||
|
||||
function register(string memory _RTFM) external {
|
||||
require(players[msg.sender].status == PlayerStatus.Unverified, 'Already registered or banned');
|
||||
//uint256 pow = uint256(keccak256(abi.encodePacked("CCTF", msg.sender,"registration", nonce)));
|
||||
//require(pow < powDiff, "invalid pow");
|
||||
require(keccak256(abi.encodePacked('I_read_it')) == keccak256(abi.encodePacked(_RTFM))); // PoW can be used for harder challenges, this is Entry!
|
||||
players[msg.sender].status = PlayerStatus.Verified;
|
||||
}
|
||||
|
@ -112,7 +104,7 @@ contract CCTF9 is Verifier{
|
|||
inputs[8+i] = addr[i];
|
||||
}
|
||||
bool valid = verifyTx(p,inputs);
|
||||
assert(valid);
|
||||
require(valid, "Your proof is invalid");
|
||||
|
||||
|
||||
Solves[msg.sender][_submitFor] = true;
|
||||
|
@ -128,7 +120,7 @@ contract CCTF9 is Verifier{
|
|||
}
|
||||
|
||||
|
||||
function addressToUint32 (address _addr) public view returns (uint32[5] memory)
|
||||
function addressToUint32 (address _addr) public pure returns (uint32[5] memory)
|
||||
{
|
||||
uint256 targetUint = uint256(uint160(_addr));
|
||||
uint32[5] memory addr = [uint32(targetUint/4294967296**4),uint32(targetUint/4294967296**3),uint32(targetUint/4294967296**2),uint32(targetUint/4294967296),uint32(targetUint)];
|
||||
|
|
Loading…
Reference in New Issue