Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
L1VeFXSTotalSupplyOracle
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity)
/**
*Submitted for verification at fraxscan.com on 2024-06-07
*/
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// src/contracts/VestedFXS-and-Flox/VestedFXS/OwnedV2.sol
// https://docs.synthetix.io/contracts/Owned
contract OwnedV2 {
error OwnerCannotBeZero();
error InvalidOwnershipAcceptance();
error OnlyOwner();
address public owner;
address public nominatedOwner;
constructor(address _owner) {
// require(_owner != address(0), "Owner address cannot be 0");
if (_owner == address(0)) revert OwnerCannotBeZero();
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
// require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
if (msg.sender != nominatedOwner) revert InvalidOwnershipAcceptance();
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner() {
// require(msg.sender == owner, "Only the contract owner may perform this action");
if (msg.sender != owner) revert OnlyOwner();
_;
}
function _onlyOwner() internal view {
if (msg.sender != owner) revert OnlyOwner();
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// src/contracts/VestedFXS-and-Flox/VestedFXS/L1VeFXSTotalSupplyOracle.sol
/**
* ====================================================================
* | ______ _______ |
* | / _____________ __ __ / ____(_____ ____ _____ ________ |
* | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
* | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
* | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
* | |
* ====================================================================
* ===================== L1VeFXSTotalSupplyOracle =====================
* ====================================================================
* Bot-set Oracle for reporting the Ethereum Mainnet veFXS totalSupply() info.
* Eventually plan to update L1VeFXS with a proof-based solution
* Frax Finance: https://github.com/FraxFinance
*/
/* solhint-disable max-line-length, not-rely-on-time */
contract L1VeFXSTotalSupplyOracle is OwnedV2 {
/// @notice The last veFXS totalSupply data point
uint256 private totalSupplyStored;
/// @notice The block on Mainnet when the veFXS totalSupply was read
uint128 private blkWhenTotalSupplyRead;
/// @notice The timestamp on Mainnet when the veFXS totalSupply was read
uint128 private tsWhenTotalSupplyRead;
/// @notice When the information was last updated by the bot
uint256 public lastBotUpdate;
/// @notice Address of the bot that is allowed to update the contract
address public botAddress;
/**
* @notice Initialize contract
* @param _owner The owner of this contract
* @param _bot Address of the bot that is allowed to post
* @param _initTtlSupplyStored Initial/seed value of totalSupplyStored
* @param _initBlkWhenTotalSupplyRead Initial/seed value of blkWhenTotalSupplyRead
* @param _initTsWhenTtlSupplyRead Initial/seed value of tsWhenTotalSupplyRead
*/
constructor(
address _owner,
address _bot,
uint256 _initTtlSupplyStored,
uint128 _initBlkWhenTotalSupplyRead,
uint128 _initTsWhenTtlSupplyRead
) OwnedV2(_owner) {
// Set bot address
botAddress = _bot;
// Set seed values
totalSupplyStored = _initTtlSupplyStored;
blkWhenTotalSupplyRead = _initBlkWhenTotalSupplyRead;
tsWhenTotalSupplyRead = _initTsWhenTtlSupplyRead;
if (_initTsWhenTtlSupplyRead > 0) lastBotUpdate = _initTsWhenTtlSupplyRead;
}
/* ========== MODIFIERS ========== */
modifier onlyByOwnBot() {
require(msg.sender == owner || msg.sender == botAddress, "You are not the owner or the bot");
_;
}
/* ============ VIEWS ============ */
/// @notice Get the most recent totalSupply from Mainnet veFXS
/// @param _totalSupply The last reported Mainnet veFXS totalSupply
function totalSupply() external view returns (uint256 _totalSupply) {
return totalSupplyStored;
}
/// @notice Get the most recent totalSupply from Mainnet veFXS along with the time it was read
/// @param _totalSupply The last reported Mainnet veFXS totalSupply
/// @param _blk Block when the totalSupply was read on Mainnet
/// @param _ts Timestamp when the totalSupply was read on Mainnet
function totalSupplyExtra() external view returns (uint256 _totalSupply, uint128 _blk, uint128 _ts) {
return (totalSupplyStored, blkWhenTotalSupplyRead, tsWhenTotalSupplyRead);
}
// ==============================================================================
// BOT FUNCTIONS
// ==============================================================================
/// @notice Set the most recent totalSupply from Mainnet veFXS
/// @param _totalSupply The last reported Mainnet veFXS totalSupply
/// @param _blk Block when the totalSupply was read on Mainnet
/// @param _ts Timestamp when the totalSupply was read on Mainnet
function updateInfo(uint256 _totalSupply, uint128 _blk, uint128 _ts) external onlyByOwnBot {
totalSupplyStored = _totalSupply;
blkWhenTotalSupplyRead = _blk;
tsWhenTotalSupplyRead = _ts;
}
// ==============================================================================
// RESTRICTED FUNCTIONS
// ==============================================================================
/// @notice Set the bot address
/// @param _newBot The address of the timelock
function setTimelock(address _newBot) external onlyOwner {
botAddress = _newBot;
}
// ==============================================================================
// EVENTS
// ==============================================================================
/// @notice When the veFXS info is updated
/// @param totalSupply veFXS totalSupply from mainnet
/// @param blk Block when the totalSupply was read on Mainnet
/// @param ts Timestamp when the totalSupply was read on Mainnet
event InfoUpdated(uint256 totalSupply, uint128 blk, uint128 ts);
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_bot","type":"address"},{"internalType":"uint256","name":"_initTtlSupplyStored","type":"uint256"},{"internalType":"uint128","name":"_initBlkWhenTotalSupplyRead","type":"uint128"},{"internalType":"uint128","name":"_initTsWhenTtlSupplyRead","type":"uint128"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidOwnershipAcceptance","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[],"name":"OwnerCannotBeZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"blk","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"ts","type":"uint128"}],"name":"InfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"botAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastBotUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newBot","type":"address"}],"name":"setTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupplyExtra","outputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint128","name":"_blk","type":"uint128"},{"internalType":"uint128","name":"_ts","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint128","name":"_blk","type":"uint128"},{"internalType":"uint128","name":"_ts","type":"uint128"}],"name":"updateInfo","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b506040516107a23803806107a283398101604081905261002f91610139565b846001600160a01b03811661005757604051639b15e16f60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a150600580546001600160a01b0319166001600160a01b03861617905560028390556001600160801b03828116600160801b91831691820217600355156100fc576001600160801b0381166004555b5050505050610197565b80516001600160a01b038116811461011d57600080fd5b919050565b80516001600160801b038116811461011d57600080fd5b600080600080600060a0868803121561015157600080fd5b61015a86610106565b945061016860208701610106565b93506040860151925061017d60608701610122565b915061018b60808701610122565b90509295509295909350565b6105fc806101a66000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c806379ba5097116100765780638da7b32b1161005b5780638da7b32b1461018f57806391e7d9e914610198578063bdacb303146101e257600080fd5b806379ba5097146101675780638da5cb5b1461016f57600080fd5b80634bf4f423116100a75780634bf4f423146100ef57806353a47bb71461013457806376867c7f1461015457600080fd5b80631627540c146100c357806318160ddd146100d8575b600080fd5b6100d66100d1366004610528565b6101f5565b005b6002545b6040519081526020015b60405180910390f35b60055461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e6565b60015461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b6100d661016236600461058a565b6102bf565b6100d661039b565b60005461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b6100dc60045481565b600254600354604080519283526fffffffffffffffffffffffffffffffff8083166020850152700100000000000000000000000000000000909204909116908201526060016100e6565b6100d66101f0366004610528565b610490565b60005473ffffffffffffffffffffffffffffffffffffffff163314610246576040517f5fc483c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314806102fc575060055473ffffffffffffffffffffffffffffffffffffffff1633145b610366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f596f7520617265206e6f7420746865206f776e6572206f722074686520626f74604482015260640160405180910390fd5b6002929092556fffffffffffffffffffffffffffffffff91821670010000000000000000000000000000000002911617600355565b60015473ffffffffffffffffffffffffffffffffffffffff1633146103ec576040517fd74b334e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104e1576040517f5fc483c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006020828403121561053a57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461055e57600080fd5b9392505050565b80356fffffffffffffffffffffffffffffffff8116811461058557600080fd5b919050565b60008060006060848603121561059f57600080fd5b833592506105af60208501610565565b91506105bd60408501610565565b9050925092509256fea26469706673582212200c95470f98b31f9629d09108f12b39ab408857b0b3de9743bf529d40f036218764736f6c634300081700330000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a350000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a35000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100be5760003560e01c806379ba5097116100765780638da7b32b1161005b5780638da7b32b1461018f57806391e7d9e914610198578063bdacb303146101e257600080fd5b806379ba5097146101675780638da5cb5b1461016f57600080fd5b80634bf4f423116100a75780634bf4f423146100ef57806353a47bb71461013457806376867c7f1461015457600080fd5b80631627540c146100c357806318160ddd146100d8575b600080fd5b6100d66100d1366004610528565b6101f5565b005b6002545b6040519081526020015b60405180910390f35b60055461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e6565b60015461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b6100d661016236600461058a565b6102bf565b6100d661039b565b60005461010f9073ffffffffffffffffffffffffffffffffffffffff1681565b6100dc60045481565b600254600354604080519283526fffffffffffffffffffffffffffffffff8083166020850152700100000000000000000000000000000000909204909116908201526060016100e6565b6100d66101f0366004610528565b610490565b60005473ffffffffffffffffffffffffffffffffffffffff163314610246576040517f5fc483c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314806102fc575060055473ffffffffffffffffffffffffffffffffffffffff1633145b610366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f596f7520617265206e6f7420746865206f776e6572206f722074686520626f74604482015260640160405180910390fd5b6002929092556fffffffffffffffffffffffffffffffff91821670010000000000000000000000000000000002911617600355565b60015473ffffffffffffffffffffffffffffffffffffffff1633146103ec576040517fd74b334e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104e1576040517f5fc483c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006020828403121561053a57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461055e57600080fd5b9392505050565b80356fffffffffffffffffffffffffffffffff8116811461058557600080fd5b919050565b60008060006060848603121561059f57600080fd5b833592506105af60208501610565565b91506105bd60408501610565565b9050925092509256fea26469706673582212200c95470f98b31f9629d09108f12b39ab408857b0b3de9743bf529d40f036218764736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a350000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a35000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _owner (address): 0x4600D3b12c39AF925C2C07C487d31D17c1e32A35
Arg [1] : _bot (address): 0x4600D3b12c39AF925C2C07C487d31D17c1e32A35
Arg [2] : _initTtlSupplyStored (uint256): 0
Arg [3] : _initBlkWhenTotalSupplyRead (uint128): 0
Arg [4] : _initTsWhenTtlSupplyRead (uint128): 0
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a35
Arg [1] : 0000000000000000000000004600d3b12c39af925c2c07c487d31d17c1e32a35
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
2617:4214:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;623:141;;;;;;:::i;:::-;;:::i;:::-;;4594:111;4680:17;;4594:111;;;474:25:1;;;462:2;447:18;4594:111:0;;;;;;;;3189:25;;;;;;;;;;;;686:42:1;674:55;;;656:74;;644:2;629:18;3189:25:0;510:226:1;333:29:0;;;;;;;;;5703:220;;;;;;:::i;:::-;;:::i;772:354::-;;;:::i;306:20::-;;;;;;;;;3077:28;;;;;;5025:192;5144:17;;5163:22;;5025:192;;;1469:25:1;;;5163:22:0;;;;1578:2:1;1563:18;;1556:43;5187:21:0;;;;;;;1615:18:1;;;1608:43;1457:2;1442:18;5025:192:0;1267:390:1;6225:96:0;;;;;;:::i;:::-;;:::i;623:141::-;1277:5;;;;1263:10;:19;1259:43;;1291:11;;;;;;;;;;;;;;1259:43;695:14:::1;:23:::0;;;::::1;;::::0;::::1;::::0;;::::1;::::0;;;734:22:::1;::::0;656:74:1;;;734:22:0::1;::::0;644:2:1;629:18;734:22:0::1;;;;;;;623:141:::0;:::o;5703:220::-;4310:5;;;;4296:10;:19;;:47;;-1:-1:-1;4333:10:0;;;;4319;:24;4296:47;4288:92;;;;;;;1864:2:1;4288:92:0;;;1846:21:1;;;1883:18;;;1876:30;1942:34;1922:18;;;1915:62;1994:18;;4288:92:0;;;;;;;;5805:17:::1;:32:::0;;;;5848:29:::1;5888:27:::0;;::::1;::::0;::::1;5848:29:::0;::::1;5888:27;5848:22;5888:27:::0;5703:220::o;772:354::-;945:14;;;;931:10;:28;927:69;;968:28;;;;;;;;;;;;;;927:69;1025:5;;;1032:14;1012:35;;;1025:5;;;;2258:34:1;;1032:14:0;;;;2323:2:1;2308:18;;2301:43;1012:35:0;;2170:18:1;1012:35:0;;;;;;;1066:14;;;;1058:22;;;;;;1066:14;;;1058:22;;;;1091:27;;;772:354::o;6225:96::-;1277:5;;;;1263:10;:19;1259:43;;1291:11;;;;;;;;;;;;;;1259:43;6293:10:::1;:20:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;6225:96::o;14:309:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;181:9;168:23;231:42;224:5;220:54;213:5;210:65;200:93;;289:1;286;279:12;200:93;312:5;14:309;-1:-1:-1;;;14:309:1:o;741:188::-;809:20;;869:34;858:46;;848:57;;838:85;;919:1;916;909:12;838:85;741:188;;;:::o;934:328::-;1011:6;1019;1027;1080:2;1068:9;1059:7;1055:23;1051:32;1048:52;;;1096:1;1093;1086:12;1048:52;1132:9;1119:23;1109:33;;1161:38;1195:2;1184:9;1180:18;1161:38;:::i;:::-;1151:48;;1218:38;1252:2;1241:9;1237:18;1218:38;:::i;:::-;1208:48;;934:328;;;;;:::o
Swarm Source
ipfs://0c95470f98b31f9629d09108f12b39ab408857b0b3de9743bf529d40f0362187
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
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.