Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xc5580044...89ab42A8C The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ControlStructures
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity)
/**
*Submitted for verification at basescan.org on 2024-05-16
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
contract ControlStructures {
// Define custom errors for use within the contract
error AfterHours(uint256 time);
error AtLunch();
// Function to determine the response based on the input number
function fizzBuzz(uint256 _number) public pure returns (string memory response) {
// Check if the number is divisible by both 3 and 5
if (_number % 3 == 0 && _number % 5 == 0) {
return "FizzBuzz"; // Return "FizzBuzz" if divisible by both 3 and 5
}
// Check if the number is divisible by 3
else if (_number % 3 == 0) {
return "Fizz"; // Return "Fizz" if divisible by 3
}
// Check if the number is divisible by 5
else if (_number % 5 == 0) {
return "Buzz"; // Return "Buzz" if divisible by 5
}
// If none of the above conditions are met
else {
return "Splat"; // Return "Splat" if none of the conditions are met
}
}
// Function to determine the response based on the input time
function doNotDisturb(uint256 _time) public pure returns (string memory result) {
// Ensure the input time is within valid bounds (less than 2400)
assert(_time < 2400);
// Check different time ranges and return appropriate responses or revert with errors
if (_time > 2200 || _time < 800) {
revert AfterHours(_time); // Revert with custom error if it's after 10:00 PM or before 8:00 AM
}
else if (_time >= 1200 && _time <= 1299) {
revert AtLunch(); // Revert with custom error if it's between 12:00 PM and 1:00 PM
}
else if (_time >= 800 && _time <= 1199) {
return "Morning!"; // Return "Morning!" if it's between 8:00 AM and 11:59 AM
}
else if (_time >= 1300 && _time <= 1799) {
return "Afternoon!"; // Return "Afternoon!" if it's between 1:00 PM and 5:59 PM
}
else if (_time >= 1800 && _time <= 2200) {
return "Evening!"; // Return "Evening!" if it's between 6:00 PM and 10:00 PM
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"name":"AfterHours","type":"error"},{"inputs":[],"name":"AtLunch","type":"error"},{"inputs":[{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"doNotDisturb","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_number","type":"uint256"}],"name":"fizzBuzz","outputs":[{"internalType":"string","name":"response","type":"string"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
0x608060405234801561001057600080fd5b506105aa806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063440c93e21461003b578063e655b7bb1461006b575b600080fd5b610055600480360381019061005091906103dc565b61009b565b6040516100629190610499565b60405180910390f35b610085600480360381019061008091906103dc565b6101e7565b6040516100929190610499565b60405180910390f35b606060006003836100ac91906104ea565b1480156100c5575060006005836100c391906104ea565b145b15610107576040518060400160405280600881526020017f46697a7a42757a7a00000000000000000000000000000000000000000000000081525090506101e2565b600060038361011691906104ea565b03610158576040518060400160405280600481526020017f46697a7a0000000000000000000000000000000000000000000000000000000081525090506101e2565b600060058361016791906104ea565b036101a9576040518060400160405280600481526020017f42757a7a0000000000000000000000000000000000000000000000000000000081525090506101e2565b6040518060400160405280600581526020017f53706c617400000000000000000000000000000000000000000000000000000081525090505b919050565b606061096082106101fb576101fa61051b565b5b61089882118061020c575061032082105b1561024e57816040517fa4bf701e0000000000000000000000000000000000000000000000000000000081526004016102459190610559565b60405180910390fd5b6104b0821015801561026257506105138211155b15610299576040517f08a3648800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61032082101580156102ad57506104af8211155b156102ef576040518060400160405280600881526020017f4d6f726e696e6721000000000000000000000000000000000000000000000000815250905061039c565b610514821015801561030357506107078211155b15610345576040518060400160405280600a81526020017f41667465726e6f6f6e2100000000000000000000000000000000000000000000815250905061039c565b610708821015801561035957506108988211155b1561039b576040518060400160405280600881526020017f4576656e696e6721000000000000000000000000000000000000000000000000815250905061039c565b5b919050565b600080fd5b6000819050919050565b6103b9816103a6565b81146103c457600080fd5b50565b6000813590506103d6816103b0565b92915050565b6000602082840312156103f2576103f16103a1565b5b6000610400848285016103c7565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610443578082015181840152602081019050610428565b60008484015250505050565b6000601f19601f8301169050919050565b600061046b82610409565b6104758185610414565b9350610485818560208601610425565b61048e8161044f565b840191505092915050565b600060208201905081810360008301526104b38184610460565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006104f5826103a6565b9150610500836103a6565b9250826105105761050f6104bb565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b610553816103a6565b82525050565b600060208201905061056e600083018461054a565b9291505056fea2646970667358221220670a54d8d485a3bd2da753fdb0cd45e9d76a1a72ac3d4f5f85b0ea24ccee4e9464736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063440c93e21461003b578063e655b7bb1461006b575b600080fd5b610055600480360381019061005091906103dc565b61009b565b6040516100629190610499565b60405180910390f35b610085600480360381019061008091906103dc565b6101e7565b6040516100929190610499565b60405180910390f35b606060006003836100ac91906104ea565b1480156100c5575060006005836100c391906104ea565b145b15610107576040518060400160405280600881526020017f46697a7a42757a7a00000000000000000000000000000000000000000000000081525090506101e2565b600060038361011691906104ea565b03610158576040518060400160405280600481526020017f46697a7a0000000000000000000000000000000000000000000000000000000081525090506101e2565b600060058361016791906104ea565b036101a9576040518060400160405280600481526020017f42757a7a0000000000000000000000000000000000000000000000000000000081525090506101e2565b6040518060400160405280600581526020017f53706c617400000000000000000000000000000000000000000000000000000081525090505b919050565b606061096082106101fb576101fa61051b565b5b61089882118061020c575061032082105b1561024e57816040517fa4bf701e0000000000000000000000000000000000000000000000000000000081526004016102459190610559565b60405180910390fd5b6104b0821015801561026257506105138211155b15610299576040517f08a3648800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61032082101580156102ad57506104af8211155b156102ef576040518060400160405280600881526020017f4d6f726e696e6721000000000000000000000000000000000000000000000000815250905061039c565b610514821015801561030357506107078211155b15610345576040518060400160405280600a81526020017f41667465726e6f6f6e2100000000000000000000000000000000000000000000815250905061039c565b610708821015801561035957506108988211155b1561039b576040518060400160405280600881526020017f4576656e696e6721000000000000000000000000000000000000000000000000815250905061039c565b5b919050565b600080fd5b6000819050919050565b6103b9816103a6565b81146103c457600080fd5b50565b6000813590506103d6816103b0565b92915050565b6000602082840312156103f2576103f16103a1565b5b6000610400848285016103c7565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610443578082015181840152602081019050610428565b60008484015250505050565b6000601f19601f8301169050919050565b600061046b82610409565b6104758185610414565b9350610485818560208601610425565b61048e8161044f565b840191505092915050565b600060208201905081810360008301526104b38184610460565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006104f5826103a6565b9150610500836103a6565b9250826105105761050f6104bb565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b610553816103a6565b82525050565b600060208201905061056e600083018461054a565b9291505056fea2646970667358221220670a54d8d485a3bd2da753fdb0cd45e9d76a1a72ac3d4f5f85b0ea24ccee4e9464736f6c63430008110033
Deployed Bytecode Sourcemap
60:2158:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;281:782;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1138:1077;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;281:782;337:22;452:1;447;437:7;:11;;;;:::i;:::-;:16;:36;;;;;472:1;467;457:7;:11;;;;:::i;:::-;:16;437:36;433:623;;;490:17;;;;;;;;;;;;;;;;;;;;;433:623;654:1;649;639:7;:11;;;;:::i;:::-;:16;635:421;;672:13;;;;;;;;;;;;;;;;;;;;;635:421;817:1;812;802:7;:11;;;;:::i;:::-;:16;798:258;;835:13;;;;;;;;;;;;;;;;;;;;;798:258;978:14;;;;;;;;;;;;;;;;;;;281:782;;;;:::o;1138:1077::-;1196:20;1318:4;1310:5;:12;1303:20;;;;:::i;:::-;;1443:4;1435:5;:12;:27;;;;1459:3;1451:5;:11;1435:27;1431:777;;;1497:5;1486:17;;;;;;;;;;;:::i;:::-;;;;;;;;1431:777;1613:4;1604:5;:13;;:30;;;;;1630:4;1621:5;:13;;1604:30;1600:608;;;1658:9;;;;;;;;;;;;;;1600:608;1773:3;1764:5;:12;;:29;;;;;1789:4;1780:5;:13;;1764:29;1760:448;;;1810:17;;;;;;;;;;;;;;;;;;;;;1760:448;1926:4;1917:5;:13;;:30;;;;;1943:4;1934:5;:13;;1917:30;1913:295;;;1964:19;;;;;;;;;;;;;;;;;;;;;1913:295;2083:4;2074:5;:13;;:30;;;;;2100:4;2091:5;:13;;2074:30;2070:138;;;2121:17;;;;;;;;;;;;;;;;;;;;;2070:138;1138:1077;;;;:::o;88:117:1:-;197:1;194;187:12;334:77;371:7;400:5;389:16;;334:77;;;:::o;417:122::-;490:24;508:5;490:24;:::i;:::-;483:5;480:35;470:63;;529:1;526;519:12;470:63;417:122;:::o;545:139::-;591:5;629:6;616:20;607:29;;645:33;672:5;645:33;:::i;:::-;545:139;;;;:::o;690:329::-;749:6;798:2;786:9;777:7;773:23;769:32;766:119;;;804:79;;:::i;:::-;766:119;924:1;949:53;994:7;985:6;974:9;970:22;949:53;:::i;:::-;939:63;;895:117;690:329;;;;:::o;1025:99::-;1077:6;1111:5;1105:12;1095:22;;1025:99;;;:::o;1130:169::-;1214:11;1248:6;1243:3;1236:19;1288:4;1283:3;1279:14;1264:29;;1130:169;;;;:::o;1305:246::-;1386:1;1396:113;1410:6;1407:1;1404:13;1396:113;;;1495:1;1490:3;1486:11;1480:18;1476:1;1471:3;1467:11;1460:39;1432:2;1429:1;1425:10;1420:15;;1396:113;;;1543:1;1534:6;1529:3;1525:16;1518:27;1367:184;1305:246;;;:::o;1557:102::-;1598:6;1649:2;1645:7;1640:2;1633:5;1629:14;1625:28;1615:38;;1557:102;;;:::o;1665:377::-;1753:3;1781:39;1814:5;1781:39;:::i;:::-;1836:71;1900:6;1895:3;1836:71;:::i;:::-;1829:78;;1916:65;1974:6;1969:3;1962:4;1955:5;1951:16;1916:65;:::i;:::-;2006:29;2028:6;2006:29;:::i;:::-;2001:3;1997:39;1990:46;;1757:285;1665:377;;;;:::o;2048:313::-;2161:4;2199:2;2188:9;2184:18;2176:26;;2248:9;2242:4;2238:20;2234:1;2223:9;2219:17;2212:47;2276:78;2349:4;2340:6;2276:78;:::i;:::-;2268:86;;2048:313;;;;:::o;2367:180::-;2415:77;2412:1;2405:88;2512:4;2509:1;2502:15;2536:4;2533:1;2526:15;2553:176;2585:1;2602:20;2620:1;2602:20;:::i;:::-;2597:25;;2636:20;2654:1;2636:20;:::i;:::-;2631:25;;2675:1;2665:35;;2680:18;;:::i;:::-;2665:35;2721:1;2718;2714:9;2709:14;;2553:176;;;;:::o;2735:180::-;2783:77;2780:1;2773:88;2880:4;2877:1;2870:15;2904:4;2901:1;2894:15;2921:118;3008:24;3026:5;3008:24;:::i;:::-;3003:3;2996:37;2921:118;;:::o;3045:222::-;3138:4;3176:2;3165:9;3161:18;3153:26;;3189:71;3257:1;3246:9;3242:17;3233:6;3189:71;:::i;:::-;3045:222;;;;:::o
Swarm Source
ipfs://670a54d8d485a3bd2da753fdb0cd45e9d76a1a72ac3d4f5f85b0ea24ccee4e94
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.