This page is an extension of the Recommended Kernels List page.
It contains explanations for some kernels and also the potential of utilizing those kernels into smart contracts.
[kernel ID: 337] Prohibited List
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract ProhibitedListKernel {
mapping(address => bool) public walletAddressList;
function addProhibitedList() public {
require(!walletAddressList[msg.sender], "You are already on this Prohibited List!");
walletAddressList[msg.sender] = true;
}
function areYouOnProhibitedList(address _toCheck) public view returns (uint256){
if (walletAddressList[_toCheck] == true) {
return 0;
} else {
return 100;
}
}
}
Prohibited List kernel is an on-chain function for smart contracts that is deployed on Base Sepolia.
It illustrates that if this kernel executes before calling to smart contract, it can help protect malicious wallet addresses from calling your smart contract.
[kernel ID: 340] Trusted List
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract TrustedListKernel {
mapping(address => bool) public walletAddressList;
function addTrustedList(address _toAdd) public {
require(!walletAddressList[_toAdd], "You are already on this Trusted List!");
walletAddressList[_toAdd] = true;
}
function areYouOnTrustedList(address _toCheck) public view returns (bool){
if (walletAddressList[_toCheck] == true) {
return true;
} else {
return false;
}
}
}
Trusted List kernel is an on-chain function on smart contract that is deployed on Base Sepolia.
If we use this kernel through KRNL Protocol, only allowed users would be able to use the smart contract.
Instead of having to manage the list of allowed users through the primary smart contract, using this category of kernel could improve the modularity of Web3 transactions.
[kernel ID: 341] Mock Oracle
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract MockOracle {
function getRandomExchangeRate(string memory input) public view returns (uint256) {
// high and low of BTC to USD in 2024
uint256 BTCUSDmin = 40000;
uint256 BTCUSDmax = 100000;
// high and low of ETH to USD in 2024
uint256 ETHUSDmin = 2200;
uint256 ETHUSDmax = 4000;
uint256 BTCUSDrandom = (block.timestamp + block.number) % (BTCUSDmax - BTCUSDmin + 1);
uint256 BTCUSDresult = BTCUSDrandom + BTCUSDmin;
uint256 ETHUSDrandom = (block.timestamp + block.number) % (ETHUSDmax - ETHUSDmin + 1);
uint256 ETHUSDresult = ETHUSDrandom + ETHUSDmin;
if (keccak256(abi.encodePacked(input)) == keccak256(abi.encodePacked("BTC/USD"))) {
return BTCUSDresult;
} else if (keccak256(abi.encodePacked(input)) == keccak256(abi.encodePacked("ETH/USD"))) {
return ETHUSDresult;
} else {
return 0;
}
}
}
Mock Oracle kernel is an on-chain function for smart contracts that is deployed on Arbitrum Sepolia.
It shows that kernels do not have to be only protection for the smart contract. Utilizing KRNL Protocol into the smart contract expands the potential of fetching data from other sources.
The fetched value from this kernel can be shown after finishing the transaction through an event.
Day and Time kernel is an on-chain function for smart contracts that is deployed on Optimism Sepolia.
In this case, the response from Day and Time kernel is only the day of week and current time (in GMT+0).
Similarly to Mock Oracle kernel, this kernel shows that the fetched data from other sources can be many types of data.
This category of kernel can include on-chain kernels like this one, as well as off-chain (Web2 API) kernels too.
Other potential examples similar to this kernel include: current temperature in your city, recent sports results, and more.
[kernel ID: 875] Mock Oracle
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract MockEthPriceOracle {
function getEthToUsd() public view returns (uint256) {
// high and low of ETH to USD in 2024
uint256 ETHUSDmin = 2200;
uint256 ETHUSDmax = 4000;
uint256 ETHUSDrandom = (block.timestamp + block.number) % (ETHUSDmax - ETHUSDmin + 1);
uint256 ETHUSDresult = ETHUSDrandom + ETHUSDmin;
return ETHUSDresult;
}
}
Mock Oracle kernel is an on-chain function for smart contracts that is deployed on Arbitrum Sepolia.
It shows that kernels do not have to be only protection for the smart contract. Utilizing KRNL Protocol into the smart contract expands the potential of fetching data from other sources.
The fetched value from this kernel can be shown after finishing the transaction through an event.