Using Security Oracle

We have designed the interface of the Security Oracle to be extremely simplistic and friendly to use, and with a few line changes you as the end-user could quickly onboard the benefits of real-time security protections and have more confidence in the running of your own dApps. It is totally up to you on how to properly leverage the SecurityScore to determine the next move, and the good practice would be having a set of external addresses used by your smart contracts to go against the Security Oracle and then decide on a reasonable threshold score based on all the scores you got.

Here we present a sample snippet on Solidity Ethereum to demonstrate how to interact with the Security Oracle by feeding it with the targeted address and function signature.

import "./certik/CertiKSecurityOracle.sol";
contract MinimalExample {
function secureCall() public {
address securityOracleAddress = 0x152E88111e7C8f51fbdBbF1723B330a330117CAf;
address targetAddress = 0xfa308d59067470487C38Eaf4d586EA21F1b0032b;
string functionSignature = "getPrice(string)";
uint8 score = CertiKSecurityOracle(securityOracleAddress).getSecurityScore(
targetAddress,
functionSignature
);
// build your own check
require(score >= 200, "revert due to high security risk");
}
}

Notice that a defaultScore shall be returned if the Security Oracle got no information regarding the combination of the address and function, thus you may add an additional check on the handling of the defaultScore. CertiK Foundation is missioned to actively monitor the security environments of different blockchain platforms by having its duties fulfilled to keep providing security scores to those smart contracts that heavily used by others. Meanwhile, you can always feed data to the Security Oracle by submitting a transaction on CertiK Chain to create an oracle task.