Comment on page
👀
Integrate Algoz

contracts/Algoz.sol at main · algoz-xyz/contracts
GitHub
Algoz Smart Contract
import "./Algoz.sol";
constructor(address _token_verifier, bool _verify_enabled, uint _proof_ttl)
Algoz(_token_verifier, _verify_enabled, _proof_ttl) {}
validate_token(expiry_token, auth_token, signature_token);
❇️ Add this statement inside the function that needs to be authenticated, look at the example contract given below.
❇️ Before Algoz
pragma solidity >=0.8.4;
contract Counter {
uint public count;
constructor() {}
// increment by 1, function to be protected by spam
function increment() public {
count += 1;
}
}
❇️ After Algoz (3 more lines of code)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "./Algoz.sol";
contract Counter is Algoz {
uint public count;
constructor(address _token_verifier, bool _verify_enabled, uint _proof_ttl)
Algoz(_token_verifier, _verify_enabled, _proof_ttl) {}
// increment by 1, function to be protected by spam
function increment(bytes32 expiry_token, bytes32 auth_token, bytes calldata signature_token) public {
// algoz token validation
validate_token(expiry_token, auth_token, signature_token);
count += 1;
}
}
Last modified 1yr ago