Contract Overview
Balance:
0 GLMR
GLMR Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x35d000dac84a1e2f21e681f972e406a2f9fb195acf1e442a7f34df7d717509c5 | 0x60806040 | 906657 | 285 days 22 hrs ago | Lido Staked Polkadot: Deployer | IN | Create: LedgerBeacon | 0 GLMR | 0.073686 |
[ Download CSV Export ]
Contract Name:
LedgerBeacon
Compiler Version
v0.8.10+commit.fc410830
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "IBeacon.sol"; import "Address.sol"; import "ILido.sol"; import "IAuthManager.sol"; /** * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their * implementation contract, which is where they will delegate all function calls. * * An ROLE_BEACON_MANAGER is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. */ contract LedgerBeacon is IBeacon { // LIDO address address public LIDO; // current revision index uint256 public currentRevision; // index of newest revision uint256 public latestRevision; // array of implementations address[] public revisionImplementation; // revision index for specific ledger (if revision == 0 => current revision used) mapping(address => uint256) public ledgerRevision; // index of max revision for ledger mapping(address => uint256) public ledgerMaxRevision; // Beacon manager role bytes32 internal constant ROLE_BEACON_MANAGER = keccak256("ROLE_BEACON_MANAGER"); /** * @dev Emitted when new implementation revision added. */ event NewRevision(address indexed implementation); /** * @dev Emitted when current revision updated. */ event NewCurrentRevision(address indexed implementation); /** * @dev Emitted when ledger current revision updated. */ event NewLedgerRevision(address indexed ledger, address indexed implementation); modifier auth(bytes32 role) { require(IAuthManager(ILido(LIDO).AUTH_MANAGER()).has(role, msg.sender), "LEDGER_BEACON: UNAUTHOROZED"); _; } /** * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the * beacon. */ constructor(address implementation_, address _lido) { _setImplementation(implementation_); currentRevision = latestRevision; LIDO = _lido; } /** * @dev Returns the current implementation address. */ function implementation() public view virtual override returns (address) { if (ledgerRevision[msg.sender] != 0) { return revisionImplementation[ledgerRevision[msg.sender] - 1]; } return revisionImplementation[currentRevision - 1]; } /** * @dev Set ledger revision to `_revision` */ function setLedgerRevision(address _ledger, uint256 _revision) external auth(ROLE_BEACON_MANAGER) { require( (ledgerRevision[_ledger] == 0 && _revision > ledgerMaxRevision[_ledger] && _revision <= latestRevision) || (ledgerRevision[_ledger] > 0 && _revision == 0), "LEDGER_BEACON: INCORRECT_REVISION" ); ledgerRevision[_ledger] = _revision; if (_revision == 0) { _revision = currentRevision; } else { ledgerMaxRevision[_ledger] = _revision; } emit NewLedgerRevision(_ledger, revisionImplementation[_revision - 1]); } /** * @dev Update current revision */ function setCurrentRevision(uint256 _newCurrentRevision) external auth(ROLE_BEACON_MANAGER) { require(_newCurrentRevision > currentRevision && _newCurrentRevision <= latestRevision, "LEDGER_BEACON: INCORRECT_REVISION"); currentRevision = _newCurrentRevision; emit NewCurrentRevision(revisionImplementation[_newCurrentRevision - 1]); } /** * @dev Add new revision of implementation to beacon. * * Emits an {Upgraded} event. * * Requirements: * * - msg.sender must be the owner of the contract. * - `newImplementation` must be a contract. */ function addImplementation(address newImplementation) public auth(ROLE_BEACON_MANAGER) { _setImplementation(newImplementation); emit NewRevision(newImplementation); } /** * @dev Sets the implementation contract address for this beacon * * Requirements: * * - `newImplementation` must be a contract. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "LEDGER_BEACON: implementation is not a contract"); latestRevision += 1; revisionImplementation.push(newImplementation); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "Types.sol"; interface ILido { function MAX_ALLOWABLE_DIFFERENCE() external view returns(uint128); function deposit(uint256 amount) external returns (uint256); function distributeRewards(uint256 totalRewards, uint256 ledgerBalance) external; function distributeLosses(uint256 totalLosses, uint256 ledgerBalance) external; function getStashAccounts() external view returns (bytes32[] memory); function getLedgerAddresses() external view returns (address[] memory); function ledgerStake(address ledger) external view returns (uint256); function transferFromLedger(uint256 amount, uint256 excess) external; function transferFromLedger(uint256 amount) external; function transferToLedger(uint256 amount) external; function flushStakes() external; function findLedger(bytes32 stash) external view returns (address); function AUTH_MANAGER() external returns(address); function ORACLE_MASTER() external view returns (address); function decimals() external view returns (uint8); function getPooledKSMByShares(uint256 sharesAmount) external view returns (uint256); function getSharesByPooledKSM(uint256 amount) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface Types { struct Fee{ uint16 total; uint16 operators; uint16 developers; uint16 treasury; } struct Stash { bytes32 stashAccount; uint64 eraId; } enum LedgerStatus { // bonded but not participate in staking Idle, // participate as nominator Nominator, // participate as validator Validator, // not bonded not participate in staking None } struct UnlockingChunk { uint128 balance; uint64 era; } struct OracleData { bytes32 stashAccount; bytes32 controllerAccount; LedgerStatus stakeStatus; // active part of stash balance uint128 activeBalance; // locked for stake stash balance. uint128 totalBalance; // totalBalance = activeBalance + sum(unlocked.balance) UnlockingChunk[] unlocking; uint32[] claimedRewards; // stash account balance. It includes locked (totalBalance) balance assigned // to a controller. uint128 stashBalance; // slashing spans for ledger uint32 slashingSpans; } struct RelaySpec { uint16 maxValidatorsPerLedger; uint128 minNominatorBalance; uint128 ledgerMinimumActiveBalance; uint256 maxUnlockingChunks; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IAuthManager { function has(bytes32 role, address member) external view returns (bool); function add(bytes32 role, address member) external; function remove(bytes32 role, address member) external; }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 10 }, "libraries": { "LedgerBeacon.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"address","name":"_lido","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"NewCurrentRevision","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"ledger","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"NewLedgerRevision","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"NewRevision","type":"event"},{"inputs":[],"name":"LIDO","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"addImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRevision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRevision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ledgerMaxRevision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ledgerRevision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"revisionImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCurrentRevision","type":"uint256"}],"name":"setCurrentRevision","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ledger","type":"address"},{"internalType":"uint256","name":"_revision","type":"uint256"}],"name":"setLedgerRevision","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610bff380380610bff83398101604081905261002f9161016b565b61003882610064565b600254600155600080546001600160a01b0319166001600160a01b0392909216919091179055506101c4565b6100778161014960201b6107581760201c565b6100df5760405162461bcd60e51b815260206004820152602f60248201527f4c45444745525f424541434f4e3a20696d706c656d656e746174696f6e20697360448201526e081b9bdd08184818dbdb9d1c9858dd608a1b606482015260840160405180910390fd5b6001600260008282546100f2919061019e565b9091555050600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b3b151590565b80516001600160a01b038116811461016657600080fd5b919050565b6000806040838503121561017e57600080fd5b6101878361014f565b91506101956020840161014f565b90509250929050565b600082198211156101bf57634e487b7160e01b600052601160045260246000fd5b500190565b610a2c806101d36000396000f3fe608060405234801561001057600080fd5b506004361061008e5760003560e01c8063078b97fe146100935780635637c85e146100af578063594af68b146100b85780635a5c95ae146100d85780635c60da1b146100f857806362dd5b2c146101185780638b21f1701461012b578063ad46d5f31461013e578063c6e2a40014610153578063d7d9086314610166575b600080fd5b61009c60015481565b6040519081526020015b60405180910390f35b61009c60025481565b61009c6100c6366004610846565b60056020526000908152604090205481565b61009c6100e6366004610846565b60046020526000908152604090205481565b610100610179565b6040516001600160a01b0390911681526020016100a6565b61010061012636600461086a565b6101e7565b600054610100906001600160a01b031681565b61015161014c36600461086a565b610211565b005b610151610161366004610846565b6103bc565b610151610174366004610883565b61050d565b33600090815260046020526040812054156101d757336000908152600460205260409020546003906101ad906001906108c5565b815481106101bd576101bd6108dc565b6000918252602090912001546001600160a01b0316919050565b6003600180546101ad91906108c5565b600381815481106101f757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805160206109d783398151915260008054906101000a90046001600160a01b03166001600160a01b031663a1e206c76040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029791906108f2565b6001600160a01b031663eff11b2c82336040518363ffffffff1660e01b81526004016102c492919061090f565b602060405180830381865afa1580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190610926565b61032a5760405162461bcd60e51b815260040161032190610948565b60405180910390fd5b6001548211801561033d57506002548211155b6103595760405162461bcd60e51b81526004016103219061097d565b600182815560039061036b90846108c5565b8154811061037b5761037b6108dc565b60009182526020822001546040516001600160a01b03909116917f1a8dd38a3306ba324b59cdd94317161d6d760814796c8e2fbeafa96bf734b0b991a25050565b6000805160206109d783398151915260008054906101000a90046001600160a01b03166001600160a01b031663a1e206c76040518163ffffffff1660e01b81526004016020604051808303816000875af115801561041e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044291906108f2565b6001600160a01b031663eff11b2c82336040518363ffffffff1660e01b815260040161046f92919061090f565b602060405180830381865afa15801561048c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b09190610926565b6104cc5760405162461bcd60e51b815260040161032190610948565b6104d58261075e565b6040516001600160a01b038316907f9da3a12664246b3a91b1e92c39d7a591ab70c5c32805d4f5dc580c09a7d3bae390600090a25050565b6000805160206109d783398151915260008054906101000a90046001600160a01b03166001600160a01b031663a1e206c76040518163ffffffff1660e01b81526004016020604051808303816000875af115801561056f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059391906108f2565b6001600160a01b031663eff11b2c82336040518363ffffffff1660e01b81526004016105c092919061090f565b602060405180830381865afa1580156105dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106019190610926565b61061d5760405162461bcd60e51b815260040161032190610948565b6001600160a01b03831660009081526004602052604090205415801561065a57506001600160a01b03831660009081526005602052604090205482115b801561066857506002548211155b8061069357506001600160a01b03831660009081526004602052604090205415801590610693575081155b6106af5760405162461bcd60e51b81526004016103219061097d565b6001600160a01b0383166000908152600460205260409020829055816106d95760015491506106f5565b6001600160a01b03831660009081526005602052604090208290555b60036107026001846108c5565b81548110610712576107126108dc565b60009182526020822001546040516001600160a01b0391821692918616917fc480c996c754a258bc86eda52e1114d58412383b98e88cebe8f1be817cb5684991a3505050565b3b151590565b803b6107c45760405162461bcd60e51b815260206004820152602f60248201527f4c45444745525f424541434f4e3a20696d706c656d656e746174696f6e20697360448201526e081b9bdd08184818dbdb9d1c9858dd608a1b6064820152608401610321565b6001600260008282546107d791906109be565b9091555050600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116811461084357600080fd5b50565b60006020828403121561085857600080fd5b81356108638161082e565b9392505050565b60006020828403121561087c57600080fd5b5035919050565b6000806040838503121561089657600080fd5b82356108a18161082e565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156108d7576108d76108af565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561090457600080fd5b81516108638161082e565b9182526001600160a01b0316602082015260400190565b60006020828403121561093857600080fd5b8151801515811461086357600080fd5b6020808252601b908201527a13115111d15497d0915050d3d38e8815539055551213d493d69151602a1b604082015260600190565b60208082526021908201527f4c45444745525f424541434f4e3a20494e434f52524543545f5245564953494f6040820152602760f91b606082015260800190565b600082198211156109d1576109d16108af565b50019056fe9336eb28e461adb6ba7e620f5006a6952a65a21a4db92c2edb104bf7f1c38c63a2646970667358221220b13df46d6753afc52f72334359b49b287c7d950833a8eab7034609014f8cf9c264736f6c634300080a0033000000000000000000000000891f6825afebfbb4bf6889b86724ac859477e4c4000000000000000000000000fa36fe1da08c89ec72ea1f0143a35bfd5daea108
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000891f6825afebfbb4bf6889b86724ac859477e4c4000000000000000000000000fa36fe1da08c89ec72ea1f0143a35bfd5daea108
-----Decoded View---------------
Arg [0] : implementation_ (address): 0x891f6825afebfbb4bf6889b86724ac859477e4c4
Arg [1] : _lido (address): 0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000891f6825afebfbb4bf6889b86724ac859477e4c4
Arg [1] : 000000000000000000000000fa36fe1da08c89ec72ea1f0143a35bfd5daea108
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.