Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ScribeChainlinkLike_USDS_USD_1
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import {IToll} from "chronicle-std/toll/Toll.sol"; import {IScribeChainlinkLike} from "./IScribeChainlinkLike.sol"; interface IDecimals { function decimals() external view returns (uint8); } interface IScribe { function latestRoundData() external view returns ( uint80 roundId, int answer, uint startedAt, uint updatedAt, uint80 answeredInRound ); function latestAnswer() external view returns (int); function read() external view returns (uint); } /** * @title ScribeChainlinkLike * * @notice For everyone that took shortcuts during their Chainlink integration * * @dev This is a helper contract for immutable contracts that took shortcuts * during their Chainlink integration and hardcoded Chainlink's decimals * value. * * It allows using Chronicle Protocol oracles with same decimals as the * respective Chainlink oracle. * * Note that this contract is minimal on purpose and does neither provide * nice-to-have's like `wat()(bytes32)` nor the full IChronicle interface. * * Please take more caution integrating external projects! * * @dev Note that this contract is stateless and does not offer any configuration * once deployed. Toll management is delegated to the respective Chronicle * oracle. * * @author Chronicle Labs, Inc * @custom:security-contact [email protected] */ contract ScribeChainlinkLike is IScribeChainlinkLike { /// @inheritdoc IScribeChainlinkLike address public immutable chronicle; /// @inheritdoc IScribeChainlinkLike address public immutable chainlink; /// @inheritdoc IScribeChainlinkLike uint8 public immutable decimals; constructor(address chronicle_, address chainlink_) { chronicle = chronicle_; chainlink = chainlink_; decimals = IDecimals(chainlink).decimals(); require(decimals != 0); } modifier toll() { if (!IToll(chronicle).tolled(msg.sender)) { revert NotTolled(msg.sender); } _; } // -- Chainlink Compatibility Functions -- /// @inheritdoc IScribeChainlinkLike function latestRoundData() external view toll returns (uint80, int, uint, uint, uint80) { // assert(IToll(chronicle).tolled(address(this))); ( uint80 roundId, int answer, uint startedAt, uint updatedAt, uint80 answeredInRound ) = IScribe(chronicle).latestRoundData(); return ( roundId, _convert(answer, decimals), startedAt, updatedAt, answeredInRound ); } /// @inheritdoc IScribeChainlinkLike function latestAnswer() external view toll returns (int) { // assert(IToll(chronicle).tolled(address(this))); int answer = IScribe(chronicle).latestAnswer(); return _convert(answer, decimals); } // -- Internal Helpers -- function _convert(int val, uint decimals_) internal pure returns (int) { // assert(decimals_ != 0); if (decimals_ < 18) return val / int((10 ** (18 - decimals_))); if (decimals_ > 18) return val * int((10 ** (decimals_ - 18))); return val; } } /** * @dev Contract overwrite to deploy contract instances with specific naming. * * For more info, see docs/Deployment.md. */ contract ScribeChainlinkLike_USDS_USD_1 is ScribeChainlinkLike { constructor(address chronicle, address chainlink) ScribeChainlinkLike(chronicle, chainlink) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import {IToll} from "./IToll.sol"; /** * @title Toll Module * * @notice "Toll paid, we kiss - but dissension looms, maybe diss?" * * @dev The `Toll` contract module provides a basic access control mechanism, * where a set of addresses are granted access to protected functions. * These addresses are said the be _tolled_. * * Initially, no address is tolled. Through the `kiss(address)` and * `diss(address)` functions, auth'ed callers are able to toll/de-toll * addresses. Authentication for these functions is defined via the * downstream implemented `toll_auth()` function. * * This module is used through inheritance. It will make available the * modifier `toll`, which can be applied to functions to restrict their * use to only tolled callers. */ abstract contract Toll is IToll { /// @dev Mapping storing whether address is tolled. /// @custom:invariant Image of mapping is {0, 1}. /// ∀x ∊ Address: _buds[x] ∊ {0, 1} /// @custom:invariant Only functions `kiss` and `diss` may mutate the mapping's state. /// ∀x ∊ Address: preTx(_buds[x]) != postTx(_buds[x]) /// → (msg.sig == "kiss" ∨ msg.sig == "diss") /// @custom:invariant Mapping's state may only be mutated by authenticated caller. /// ∀x ∊ Address: preTx(_buds[x]) != postTx(_buds[x]) /// → toll_auth() mapping(address => uint) private _buds; /// @dev List of addresses possibly being tolled. /// @dev May contain duplicates. /// @dev May contain addresses not being tolled anymore. /// @custom:invariant Every address being tolled once is element of the list. /// ∀x ∊ Address: tolled(x) → x ∊ _budsTouched address[] private _budsTouched; /// @dev Ensures caller is tolled. modifier toll() { assembly ("memory-safe") { // Compute slot of _buds[msg.sender]. mstore(0x00, caller()) mstore(0x20, _buds.slot) let slot := keccak256(0x00, 0x40) // Revert if caller not tolled. let isTolled := sload(slot) if iszero(isTolled) { // Store selector of `NotTolled(address)`. mstore(0x00, 0xd957b595) // Store msg.sender. mstore(0x20, caller()) // Revert with (offset, size). revert(0x1c, 0x24) } } _; } /// @dev Reverts if caller not allowed to access protected function. /// @dev Must be implemented in downstream contract. function toll_auth() internal virtual; /// @inheritdoc IToll function kiss(address who) external { toll_auth(); if (_buds[who] == 1) return; _buds[who] = 1; _budsTouched.push(who); emit TollGranted(msg.sender, who); } /// @inheritdoc IToll function diss(address who) external { toll_auth(); if (_buds[who] == 0) return; _buds[who] = 0; emit TollRenounced(msg.sender, who); } /// @inheritdoc IToll function tolled(address who) public view returns (bool) { return _buds[who] == 1; } /// @inheritdoc IToll /// @custom:invariant Only contains tolled addresses. /// ∀x ∊ tolled(): _tolled[x] /// @custom:invariant Contains all tolled addresses. /// ∀x ∊ Address: _tolled[x] == 1 → x ∊ tolled() function tolled() public view returns (address[] memory) { // Initiate array with upper limit length. address[] memory budsList = new address[](_budsTouched.length); // Iterate through all possible tolled addresses. uint ctr; for (uint i; i < budsList.length; i++) { // Add address only if still tolled. if (_buds[_budsTouched[i]] == 1) { budsList[ctr++] = _budsTouched[i]; } } // Set length of array to number of tolled addresses actually included. assembly ("memory-safe") { mstore(budsList, ctr) } return budsList; } /// @inheritdoc IToll function bud(address who) public view returns (uint) { return _buds[who]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; interface IScribeChainlinkLike { /// @notice Thrown by protected function if caller not tolled. /// @param caller The caller's address. error NotTolled(address caller); /// @notice Returns Chronicle Protocol's IChronicle oracle instance used /// to retrieve the oracle's value. function chronicle() external view returns (address); /// @notice Returns the Chainlink oracle's instance from which this oracle's /// decimals value is retrieved from. function chainlink() external view returns (address); /// @notice Returns the number of decimals of the oracle's value. /// @dev Provides partial compatibility with Chainlink's /// IAggregatorV3Interface. /// @return decimals The oracle value's number of decimals. function decimals() external view returns (uint8 decimals); /// @notice Returns the oracle's latest value. /// @dev Provides partial compatibility with Chainlink's /// IAggregatorV3Interface. /// @return roundId 1. /// @return answer The oracle's latest value. /// @return startedAt 0. /// @return updatedAt The timestamp of oracle's latest update. /// @return answeredInRound 1. function latestRoundData() external view returns ( uint80 roundId, int answer, uint startedAt, uint updatedAt, uint80 answeredInRound ); /// @notice Returns the oracle's latest value. /// @dev Provides partial compatibility with Chainlink's /// IAggregatorV3Interface. /// @custom:deprecated See https://docs.chain.link/data-feeds/api-reference/#latestanswer. /// @return answer The oracle's latest value. function latestAnswer() external view returns (int); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; interface IToll { /// @notice Thrown by protected function if caller not tolled. /// @param caller The caller's address. error NotTolled(address caller); /// @notice Emitted when toll granted to address. /// @param caller The caller's address. /// @param who The address toll got granted to. event TollGranted(address indexed caller, address indexed who); /// @notice Emitted when toll renounced from address. /// @param caller The caller's address. /// @param who The address toll got renounced from. event TollRenounced(address indexed caller, address indexed who); /// @notice Grants address `who` toll. /// @dev Only callable by auth'ed address. /// @param who The address to grant toll. function kiss(address who) external; /// @notice Renounces address `who`'s toll. /// @dev Only callable by auth'ed address. /// @param who The address to renounce toll. function diss(address who) external; /// @notice Returns whether address `who` is tolled. /// @param who The address to check. /// @return True if `who` is tolled, false otherwise. function tolled(address who) external view returns (bool); /// @notice Returns full list of addresses tolled. /// @dev May contain duplicates. /// @return List of addresses tolled. function tolled() external view returns (address[] memory); /// @notice Returns whether address `who` is tolled. /// @custom:deprecated Use `tolled(address)(bool)` instead. /// @param who The address to check. /// @return 1 if `who` is tolled, 0 otherwise. function bud(address who) external view returns (uint); }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "chronicle-std/=lib/chronicle-std/src/", "@script/chronicle-std/=lib/chronicle-std/script/", "greenhouse/=lib/greenhouse/src/" ], "optimizer": { "enabled": true, "runs": 10000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"chronicle","type":"address"},{"internalType":"address","name":"chainlink","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"NotTolled","type":"error"},{"inputs":[],"name":"chainlink","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chronicle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e080604052346100cc576040816109ed803803809161001f828561011d565b8339810103126100cc576020816100428261003b600495610156565b9201610156565b60809190915260a081905260405163313ce56760e01b815292839182906001600160a01b03165afa908115610111576000916100d1575b508060ff9160c05216156100cc57604051610882908161016b8239608051818181609f015281816102cd01526103aa015260a05181610340015260c0518181816101530152818161045a01526105540152f35b600080fd5b6020813d8211610109575b816100e96020938361011d565b81010312610105575160ff8116810361010557905060ff610079565b5080fd5b3d91506100dc565b6040513d6000823e3d90fd5b601f909101601f19168101906001600160401b0382119082101761014057604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100cc5756fe6080604081815260048036101561001557600080fd5b600092833560e01c908163313ce5671461051d5750806350d25bcd146103645780639c3feeb7146102f5578063a34fa092146102825763feaf968c1461005a57600080fd5b3461020257827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102025773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001682517f3bee58f90000000000000000000000000000000000000000000000000000000081523383820152602081602481855afa90811561027857859161024a575b501561021a5760a0908351928380927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa801561020e5783918480809281946101a2575b505061017960a09660ff7f00000000000000000000000000000000000000000000000000000000000000001690610659565b9480519569ffffffffffffffffffff809616875260208701528501526060840152166080820152f35b9450955050505060a0813d8211610206575b816101c160a09383610578565b810103126102025760a092506101d681610605565b9060208101519183820151916101796101f6608060608401519301610605565b92949391929396610147565b8280fd5b3d91506101b4565b505051903d90823e3d90fd5b5060249151907fd957b5950000000000000000000000000000000000000000000000000000000082523390820152fd5b61026b915060203d8111610271575b6102638183610578565b8101906105e8565b38610100565b503d610259565b84513d87823e3d90fd5b5050346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f1576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b5050346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f1576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461020257827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102025773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016928251937f3bee58f900000000000000000000000000000000000000000000000000000000855233838601526020948581602481855afa9081156105135783916104f6575b50156104c75784908451938480927f50d25bcd0000000000000000000000000000000000000000000000000000000082525afa9081156104bc578091610487575b50610480915060ff7f00000000000000000000000000000000000000000000000000000000000000001690610659565b9051908152f35b90508382813d83116104b5575b61049e8183610578565b810103126104b25750610480905138610450565b80fd5b503d610494565b8351903d90823e3d90fd5b83517fd957b5950000000000000000000000000000000000000000000000000000000081523381850152602490fd5b61050d9150863d8811610271576102638183610578565b3861040f565b85513d85823e3d90fd5b8490346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f15760209060ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176105b957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90816020910312610600575180151581036106005790565b600080fd5b519069ffffffffffffffffffff8216820361060057565b604d811161062a57600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90601281106107b3576012811161066e575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee810190811161062a576106a19061061c565b9060008082138184137f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82821686820486111661075957838612917f8000000000000000000000000000000000000000000000000000000000000000938387860589129116166107865786858712940586129084161661075957859005841291161661072c57500290565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6012036012811161062a576107c79061061c565b90811561081d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f800000000000000000000000000000000000000000000000000000000000000082141661062a570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220faffb97e35f185082ba46e66173c325b777d9cd44c447acf25bfa3a605fbe06864736f6c6343000810003300000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c000000000000000000000000ff30586cd0f29ed462364c7e81375fc0c71219b1
Deployed Bytecode
0x6080604081815260048036101561001557600080fd5b600092833560e01c908163313ce5671461051d5750806350d25bcd146103645780639c3feeb7146102f5578063a34fa092146102825763feaf968c1461005a57600080fd5b3461020257827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102025773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c1682517f3bee58f90000000000000000000000000000000000000000000000000000000081523383820152602081602481855afa90811561027857859161024a575b501561021a5760a0908351928380927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa801561020e5783918480809281946101a2575b505061017960a09660ff7f00000000000000000000000000000000000000000000000000000000000000081690610659565b9480519569ffffffffffffffffffff809616875260208701528501526060840152166080820152f35b9450955050505060a0813d8211610206575b816101c160a09383610578565b810103126102025760a092506101d681610605565b9060208101519183820151916101796101f6608060608401519301610605565b92949391929396610147565b8280fd5b3d91506101b4565b505051903d90823e3d90fd5b5060249151907fd957b5950000000000000000000000000000000000000000000000000000000082523390820152fd5b61026b915060203d8111610271575b6102638183610578565b8101906105e8565b38610100565b503d610259565b84513d87823e3d90fd5b5050346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f1576020905173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c168152f35b5080fd5b5050346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f1576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ff30586cd0f29ed462364c7e81375fc0c71219b1168152f35b503461020257827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102025773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c16928251937f3bee58f900000000000000000000000000000000000000000000000000000000855233838601526020948581602481855afa9081156105135783916104f6575b50156104c75784908451938480927f50d25bcd0000000000000000000000000000000000000000000000000000000082525afa9081156104bc578091610487575b50610480915060ff7f00000000000000000000000000000000000000000000000000000000000000081690610659565b9051908152f35b90508382813d83116104b5575b61049e8183610578565b810103126104b25750610480905138610450565b80fd5b503d610494565b8351903d90823e3d90fd5b83517fd957b5950000000000000000000000000000000000000000000000000000000081523381850152602490fd5b61050d9150863d8811610271576102638183610578565b3861040f565b85513d85823e3d90fd5b8490346102f157817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102f15760209060ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176105b957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90816020910312610600575180151581036106005790565b600080fd5b519069ffffffffffffffffffff8216820361060057565b604d811161062a57600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90601281106107b3576012811161066e575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee810190811161062a576106a19061061c565b9060008082138184137f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82821686820486111661075957838612917f8000000000000000000000000000000000000000000000000000000000000000938387860589129116166107865786858712940586129084161661075957859005841291161661072c57500290565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6012036012811161062a576107c79061061c565b90811561081d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f800000000000000000000000000000000000000000000000000000000000000082141661062a570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220faffb97e35f185082ba46e66173c325b777d9cd44c447acf25bfa3a605fbe06864736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c000000000000000000000000ff30586cd0f29ed462364c7e81375fc0c71219b1
-----Decoded View---------------
Arg [0] : chronicle (address): 0x74661a9ea74fD04975c6eBc6B155Abf8f885636c
Arg [1] : chainlink (address): 0xfF30586cD0F29eD462364C7e81375FC0C71219b1
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000074661a9ea74fd04975c6ebc6b155abf8f885636c
Arg [1] : 000000000000000000000000ff30586cd0f29ed462364c7e81375fc0c71219b1
Loading...
Loading
Loading...
Loading

Multichain Portfolio | 34 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.