commit c2c07aadf7f286115bd12b0f2140a2abe11c6ffe Author: Marco van Dijk Date: Tue Mar 1 23:53:37 2022 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd8c3b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules +package-lock.json +yarn.lock +log.txt +build/ +TODO diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..3bfca08 --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/src/config.js \ No newline at end of file diff --git a/backend/ecosystem.config.js b/backend/ecosystem.config.js new file mode 100644 index 0000000..73466da --- /dev/null +++ b/backend/ecosystem.config.js @@ -0,0 +1,16 @@ +module.exports = { + apps : [{ + name : "backend", + script : "./src/index.js", + cwd : "/var/www/backend", + env_production: { + NODE_ENV: "production" + }, + env_development: { + NODE_ENV: "development" + }, + env_local: { + NODE_ENV: "local" + } + }] +} diff --git a/backend/package.json b/backend/package.json new file mode 100644 index 0000000..7ba6eb3 --- /dev/null +++ b/backend/package.json @@ -0,0 +1,34 @@ +{ + "name": "LivepeerEvents", + "version": "0.4.2", + "description": "", + "main": "./src/index.js", + "module": "./src/server.js", + "scripts": { + "prod": "NODE_ENV=production pm2 start ecosystem.config.js", + "start": "NODE_ENV=production node ./src/index.js", + "dev": "NODE_ENV=development nodemon ./src/index.js", + "local": "NODE_ENV=local nodemon ./src/index.js" + }, + "keywords": [], + "author": "Marco van Dijk", + "license": "WTFPL", + "dependencies": { + "@alch/alchemy-web3": "^1.2.4", + "alchemy-api": "^1.3.3", + "coinmarketcap-api": "^3.1.1", + "connect-mongo": "^3.1.2", + "crypto-js": "^3.1.9-1", + "esm": "^3.2.20", + "express": "^4.17.1", + "express-session": "^1.17.0", + "install": "^0.13.0", + "joi": "^14.3.1", + "mongoose": "^5.12.3", + "npm": "^8.5.2", + "web3": "^1.7.0" + }, + "devDependencies": { + "nodemon": "^1.18.10" + } +} diff --git a/backend/src/abi/BondingManagerProxy.json b/backend/src/abi/BondingManagerProxy.json new file mode 100644 index 0000000..3cf942c --- /dev/null +++ b/backend/src/abi/BondingManagerProxy.json @@ -0,0 +1,183 @@ +{ + "address": "0x35Bcf3c30594191d53231E4FF333E8A770453e40", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_targetContractId", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "param", + "type": "string" + } + ], + "name": "ParameterUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "SetController", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "controller", + "outputs": [ + { + "internalType": "contract IController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetContractId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x40ad1a638363b6b3b26dc3664972fd42f024568678e363cb8795b33924a15e9f", + "receipt": { + "to": null, + "from": "0xB5Af4138f0f33be0D6414Eb25271B9C2Dc245fb5", + "contractAddress": "0x35Bcf3c30594191d53231E4FF333E8A770453e40", + "transactionIndex": 0, + "gasUsed": "2316072", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd9be4d6e9d912a7600624d400b59064d60b250ccca6e6e5652a34173e122484f", + "transactionHash": "0x40ad1a638363b6b3b26dc3664972fd42f024568678e363cb8795b33924a15e9f", + "logs": [], + "blockNumber": 5856381, + "cumulativeGasUsed": "114052", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD8E8328501E9645d16Cf49539efC04f734606ee4", + "0xfc6f6f33d2bb065ac61cbdd4dbe4b7adf6f3e7e6c6a3d1fe297cbf9a187092e4" + ], + "numDeployments": 1, + "solcInputHash": "fbb7c6c031c5ea66d51283bdfeec92b9", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_controller\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_targetContractId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"param\",\"type\":\"string\"}],\"name\":\"ParameterUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"SetController\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"internalType\":\"contract IController\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_controller\",\"type\":\"address\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetContractId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Both this proxy contract and its target contract MUST inherit from ManagerProxyTarget in order to guarantee that both contracts have the same storage layout. Differing storage layouts in a proxy contract and target contract can potentially break the delegate proxy upgradeability mechanism. Since this proxy contract inherits from ManagerProxyTarget which inherits from Manager, it implements the setController() function. The target contract will also implement setController() since it also inherits from ManagerProxyTarget. Thus, any transaction sent to the proxy that calls setController() will execute against the proxy instead of the target. As a result, developers should keep in mind that the proxy will always execute the same logic for setController() regardless of the setController() implementation on the target contract. Generally, developers should not add any additional functions to this proxy contract because any function implemented on the proxy will always be executed against the proxy and the call **will not** be forwarded to the target contract\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_controller\":\"Address of Controller that this contract will be registered with\",\"_targetContractId\":\"contract ID of the target contract\"}},\"setController(address)\":{\"params\":{\"_controller\":\"Controller contract address\"}}},\"title\":\"ManagerProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"ManagerProxy constructor. Invokes constructor of base Manager contract with provided Controller address. Also, sets the contract ID of the target contract that function calls will be executed on.\"},\"setController(address)\":{\"notice\":\"Set controller. Only callable by current controller\"}},\"notice\":\"A proxy contract that uses delegatecall to execute function calls on a target contract using its own storage context. The target contract is a Manager contract that is registered with the Controller.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ManagerProxy.sol\":\"ManagerProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/IController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./zeppelin/Pausable.sol\\\";\\n\\nabstract contract IController is Pausable {\\n event SetContractInfo(bytes32 id, address contractAddress, bytes20 gitCommitHash);\\n\\n function setContractInfo(\\n bytes32 _id,\\n address _contractAddress,\\n bytes20 _gitCommitHash\\n ) external virtual;\\n\\n function updateController(bytes32 _id, address _controller) external virtual;\\n\\n function getContract(bytes32 _id) public view virtual returns (address);\\n}\\n\",\"keccak256\":\"0x34ea30a2b44d0cbec58fc1d703476ff0085b0fdadab0cd65c35c00b8867f7546\",\"license\":\"MIT\"},\"contracts/IManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\ninterface IManager {\\n event SetController(address controller);\\n event ParameterUpdate(string param);\\n\\n function setController(address _controller) external;\\n}\\n\",\"keccak256\":\"0xc179e4cecc593741514237d5194b4aaac6b829789629fa19ed04f572a8530481\",\"license\":\"MIT\"},\"contracts/Manager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./IManager.sol\\\";\\nimport \\\"./IController.sol\\\";\\n\\ncontract Manager is IManager {\\n // Controller that contract is registered with\\n IController public controller;\\n\\n // Check if sender is controller\\n modifier onlyController() {\\n _onlyController();\\n _;\\n }\\n\\n // Check if sender is controller owner\\n modifier onlyControllerOwner() {\\n _onlyControllerOwner();\\n _;\\n }\\n\\n // Check if controller is not paused\\n modifier whenSystemNotPaused() {\\n _whenSystemNotPaused();\\n _;\\n }\\n\\n // Check if controller is paused\\n modifier whenSystemPaused() {\\n _whenSystemPaused();\\n _;\\n }\\n\\n constructor(address _controller) {\\n controller = IController(_controller);\\n }\\n\\n /**\\n * @notice Set controller. Only callable by current controller\\n * @param _controller Controller contract address\\n */\\n function setController(address _controller) external onlyController {\\n controller = IController(_controller);\\n\\n emit SetController(_controller);\\n }\\n\\n function _onlyController() private view {\\n require(msg.sender == address(controller), \\\"caller must be Controller\\\");\\n }\\n\\n function _onlyControllerOwner() private view {\\n require(msg.sender == controller.owner(), \\\"caller must be Controller owner\\\");\\n }\\n\\n function _whenSystemNotPaused() private view {\\n require(!controller.paused(), \\\"system is paused\\\");\\n }\\n\\n function _whenSystemPaused() private view {\\n require(controller.paused(), \\\"system is not paused\\\");\\n }\\n}\\n\",\"keccak256\":\"0xc415e3f42da9f82ddd5953031f3f26aed824368fcc34d3b8a17015bfe80dc109\",\"license\":\"MIT\"},\"contracts/ManagerProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./ManagerProxyTarget.sol\\\";\\n\\n/**\\n * @title ManagerProxy\\n * @notice A proxy contract that uses delegatecall to execute function calls on a target contract using its own storage context.\\n The target contract is a Manager contract that is registered with the Controller.\\n * @dev Both this proxy contract and its target contract MUST inherit from ManagerProxyTarget in order to guarantee\\n that both contracts have the same storage layout. Differing storage layouts in a proxy contract and target contract can\\n potentially break the delegate proxy upgradeability mechanism. Since this proxy contract inherits from ManagerProxyTarget which inherits\\n from Manager, it implements the setController() function. The target contract will also implement setController() since it also inherits\\n from ManagerProxyTarget. Thus, any transaction sent to the proxy that calls setController() will execute against the proxy instead\\n of the target. As a result, developers should keep in mind that the proxy will always execute the same logic for setController() regardless\\n of the setController() implementation on the target contract. Generally, developers should not add any additional functions to this proxy contract\\n because any function implemented on the proxy will always be executed against the proxy and the call **will not** be forwarded to the target contract\\n */\\ncontract ManagerProxy is ManagerProxyTarget {\\n /**\\n * @notice ManagerProxy constructor. Invokes constructor of base Manager contract with provided Controller address.\\n * Also, sets the contract ID of the target contract that function calls will be executed on.\\n * @param _controller Address of Controller that this contract will be registered with\\n * @param _targetContractId contract ID of the target contract\\n */\\n constructor(address _controller, bytes32 _targetContractId) Manager(_controller) {\\n targetContractId = _targetContractId;\\n }\\n\\n /**\\n * @notice Fallback function that delegates calls to target contract when there is no msg.data\\n */\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @notice Fallback function that delegates calls to target contract when there is msg.data\\n */\\n fallback() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Uses delegatecall to execute function calls on this proxy contract's target contract using its own storage context.\\n This fallback function will look up the address of the target contract using the Controller and the target contract ID.\\n It will then use the calldata for a function call as the data payload for a delegatecall on the target contract. The return value\\n of the executed function call will also be returned\\n */\\n function _fallback() private {\\n address target = controller.getContract(targetContractId);\\n require(target != address(0), \\\"target contract must be registered\\\");\\n\\n assembly {\\n // Solidity keeps a free memory pointer at position 0x40 in memory\\n let freeMemoryPtrPosition := 0x40\\n // Load the free memory pointer\\n let calldataMemoryOffset := mload(freeMemoryPtrPosition)\\n // Update free memory pointer to after memory space we reserve for calldata\\n mstore(freeMemoryPtrPosition, add(calldataMemoryOffset, calldatasize()))\\n // Copy calldata (method signature and params of the call) to memory\\n calldatacopy(calldataMemoryOffset, 0x0, calldatasize())\\n\\n // Call method on target contract using calldata which is loaded into memory\\n let ret := delegatecall(gas(), target, calldataMemoryOffset, calldatasize(), 0, 0)\\n\\n // Load the free memory pointer\\n let returndataMemoryOffset := mload(freeMemoryPtrPosition)\\n // Update free memory pointer to after memory space we reserve for returndata\\n mstore(freeMemoryPtrPosition, add(returndataMemoryOffset, returndatasize()))\\n // Copy returndata (result of the method invoked by the delegatecall) to memory\\n returndatacopy(returndataMemoryOffset, 0x0, returndatasize())\\n\\n switch ret\\n case 0 {\\n // Method call failed - revert\\n // Return any error message stored in mem[returndataMemoryOffset..(returndataMemoryOffset + returndatasize)]\\n revert(returndataMemoryOffset, returndatasize())\\n }\\n default {\\n // Return result of method call stored in mem[returndataMemoryOffset..(returndataMemoryOffset + returndatasize)]\\n return(returndataMemoryOffset, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x59d1851363df8c385106e513652ace0d3903382df8b9fed03906650c5484158e\",\"license\":\"MIT\"},\"contracts/ManagerProxyTarget.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./Manager.sol\\\";\\n\\n/**\\n * @title ManagerProxyTarget\\n * @notice The base contract that target contracts used by a proxy contract should inherit from\\n * @dev Both the target contract and the proxy contract (implemented as ManagerProxy) MUST inherit from ManagerProxyTarget in order to guarantee\\n that both contracts have the same storage layout. Differing storage layouts in a proxy contract and target contract can\\n potentially break the delegate proxy upgradeability mechanism\\n */\\nabstract contract ManagerProxyTarget is Manager {\\n // Used to look up target contract address in controller's registry\\n bytes32 public targetContractId;\\n}\\n\",\"keccak256\":\"0x920bcc2def240e06272dc06cbcb9f12976f1698cd4f1020c165af25ee837e553\",\"license\":\"MIT\"},\"contracts/zeppelin/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\n/**\\n * @title Ownable\\n * @dev The Ownable contract has an owner address, and provides basic authorization control\\n * functions, this simplifies the implementation of \\\"user permissions\\\".\\n */\\ncontract Ownable {\\n address public owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\\n * account.\\n */\\n constructor() {\\n owner = msg.sender;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n /**\\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\\n * @param newOwner The address to transfer ownership to.\\n */\\n function transferOwnership(address newOwner) public onlyOwner {\\n require(newOwner != address(0));\\n emit OwnershipTransferred(owner, newOwner);\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x64f114689f2f161c4a4b8fc8442ab914436a33e6021bf17401eaeac73319a419\",\"license\":\"MIT\"},\"contracts/zeppelin/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./Ownable.sol\\\";\\n\\n/**\\n * @title Pausable\\n * @dev Base contract which allows children to implement an emergency stop mechanism.\\n */\\ncontract Pausable is Ownable {\\n event Pause();\\n event Unpause();\\n\\n bool public paused;\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused);\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n */\\n modifier whenPaused() {\\n require(paused);\\n _;\\n }\\n\\n /**\\n * @dev called by the owner to pause, triggers stopped state\\n */\\n function pause() public onlyOwner whenNotPaused {\\n paused = true;\\n emit Pause();\\n }\\n\\n /**\\n * @dev called by the owner to unpause, returns to normal state\\n */\\n function unpause() public onlyOwner whenPaused {\\n paused = false;\\n emit Unpause();\\n }\\n}\\n\",\"keccak256\":\"0xe9635fcac46c22547a08f6977a8c75e7341411f1201f60bdd4c79c26e6c286ef\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516103d93803806103d983398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610092565b6000806040838503121561006b57600080fd5b82516001600160a01b038116811461008257600080fd5b6020939093015192949293505050565b610338806100a16000396000f3fe6080604052600436106100385760003560e01c806351720b411461004f57806392eefe9b14610078578063f77c47911461009857610047565b36610047576100456100d0565b005b6100456100d0565b34801561005b57600080fd5b5061006560015481565b6040519081526020015b60405180910390f35b34801561008457600080fd5b506100456100933660046102c1565b6101f1565b3480156100a457600080fd5b506000546100b8906001600160a01b031681565b6040516001600160a01b03909116815260200161006f565b60008054600154604051631c2d8fb360e31b81526001600160a01b039092169163e16c7d98916101069160040190815260200190565b60206040518083038186803b15801561011e57600080fd5b505afa158015610132573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015691906102e5565b90506001600160a01b0381166101be5760405162461bcd60e51b815260206004820152602260248201527f74617267657420636f6e7472616374206d757374206265207265676973746572604482015261195960f21b60648201526084015b60405180910390fd5b60408051368101825236600082376000803683865af4905081513d810183523d6000823e8180156101ed573d82f35b3d82fd5b6101f961024d565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f709060200160405180910390a150565b6000546001600160a01b031633146102a75760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c65720000000000000060448201526064016101b5565b565b6001600160a01b03811681146102be57600080fd5b50565b6000602082840312156102d357600080fd5b81356102de816102a9565b9392505050565b6000602082840312156102f757600080fd5b81516102de816102a956fea2646970667358221220274e52a3b60c7dff1cad0833c349004759648080531c69a484b94b22224cfa1164736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100385760003560e01c806351720b411461004f57806392eefe9b14610078578063f77c47911461009857610047565b36610047576100456100d0565b005b6100456100d0565b34801561005b57600080fd5b5061006560015481565b6040519081526020015b60405180910390f35b34801561008457600080fd5b506100456100933660046102c1565b6101f1565b3480156100a457600080fd5b506000546100b8906001600160a01b031681565b6040516001600160a01b03909116815260200161006f565b60008054600154604051631c2d8fb360e31b81526001600160a01b039092169163e16c7d98916101069160040190815260200190565b60206040518083038186803b15801561011e57600080fd5b505afa158015610132573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015691906102e5565b90506001600160a01b0381166101be5760405162461bcd60e51b815260206004820152602260248201527f74617267657420636f6e7472616374206d757374206265207265676973746572604482015261195960f21b60648201526084015b60405180910390fd5b60408051368101825236600082376000803683865af4905081513d810183523d6000823e8180156101ed573d82f35b3d82fd5b6101f961024d565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f709060200160405180910390a150565b6000546001600160a01b031633146102a75760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c65720000000000000060448201526064016101b5565b565b6001600160a01b03811681146102be57600080fd5b50565b6000602082840312156102d357600080fd5b81356102de816102a9565b9392505050565b6000602082840312156102f757600080fd5b81516102de816102a956fea2646970667358221220274e52a3b60c7dff1cad0833c349004759648080531c69a484b94b22224cfa1164736f6c63430008090033", + "devdoc": { + "details": "Both this proxy contract and its target contract MUST inherit from ManagerProxyTarget in order to guarantee that both contracts have the same storage layout. Differing storage layouts in a proxy contract and target contract can potentially break the delegate proxy upgradeability mechanism. Since this proxy contract inherits from ManagerProxyTarget which inherits from Manager, it implements the setController() function. The target contract will also implement setController() since it also inherits from ManagerProxyTarget. Thus, any transaction sent to the proxy that calls setController() will execute against the proxy instead of the target. As a result, developers should keep in mind that the proxy will always execute the same logic for setController() regardless of the setController() implementation on the target contract. Generally, developers should not add any additional functions to this proxy contract because any function implemented on the proxy will always be executed against the proxy and the call **will not** be forwarded to the target contract", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_controller": "Address of Controller that this contract will be registered with", + "_targetContractId": "contract ID of the target contract" + } + }, + "setController(address)": { + "params": { + "_controller": "Controller contract address" + } + } + }, + "title": "ManagerProxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "ManagerProxy constructor. Invokes constructor of base Manager contract with provided Controller address. Also, sets the contract ID of the target contract that function calls will be executed on." + }, + "setController(address)": { + "notice": "Set controller. Only callable by current controller" + } + }, + "notice": "A proxy contract that uses delegatecall to execute function calls on a target contract using its own storage context. The target contract is a Manager contract that is registered with the Controller.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2670, + "contract": "contracts/ManagerProxy.sol:ManagerProxy", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(IController)2645" + }, + { + "astId": 2852, + "contract": "contracts/ManagerProxy.sol:ManagerProxy", + "label": "targetContractId", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IController)2645": { + "encoding": "inplace", + "label": "contract IController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/backend/src/abi/BondingManagerTarget.json b/backend/src/abi/BondingManagerTarget.json new file mode 100644 index 0000000..0977aa9 --- /dev/null +++ b/backend/src/abi/BondingManagerTarget.json @@ -0,0 +1,2258 @@ +{ + "address": "0x3757DB506ECd9CBE643660C0F5b70db5b321202C", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "additionalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bondedAmount", + "type": "uint256" + } + ], + "name": "Bond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fees", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startRound", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endRound", + "type": "uint256" + } + ], + "name": "EarningsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "param", + "type": "string" + } + ], + "name": "ParameterUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unbondingLockId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Rebond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transcoder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Reward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "SetController", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transcoder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "activationRound", + "type": "uint256" + } + ], + "name": "TranscoderActivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transcoder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "deactivationRound", + "type": "uint256" + } + ], + "name": "TranscoderDeactivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transcoder", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "finder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "finderReward", + "type": "uint256" + } + ], + "name": "TranscoderSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transcoder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardCut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeShare", + "type": "uint256" + } + ], + "name": "TranscoderUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldDelegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newDelegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldUnbondingLockId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newUnbondingLockId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TransferBond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unbondingLockId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawRound", + "type": "uint256" + } + ], + "name": "Unbond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unbondingLockId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawRound", + "type": "uint256" + } + ], + "name": "WithdrawStake", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "bond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosNext", + "type": "address" + }, + { + "internalType": "address", + "name": "_currDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_currDelegateNewPosNext", + "type": "address" + } + ], + "name": "bondForWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosNext", + "type": "address" + }, + { + "internalType": "address", + "name": "_currDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_currDelegateNewPosNext", + "type": "address" + } + ], + "name": "bondWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_endRound", + "type": "uint256" + } + ], + "name": "claimEarnings", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "controller", + "outputs": [ + { + "internalType": "contract IController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentRoundTotalActiveStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "delegatorStatus", + "outputs": [ + { + "internalType": "enum BondingManager.DelegatorStatus", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getDelegator", + "outputs": [ + { + "internalType": "uint256", + "name": "bondedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fees", + "type": "uint256" + }, + { + "internalType": "address", + "name": "delegateAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "delegatedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastClaimRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextUnbondingLockId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + } + ], + "name": "getDelegatorUnbondingLock", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawRound", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFirstTranscoderInPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "getNextTranscoderInPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBonded", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "getTranscoder", + "outputs": [ + { + "internalType": "uint256", + "name": "lastRewardRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastActiveStakeUpdateRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "activationRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deactivationRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "activeCumulativeRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cumulativeRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cumulativeFees", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastFeeRound", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "getTranscoderEarningsPoolForRound", + "outputs": [ + { + "internalType": "uint256", + "name": "totalStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "transcoderRewardCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "transcoderFeeShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cumulativeRewardFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cumulativeFeeFactor", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTranscoderPoolMaxSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTranscoderPoolSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "isActiveTranscoder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "isRegisteredTranscoder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + } + ], + "name": "isValidUnbondingLock", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRoundTotalActiveStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_endRound", + "type": "uint256" + } + ], + "name": "pendingFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_endRound", + "type": "uint256" + } + ], + "name": "pendingStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + } + ], + "name": "rebond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + } + ], + "name": "rebondFromUnbonded", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_newPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newPosNext", + "type": "address" + } + ], + "name": "rebondFromUnbondedWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_newPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newPosNext", + "type": "address" + } + ], + "name": "rebondWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newPosNext", + "type": "address" + } + ], + "name": "rewardWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "setCurrentRoundTotalActiveStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numActiveTranscoders", + "type": "uint256" + } + ], + "name": "setNumActiveTranscoders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "_unbondingPeriod", + "type": "uint64" + } + ], + "name": "setUnbondingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + }, + { + "internalType": "address", + "name": "_finder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_slashAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_finderFee", + "type": "uint256" + } + ], + "name": "slashTranscoder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetContractId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeShare", + "type": "uint256" + } + ], + "name": "transcoder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "transcoderStatus", + "outputs": [ + { + "internalType": "enum BondingManager.TranscoderStatus", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + } + ], + "name": "transcoderTotalStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeShare", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_newPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newPosNext", + "type": "address" + } + ], + "name": "transcoderWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldDelegateNewPosNext", + "type": "address" + }, + { + "internalType": "address", + "name": "_newDelegateNewPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newDelegateNewPosNext", + "type": "address" + } + ], + "name": "transferBond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unbond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_newPosPrev", + "type": "address" + }, + { + "internalType": "address", + "name": "_newPosNext", + "type": "address" + } + ], + "name": "unbondWithHint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unbondingPeriod", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_transcoder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "updateTranscoderWithFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unbondingLockId", + "type": "uint256" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9fa315b88ca626d035a29b7a3ba4db5996bdd711490b24e37ccd64a74a194ec5", + "receipt": { + "to": null, + "from": "0xB5Af4138f0f33be0D6414Eb25271B9C2Dc245fb5", + "contractAddress": "0x3757DB506ECd9CBE643660C0F5b70db5b321202C", + "transactionIndex": 0, + "gasUsed": "64037927", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2cf15132b784f96e7462597389147f08d2308379df441cb0c41ba3783414dbe3", + "transactionHash": "0x9fa315b88ca626d035a29b7a3ba4db5996bdd711490b24e37ccd64a74a194ec5", + "logs": [], + "blockNumber": 6897365, + "cumulativeGasUsed": "29733427", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD8E8328501E9645d16Cf49539efC04f734606ee4" + ], + "numDeployments": 3, + "solcInputHash": "3ff5221b290e455902c32c32981b5340", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newDelegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldDelegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"additionalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bondedAmount\",\"type\":\"uint256\"}],\"name\":\"Bond\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fees\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startRound\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endRound\",\"type\":\"uint256\"}],\"name\":\"EarningsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"param\",\"type\":\"string\"}],\"name\":\"ParameterUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unbondingLockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Rebond\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transcoder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Reward\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"SetController\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transcoder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"activationRound\",\"type\":\"uint256\"}],\"name\":\"TranscoderActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transcoder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deactivationRound\",\"type\":\"uint256\"}],\"name\":\"TranscoderDeactivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transcoder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"finder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finderReward\",\"type\":\"uint256\"}],\"name\":\"TranscoderSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transcoder\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardCut\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeShare\",\"type\":\"uint256\"}],\"name\":\"TranscoderUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldDelegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newDelegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldUnbondingLockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newUnbondingLockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferBond\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unbondingLockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawRound\",\"type\":\"uint256\"}],\"name\":\"Unbond\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unbondingLockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawRound\",\"type\":\"uint256\"}],\"name\":\"WithdrawStake\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"bond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosNext\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_currDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_currDelegateNewPosNext\",\"type\":\"address\"}],\"name\":\"bondForWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosNext\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_currDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_currDelegateNewPosNext\",\"type\":\"address\"}],\"name\":\"bondWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_endRound\",\"type\":\"uint256\"}],\"name\":\"claimEarnings\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"internalType\":\"contract IController\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRoundTotalActiveStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"delegatorStatus\",\"outputs\":[{\"internalType\":\"enum BondingManager.DelegatorStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"bondedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fees\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"delegateAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"delegatedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastClaimRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nextUnbondingLockId\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"}],\"name\":\"getDelegatorUnbondingLock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawRound\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFirstTranscoderInPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"getNextTranscoderInPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalBonded\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"getTranscoder\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"lastRewardRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardCut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeShare\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastActiveStakeUpdateRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"activationRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deactivationRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"activeCumulativeRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cumulativeRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cumulativeFees\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastFeeRound\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getTranscoderEarningsPoolForRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"transcoderRewardCut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"transcoderFeeShare\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cumulativeRewardFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cumulativeFeeFactor\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTranscoderPoolMaxSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTranscoderPoolSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"isActiveTranscoder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"isRegisteredTranscoder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"}],\"name\":\"isValidUnbondingLock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRoundTotalActiveStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_endRound\",\"type\":\"uint256\"}],\"name\":\"pendingFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_endRound\",\"type\":\"uint256\"}],\"name\":\"pendingStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"}],\"name\":\"rebond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"}],\"name\":\"rebondFromUnbonded\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_newPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newPosNext\",\"type\":\"address\"}],\"name\":\"rebondFromUnbondedWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_newPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newPosNext\",\"type\":\"address\"}],\"name\":\"rebondWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newPosNext\",\"type\":\"address\"}],\"name\":\"rewardWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_controller\",\"type\":\"address\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"setCurrentRoundTotalActiveStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numActiveTranscoders\",\"type\":\"uint256\"}],\"name\":\"setNumActiveTranscoders\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_unbondingPeriod\",\"type\":\"uint64\"}],\"name\":\"setUnbondingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_finder\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_finderFee\",\"type\":\"uint256\"}],\"name\":\"slashTranscoder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetContractId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardCut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeShare\",\"type\":\"uint256\"}],\"name\":\"transcoder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"transcoderStatus\",\"outputs\":[{\"internalType\":\"enum BondingManager.TranscoderStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"}],\"name\":\"transcoderTotalStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardCut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeShare\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_newPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newPosNext\",\"type\":\"address\"}],\"name\":\"transcoderWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldDelegateNewPosNext\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newDelegateNewPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newDelegateNewPosNext\",\"type\":\"address\"}],\"name\":\"transferBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_newPosPrev\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newPosNext\",\"type\":\"address\"}],\"name\":\"unbondWithHint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unbondingPeriod\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_transcoder\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"updateTranscoderWithFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondingLockId\",\"type\":\"uint256\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bond(uint256,address)\":{\"params\":{\"_amount\":\"The amount of tokens to stake\",\"_to\":\"The address of the transcoder to stake towards\"}},\"bondForWithHint(uint256,address,address,address,address,address,address)\":{\"details\":\"If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_amount\":\"The amount of tokens to stake.\",\"_currDelegateNewPosNext\":\"The address of the next transcoder in the pool for the current delegate\",\"_currDelegateNewPosPrev\":\"The address of the previous transcoder in the pool for the current delegate\",\"_oldDelegateNewPosNext\":\"The address of the next transcoder in the pool for the old delegate\",\"_oldDelegateNewPosPrev\":\"The address of the previous transcoder in the pool for the old delegate\",\"_owner\":\"The address of the owner of the bond\",\"_to\":\"The address of the transcoder to stake towards\"}},\"bondWithHint(uint256,address,address,address,address,address)\":{\"details\":\"If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_amount\":\"The amount of tokens to stake.\",\"_currDelegateNewPosNext\":\"The address of the next transcoder in the pool for the current delegate\",\"_currDelegateNewPosPrev\":\"The address of the previous transcoder in the pool for the current delegate\",\"_oldDelegateNewPosNext\":\"The address of the next transcoder in the pool for the old delegate\",\"_oldDelegateNewPosPrev\":\"The address of the previous transcoder in the pool for the old delegate\",\"_to\":\"The address of the transcoder to stake towards\"}},\"claimEarnings(uint256)\":{\"params\":{\"_endRound\":\"The last round for which to claim token pools shares for a delegator\"}},\"constructor\":{\"details\":\"This constructor will not initialize any state variables besides `controller`. The following setter functions should be used to initialize state variables post-deployment: - setUnbondingPeriod() - setNumActiveTranscoders() - setMaxEarningsClaimsRounds()\",\"params\":{\"_controller\":\"Address of Controller that this contract will be registered with\"}},\"delegatorStatus(address)\":{\"params\":{\"_delegator\":\"Address of delegator\"},\"returns\":{\"_0\":\"bonded, unbonded or pending delegator status\"}},\"getDelegator(address)\":{\"params\":{\"_delegator\":\"Address of delegator\"},\"returns\":{\"bondedAmount\":\"total amount bonded by '_delegator'\",\"delegateAddress\":\"address '_delegator' has bonded to\",\"delegatedAmount\":\"total amount delegated to '_delegator'\",\"fees\":\"amount of fees collected by '_delegator'\",\"lastClaimRound\":\"round for which '_delegator' has last claimed earnings\",\"nextUnbondingLockId\":\"ID for the next unbonding lock created for '_delegator'\",\"startRound\":\"round in which bond for '_delegator' became effective\"}},\"getDelegatorUnbondingLock(address,uint256)\":{\"params\":{\"_delegator\":\"Address of delegator\",\"_unbondingLockId\":\"ID of unbonding lock\"},\"returns\":{\"amount\":\"of stake locked up by unbonding lock\",\"withdrawRound\":\"round in which 'amount' becomes available for withdrawal\"}},\"getFirstTranscoderInPool()\":{\"returns\":{\"_0\":\"address for transcoder with highest stake in transcoder pool\"}},\"getNextTranscoderInPool(address)\":{\"params\":{\"_transcoder\":\"Address of a transcoder in the pool\"},\"returns\":{\"_0\":\"address for the transcoder after '_transcoder' in transcoder pool\"}},\"getTotalBonded()\":{\"returns\":{\"_0\":\"total active stake for the current round\"}},\"getTranscoder(address)\":{\"params\":{\"_transcoder\":\"Address of transcoder\"},\"returns\":{\"activationRound\":\"Round in which transcoder became active\",\"activeCumulativeRewards\":\"Transcoder's cumulative rewards that are currently active\",\"cumulativeFees\":\"Transcoder's cumulative fees (earned via its active staked rewards and its fee share)\",\"cumulativeRewards\":\"Transcoder's cumulative rewards (earned via its active staked rewards and its reward cut)\",\"deactivationRound\":\"Round in which transcoder will no longer be active\",\"feeShare\":\"Transcoder's fee share\",\"lastActiveStakeUpdateRound\":\"Round in which transcoder's stake was last updated while active\",\"lastFeeRound\":\"Latest round that the transcoder received fees\",\"lastRewardRound\":\"Trancoder's last reward round\",\"rewardCut\":\"Transcoder's reward cut\"}},\"getTranscoderEarningsPoolForRound(address,uint256)\":{\"params\":{\"_round\":\"Round number\",\"_transcoder\":\"Address of transcoder\"},\"returns\":{\"cumulativeFeeFactor\":\"The cumulative fee factor for delegator fees calculation (only used after LIP-36)\",\"cumulativeRewardFactor\":\"The cumulative reward factor for delegator rewards calculation (only used after LIP-36)\",\"totalStake\":\"Transcoder's total stake in '_round'\",\"transcoderFeeShare\":\"Transcoder's fee share for '_round'\",\"transcoderRewardCut\":\"Transcoder's reward cut for '_round'\"}},\"getTranscoderPoolMaxSize()\":{\"returns\":{\"_0\":\"transcoder pool max size\"}},\"getTranscoderPoolSize()\":{\"returns\":{\"_0\":\"transcoder pool current size\"}},\"isActiveTranscoder(address)\":{\"params\":{\"_transcoder\":\"Transcoder address\"},\"returns\":{\"_0\":\"true if transcoder is active\"}},\"isRegisteredTranscoder(address)\":{\"params\":{\"_transcoder\":\"Transcoder address\"},\"returns\":{\"_0\":\"true if transcoder is self-bonded\"}},\"isValidUnbondingLock(address,uint256)\":{\"params\":{\"_delegator\":\"Address of delegator\",\"_unbondingLockId\":\"ID of unbonding lock\"},\"returns\":{\"_0\":\"true if unbondingLock for ID has a non-zero withdraw round\"}},\"pendingFees(address,uint256)\":{\"params\":{\"_delegator\":\"Address of delegator\",\"_endRound\":\"The last round to compute pending fees from\"},\"returns\":{\"_0\":\"Pending fees for '_delegator' since last claiming fees\"}},\"pendingStake(address,uint256)\":{\"params\":{\"_delegator\":\"Address of delegator\",\"_endRound\":\"The last round to compute pending stake from\"},\"returns\":{\"_0\":\"Pending bonded stake for '_delegator' since last claiming rewards\"}},\"rebond(uint256)\":{\"params\":{\"_unbondingLockId\":\"ID of unbonding lock to rebond with\"}},\"rebondFromUnbonded(address,uint256)\":{\"params\":{\"_to\":\"Address of delegate\",\"_unbondingLockId\":\"ID of unbonding lock to rebond with\"}},\"rebondFromUnbondedWithHint(address,uint256,address,address)\":{\"details\":\"If the delegate joins the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_newPosNext\":\"Address of next transcoder in pool if the delegate joins the pool\",\"_newPosPrev\":\"Address of previous transcoder in pool if the delegate joins the pool\",\"_to\":\"Address of delegate\",\"_unbondingLockId\":\"ID of unbonding lock to rebond with\"}},\"rebondWithHint(uint256,address,address)\":{\"details\":\"If the delegate is in the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints\",\"params\":{\"_newPosNext\":\"Address of next transcoder in pool if the delegate is in the pool\",\"_newPosPrev\":\"Address of previous transcoder in pool if the delegate is in the pool\",\"_unbondingLockId\":\"ID of unbonding lock to rebond with\"}},\"rewardWithHint(address,address)\":{\"details\":\"If the caller is in the transcoder pool, the caller can provide an optional hint for its insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_newPosNext\":\"Address of next transcoder in pool if the caller is in the pool\",\"_newPosPrev\":\"Address of previous transcoder in pool if the caller is in the pool\"}},\"setController(address)\":{\"params\":{\"_controller\":\"Controller contract address\"}},\"setNumActiveTranscoders(uint256)\":{\"params\":{\"_numActiveTranscoders\":\"Number of active transcoders\"}},\"setUnbondingPeriod(uint64)\":{\"params\":{\"_unbondingPeriod\":\"Rounds between unbonding and possible withdrawal\"}},\"slashTranscoder(address,address,uint256,uint256)\":{\"params\":{\"_finder\":\"Finder that proved a transcoder violated a slashing condition. Null address if there is no finder\",\"_finderFee\":\"Percentage of penalty awarded to finder. Zero if there is no finder\",\"_slashAmount\":\"Percentage of transcoder bond to be slashed\",\"_transcoder\":\"Transcoder address\"}},\"transcoder(uint256,uint256)\":{\"details\":\"Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR\",\"params\":{\"_feeShare\":\"% of fees paid to delegators by a transcoder\",\"_rewardCut\":\"% of reward paid to transcoder by a delegator\"}},\"transcoderStatus(address)\":{\"params\":{\"_transcoder\":\"Address of transcoder\"},\"returns\":{\"_0\":\"registered or not registered transcoder status\"}},\"transcoderTotalStake(address)\":{\"params\":{\"_transcoder\":\"Address of transcoder\"},\"returns\":{\"_0\":\"total bonded stake for a delegator\"}},\"transcoderWithHint(uint256,uint256,address,address)\":{\"details\":\"Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR. If the caller is going to be added to the pool, the caller can provide an optional hint for the insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position - in the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_feeShare\":\"% of fees paid to delegators by a transcoder\",\"_newPosNext\":\"Address of next transcoder in pool if the caller joins the pool\",\"_newPosPrev\":\"Address of previous transcoder in pool if the caller joins the pool\",\"_rewardCut\":\"% of reward paid to transcoder by a delegator\"}},\"transferBond(address,uint256,address,address,address,address)\":{\"details\":\"If the original delegate is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the target delegate is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_newDelegateNewPosPrev` and `_newDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\",\"params\":{\"_amount\":\"Portion of the bond to transfer to receiver\",\"_delegator\":\"Receiver of the bond\",\"_newDelegateNewPosNext\":\"Address of next transcoder in pool if the delegate is in the pool\",\"_newDelegateNewPosPrev\":\"Address of previous transcoder in pool if the delegate is in the pool\",\"_oldDelegateNewPosNext\":\"Address of next transcoder in pool if the delegate remains in the pool\",\"_oldDelegateNewPosPrev\":\"Address of previous transcoder in pool if the delegate remains in the pool\"}},\"unbond(uint256)\":{\"params\":{\"_amount\":\"Amount of tokens to unbond\"}},\"unbondWithHint(uint256,address,address)\":{\"details\":\"If the caller remains in the transcoder pool, the caller can provide an optional hint for its insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints\",\"params\":{\"_amount\":\"Amount of tokens to unbond\",\"_newPosNext\":\"Address of next transcoder in pool if the caller remains in the pool\",\"_newPosPrev\":\"Address of previous transcoder in pool if the caller remains in the pool\"}},\"updateTranscoderWithFees(address,uint256,uint256)\":{\"params\":{\"_fees\":\"Fees to be added to the fee pool\",\"_transcoder\":\"Transcoder address\"}},\"withdrawStake(uint256)\":{\"params\":{\"_unbondingLockId\":\"ID of unbonding lock to withdraw with\"}}},\"title\":\"BondingManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bond(uint256,address)\":{\"notice\":\"Delegate stake towards a specific address\"},\"bondForWithHint(uint256,address,address,address,address,address,address)\":{\"notice\":\"Delegates stake \\\"on behalf of\\\" another address towards a specific address and updates the transcoder pool using optional list hints if needed\"},\"bondWithHint(uint256,address,address,address,address,address)\":{\"notice\":\"Delegates stake towards a specific address and updates the transcoder pool using optional list hints if needed\"},\"claimEarnings(uint256)\":{\"notice\":\"Claim token pools shares for a delegator from its lastClaimRound through the end round\"},\"constructor\":{\"notice\":\"BondingManager constructor. Only invokes constructor of base Manager contract with provided Controller address\"},\"delegatorStatus(address)\":{\"notice\":\"Computes delegator status\"},\"getDelegator(address)\":{\"notice\":\"Return delegator info\"},\"getDelegatorUnbondingLock(address,uint256)\":{\"notice\":\"Return delegator's unbonding lock info\"},\"getFirstTranscoderInPool()\":{\"notice\":\"Returns transcoder with most stake in pool\"},\"getNextTranscoderInPool(address)\":{\"notice\":\"Returns next transcoder in pool for a given transcoder\"},\"getTotalBonded()\":{\"notice\":\"Return total bonded tokens\"},\"getTranscoder(address)\":{\"notice\":\"Return transcoder information\"},\"getTranscoderEarningsPoolForRound(address,uint256)\":{\"notice\":\"Return transcoder's earnings pool for a given round\"},\"getTranscoderPoolMaxSize()\":{\"notice\":\"Returns max size of transcoder pool\"},\"getTranscoderPoolSize()\":{\"notice\":\"Returns size of transcoder pool\"},\"isActiveTranscoder(address)\":{\"notice\":\"Return whether a transcoder is active for the current round\"},\"isRegisteredTranscoder(address)\":{\"notice\":\"Return whether a transcoder is registered\"},\"isValidUnbondingLock(address,uint256)\":{\"notice\":\"Return whether an unbonding lock for a delegator is valid\"},\"pendingFees(address,uint256)\":{\"notice\":\"Returns pending fees for a delegator from its lastClaimRound through an end round\"},\"pendingStake(address,uint256)\":{\"notice\":\"Returns pending bonded stake for a delegator from its lastClaimRound through an end round\"},\"rebond(uint256)\":{\"notice\":\"Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status\"},\"rebondFromUnbonded(address,uint256)\":{\"notice\":\"Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status\"},\"rebondFromUnbondedWithHint(address,uint256,address,address)\":{\"notice\":\"Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status and updates the transcoder pool using an optional list hint if needed\"},\"rebondWithHint(uint256,address,address)\":{\"notice\":\"Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status and updates the transcoder pool using an optional list hint if needed\"},\"reward()\":{\"notice\":\"Mint token rewards for an active transcoder and its delegators\"},\"rewardWithHint(address,address)\":{\"notice\":\"Mint token rewards for an active transcoder and its delegators and update the transcoder pool using an optional list hint if needed\"},\"setController(address)\":{\"notice\":\"Set controller. Only callable by current controller\"},\"setCurrentRoundTotalActiveStake()\":{\"notice\":\"Called during round initialization to set the total active stake for the round. Only callable by the RoundsManager\"},\"setNumActiveTranscoders(uint256)\":{\"notice\":\"Set maximum number of active transcoders. Only callable by Controller owner\"},\"setUnbondingPeriod(uint64)\":{\"notice\":\"Set unbonding period. Only callable by Controller owner\"},\"slashTranscoder(address,address,uint256,uint256)\":{\"notice\":\"Slash a transcoder. Only callable by the Verifier\"},\"transcoder(uint256,uint256)\":{\"notice\":\"Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it\"},\"transcoderStatus(address)\":{\"notice\":\"Computes transcoder status\"},\"transcoderTotalStake(address)\":{\"notice\":\"Returns total bonded stake for a transcoder\"},\"transcoderWithHint(uint256,uint256,address,address)\":{\"notice\":\"Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it using an optional list hint\"},\"transferBond(address,uint256,address,address,address,address)\":{\"notice\":\"Transfers ownership of a bond to a new delegator using optional hints if needed If the receiver is already bonded to a different delegate than the bond owner then the stake goes to the receiver's delegate otherwise the receiver's delegate is set as the owner's delegate\"},\"unbond(uint256)\":{\"notice\":\"Unbond an amount of the delegator's bonded stake\"},\"unbondWithHint(uint256,address,address)\":{\"notice\":\"Unbond an amount of the delegator's bonded stake and updates the transcoder pool using an optional list hint if needed\"},\"updateTranscoderWithFees(address,uint256,uint256)\":{\"notice\":\"Update transcoder's fee pool. Only callable by the TicketBroker\"},\"withdrawFees(address,uint256)\":{\"notice\":\"Withdraws fees to the caller\"},\"withdrawStake(uint256)\":{\"notice\":\"Withdraws tokens for an unbonding lock that has existed through an unbonding period\"}},\"notice\":\"Manages bonding, transcoder and rewards/fee accounting related operations of the Livepeer protocol\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/bonding/BondingManager.sol\":\"BondingManager\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\"},\"contracts/IController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./zeppelin/Pausable.sol\\\";\\n\\nabstract contract IController is Pausable {\\n event SetContractInfo(bytes32 id, address contractAddress, bytes20 gitCommitHash);\\n\\n function setContractInfo(\\n bytes32 _id,\\n address _contractAddress,\\n bytes20 _gitCommitHash\\n ) external virtual;\\n\\n function updateController(bytes32 _id, address _controller) external virtual;\\n\\n function getContract(bytes32 _id) public view virtual returns (address);\\n}\\n\",\"keccak256\":\"0x34ea30a2b44d0cbec58fc1d703476ff0085b0fdadab0cd65c35c00b8867f7546\",\"license\":\"MIT\"},\"contracts/IManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\ninterface IManager {\\n event SetController(address controller);\\n event ParameterUpdate(string param);\\n\\n function setController(address _controller) external;\\n}\\n\",\"keccak256\":\"0xc179e4cecc593741514237d5194b4aaac6b829789629fa19ed04f572a8530481\",\"license\":\"MIT\"},\"contracts/Manager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./IManager.sol\\\";\\nimport \\\"./IController.sol\\\";\\n\\ncontract Manager is IManager {\\n // Controller that contract is registered with\\n IController public controller;\\n\\n // Check if sender is controller\\n modifier onlyController() {\\n _onlyController();\\n _;\\n }\\n\\n // Check if sender is controller owner\\n modifier onlyControllerOwner() {\\n _onlyControllerOwner();\\n _;\\n }\\n\\n // Check if controller is not paused\\n modifier whenSystemNotPaused() {\\n _whenSystemNotPaused();\\n _;\\n }\\n\\n // Check if controller is paused\\n modifier whenSystemPaused() {\\n _whenSystemPaused();\\n _;\\n }\\n\\n constructor(address _controller) {\\n controller = IController(_controller);\\n }\\n\\n /**\\n * @notice Set controller. Only callable by current controller\\n * @param _controller Controller contract address\\n */\\n function setController(address _controller) external onlyController {\\n controller = IController(_controller);\\n\\n emit SetController(_controller);\\n }\\n\\n function _onlyController() private view {\\n require(msg.sender == address(controller), \\\"caller must be Controller\\\");\\n }\\n\\n function _onlyControllerOwner() private view {\\n require(msg.sender == controller.owner(), \\\"caller must be Controller owner\\\");\\n }\\n\\n function _whenSystemNotPaused() private view {\\n require(!controller.paused(), \\\"system is paused\\\");\\n }\\n\\n function _whenSystemPaused() private view {\\n require(controller.paused(), \\\"system is not paused\\\");\\n }\\n}\\n\",\"keccak256\":\"0xc415e3f42da9f82ddd5953031f3f26aed824368fcc34d3b8a17015bfe80dc109\",\"license\":\"MIT\"},\"contracts/ManagerProxyTarget.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./Manager.sol\\\";\\n\\n/**\\n * @title ManagerProxyTarget\\n * @notice The base contract that target contracts used by a proxy contract should inherit from\\n * @dev Both the target contract and the proxy contract (implemented as ManagerProxy) MUST inherit from ManagerProxyTarget in order to guarantee\\n that both contracts have the same storage layout. Differing storage layouts in a proxy contract and target contract can\\n potentially break the delegate proxy upgradeability mechanism\\n */\\nabstract contract ManagerProxyTarget is Manager {\\n // Used to look up target contract address in controller's registry\\n bytes32 public targetContractId;\\n}\\n\",\"keccak256\":\"0x920bcc2def240e06272dc06cbcb9f12976f1698cd4f1020c165af25ee837e553\",\"license\":\"MIT\"},\"contracts/bonding/BondingManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"../ManagerProxyTarget.sol\\\";\\nimport \\\"./IBondingManager.sol\\\";\\nimport \\\"../libraries/SortedDoublyLL.sol\\\";\\nimport \\\"../libraries/MathUtils.sol\\\";\\nimport \\\"../libraries/PreciseMathUtils.sol\\\";\\nimport \\\"./libraries/EarningsPool.sol\\\";\\nimport \\\"./libraries/EarningsPoolLIP36.sol\\\";\\nimport \\\"../token/ILivepeerToken.sol\\\";\\nimport \\\"../token/IMinter.sol\\\";\\nimport \\\"../rounds/IRoundsManager.sol\\\";\\nimport \\\"../snapshots/IMerkleSnapshot.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\n/**\\n * @title BondingManager\\n * @notice Manages bonding, transcoder and rewards/fee accounting related operations of the Livepeer protocol\\n */\\ncontract BondingManager is ManagerProxyTarget, IBondingManager {\\n using SafeMath for uint256;\\n using SortedDoublyLL for SortedDoublyLL.Data;\\n using EarningsPool for EarningsPool.Data;\\n using EarningsPoolLIP36 for EarningsPool.Data;\\n\\n // Constants\\n // Occurances are replaced at compile time\\n // and computed to a single value if possible by the optimizer\\n uint256 constant MAX_FUTURE_ROUND = 2**256 - 1;\\n\\n // Time between unbonding and possible withdrawl in rounds\\n uint64 public unbondingPeriod;\\n\\n // Represents a transcoder's current state\\n struct Transcoder {\\n uint256 lastRewardRound; // Last round that the transcoder called reward\\n uint256 rewardCut; // % of reward paid to transcoder by a delegator\\n uint256 feeShare; // % of fees paid to delegators by transcoder\\n mapping(uint256 => EarningsPool.Data) earningsPoolPerRound; // Mapping of round => earnings pool for the round\\n uint256 lastActiveStakeUpdateRound; // Round for which the stake was last updated while the transcoder is active\\n uint256 activationRound; // Round in which the transcoder became active - 0 if inactive\\n uint256 deactivationRound; // Round in which the transcoder will become inactive\\n uint256 activeCumulativeRewards; // The transcoder's cumulative rewards that are active in the current round\\n uint256 cumulativeRewards; // The transcoder's cumulative rewards (earned via the its active staked rewards and its reward cut).\\n uint256 cumulativeFees; // The transcoder's cumulative fees (earned via the its active staked rewards and its fee share)\\n uint256 lastFeeRound; // Latest round in which the transcoder received fees\\n }\\n\\n // The various states a transcoder can be in\\n enum TranscoderStatus {\\n NotRegistered,\\n Registered\\n }\\n\\n // Represents a delegator's current state\\n struct Delegator {\\n uint256 bondedAmount; // The amount of bonded tokens\\n uint256 fees; // The amount of fees collected\\n address delegateAddress; // The address delegated to\\n uint256 delegatedAmount; // The amount of tokens delegated to the delegator\\n uint256 startRound; // The round the delegator transitions to bonded phase and is delegated to someone\\n uint256 lastClaimRound; // The last round during which the delegator claimed its earnings\\n uint256 nextUnbondingLockId; // ID for the next unbonding lock created\\n mapping(uint256 => UnbondingLock) unbondingLocks; // Mapping of unbonding lock ID => unbonding lock\\n }\\n\\n // The various states a delegator can be in\\n enum DelegatorStatus {\\n Pending,\\n Bonded,\\n Unbonded\\n }\\n\\n // Represents an amount of tokens that are being unbonded\\n struct UnbondingLock {\\n uint256 amount; // Amount of tokens being unbonded\\n uint256 withdrawRound; // Round at which unbonding period is over and tokens can be withdrawn\\n }\\n\\n // Keep track of the known transcoders and delegators\\n mapping(address => Delegator) private delegators;\\n mapping(address => Transcoder) private transcoders;\\n\\n // The total active stake (sum of the stake of active set members) for the current round\\n uint256 public currentRoundTotalActiveStake;\\n // The total active stake (sum of the stake of active set members) for the next round\\n uint256 public nextRoundTotalActiveStake;\\n\\n // The transcoder pool is used to keep track of the transcoders that are eligible for activation.\\n // The pool keeps track of the pending active set in round N and the start of round N + 1 transcoders\\n // in the pool are locked into the active set for round N + 1\\n SortedDoublyLL.Data private transcoderPool;\\n\\n // Check if sender is TicketBroker\\n modifier onlyTicketBroker() {\\n _onlyTicketBroker();\\n _;\\n }\\n\\n // Check if sender is RoundsManager\\n modifier onlyRoundsManager() {\\n _onlyRoundsManager();\\n _;\\n }\\n\\n // Check if sender is Verifier\\n modifier onlyVerifier() {\\n _onlyVerifier();\\n _;\\n }\\n\\n // Check if current round is initialized\\n modifier currentRoundInitialized() {\\n _currentRoundInitialized();\\n _;\\n }\\n\\n // Automatically claim earnings from lastClaimRound through the current round\\n modifier autoClaimEarnings() {\\n _autoClaimEarnings();\\n _;\\n }\\n\\n /**\\n * @notice BondingManager constructor. Only invokes constructor of base Manager contract with provided Controller address\\n * @dev This constructor will not initialize any state variables besides `controller`. The following setter functions\\n * should be used to initialize state variables post-deployment:\\n * - setUnbondingPeriod()\\n * - setNumActiveTranscoders()\\n * - setMaxEarningsClaimsRounds()\\n * @param _controller Address of Controller that this contract will be registered with\\n */\\n constructor(address _controller) Manager(_controller) {}\\n\\n /**\\n * @notice Set unbonding period. Only callable by Controller owner\\n * @param _unbondingPeriod Rounds between unbonding and possible withdrawal\\n */\\n function setUnbondingPeriod(uint64 _unbondingPeriod) external onlyControllerOwner {\\n unbondingPeriod = _unbondingPeriod;\\n\\n emit ParameterUpdate(\\\"unbondingPeriod\\\");\\n }\\n\\n /**\\n * @notice Set maximum number of active transcoders. Only callable by Controller owner\\n * @param _numActiveTranscoders Number of active transcoders\\n */\\n function setNumActiveTranscoders(uint256 _numActiveTranscoders) external onlyControllerOwner {\\n transcoderPool.setMaxSize(_numActiveTranscoders);\\n\\n emit ParameterUpdate(\\\"numActiveTranscoders\\\");\\n }\\n\\n /**\\n * @notice Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it\\n * @dev Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR\\n * @param _rewardCut % of reward paid to transcoder by a delegator\\n * @param _feeShare % of fees paid to delegators by a transcoder\\n */\\n function transcoder(uint256 _rewardCut, uint256 _feeShare) external {\\n transcoderWithHint(_rewardCut, _feeShare, address(0), address(0));\\n }\\n\\n /**\\n * @notice Delegate stake towards a specific address\\n * @param _amount The amount of tokens to stake\\n * @param _to The address of the transcoder to stake towards\\n */\\n function bond(uint256 _amount, address _to) external {\\n bondWithHint(_amount, _to, address(0), address(0), address(0), address(0));\\n }\\n\\n /**\\n * @notice Unbond an amount of the delegator's bonded stake\\n * @param _amount Amount of tokens to unbond\\n */\\n function unbond(uint256 _amount) external {\\n unbondWithHint(_amount, address(0), address(0));\\n }\\n\\n /**\\n * @notice Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status\\n * @param _unbondingLockId ID of unbonding lock to rebond with\\n */\\n function rebond(uint256 _unbondingLockId) external {\\n rebondWithHint(_unbondingLockId, address(0), address(0));\\n }\\n\\n /**\\n * @notice Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status\\n * @param _to Address of delegate\\n * @param _unbondingLockId ID of unbonding lock to rebond with\\n */\\n function rebondFromUnbonded(address _to, uint256 _unbondingLockId) external {\\n rebondFromUnbondedWithHint(_to, _unbondingLockId, address(0), address(0));\\n }\\n\\n /**\\n * @notice Withdraws tokens for an unbonding lock that has existed through an unbonding period\\n * @param _unbondingLockId ID of unbonding lock to withdraw with\\n */\\n function withdrawStake(uint256 _unbondingLockId) external whenSystemNotPaused currentRoundInitialized {\\n Delegator storage del = delegators[msg.sender];\\n UnbondingLock storage lock = del.unbondingLocks[_unbondingLockId];\\n\\n require(isValidUnbondingLock(msg.sender, _unbondingLockId), \\\"invalid unbonding lock ID\\\");\\n require(\\n lock.withdrawRound <= roundsManager().currentRound(),\\n \\\"withdraw round must be before or equal to the current round\\\"\\n );\\n\\n uint256 amount = lock.amount;\\n uint256 withdrawRound = lock.withdrawRound;\\n // Delete unbonding lock\\n delete del.unbondingLocks[_unbondingLockId];\\n\\n // Tell Minter to transfer stake (LPT) to the delegator\\n minter().trustedTransferTokens(msg.sender, amount);\\n\\n emit WithdrawStake(msg.sender, _unbondingLockId, amount, withdrawRound);\\n }\\n\\n /**\\n * @notice Withdraws fees to the caller\\n */\\n function withdrawFees(address payable _recipient, uint256 _amount)\\n external\\n whenSystemNotPaused\\n currentRoundInitialized\\n autoClaimEarnings\\n {\\n require(_recipient != address(0), \\\"invalid recipient\\\");\\n uint256 fees = delegators[msg.sender].fees;\\n require(fees >= _amount, \\\"insufficient fees to withdraw\\\");\\n delegators[msg.sender].fees = fees.sub(_amount);\\n\\n // Tell Minter to transfer fees (ETH) to the address\\n minter().trustedWithdrawETH(_recipient, _amount);\\n\\n emit WithdrawFees(msg.sender, _recipient, _amount);\\n }\\n\\n /**\\n * @notice Mint token rewards for an active transcoder and its delegators\\n */\\n function reward() external {\\n rewardWithHint(address(0), address(0));\\n }\\n\\n /**\\n * @notice Update transcoder's fee pool. Only callable by the TicketBroker\\n * @param _transcoder Transcoder address\\n * @param _fees Fees to be added to the fee pool\\n */\\n function updateTranscoderWithFees(\\n address _transcoder,\\n uint256 _fees,\\n uint256 _round\\n ) external whenSystemNotPaused onlyTicketBroker {\\n // Silence unused param compiler warning\\n _round;\\n\\n require(isRegisteredTranscoder(_transcoder), \\\"transcoder must be registered\\\");\\n\\n uint256 currentRound = roundsManager().currentRound();\\n\\n Transcoder storage t = transcoders[_transcoder];\\n\\n uint256 lastRewardRound = t.lastRewardRound;\\n uint256 activeCumulativeRewards = t.activeCumulativeRewards;\\n\\n // LIP-36: Add fees for the current round instead of '_round'\\n // https://github.com/livepeer/LIPs/issues/35#issuecomment-673659199\\n EarningsPool.Data storage earningsPool = t.earningsPoolPerRound[currentRound];\\n EarningsPool.Data memory prevEarningsPool = latestCumulativeFactorsPool(t, currentRound.sub(1));\\n\\n // if transcoder hasn't called 'reward()' for '_round' its 'transcoderFeeShare', 'transcoderRewardCut' and 'totalStake'\\n // on the 'EarningsPool' for '_round' would not be initialized and the fee distribution wouldn't happen as expected\\n // for cumulative fee calculation this would result in division by zero.\\n if (currentRound > lastRewardRound) {\\n earningsPool.setCommission(t.rewardCut, t.feeShare);\\n\\n uint256 lastUpdateRound = t.lastActiveStakeUpdateRound;\\n if (lastUpdateRound < currentRound) {\\n earningsPool.setStake(t.earningsPoolPerRound[lastUpdateRound].totalStake);\\n }\\n\\n // If reward() has not been called yet in the current round, then the transcoder's activeCumulativeRewards has not\\n // yet been set in for the round. When the transcoder calls reward() its activeCumulativeRewards will be set to its\\n // current cumulativeRewards. So, we can just use the transcoder's cumulativeRewards here because this will become\\n // the transcoder's activeCumulativeRewards if it calls reward() later on in the current round\\n activeCumulativeRewards = t.cumulativeRewards;\\n }\\n\\n uint256 totalStake = earningsPool.totalStake;\\n if (prevEarningsPool.cumulativeRewardFactor == 0 && lastRewardRound == currentRound) {\\n // if transcoder called reward for 'currentRound' but not for 'currentRound - 1' (missed reward call)\\n // retroactively calculate what its cumulativeRewardFactor would have been for 'currentRound - 1' (cfr. previous lastRewardRound for transcoder)\\n // based on rewards for currentRound\\n IMinter mtr = minter();\\n uint256 rewards = PreciseMathUtils.percOf(\\n mtr.currentMintableTokens().add(mtr.currentMintedTokens()),\\n totalStake,\\n currentRoundTotalActiveStake\\n );\\n uint256 transcoderCommissionRewards = MathUtils.percOf(rewards, earningsPool.transcoderRewardCut);\\n uint256 delegatorsRewards = rewards.sub(transcoderCommissionRewards);\\n\\n prevEarningsPool.cumulativeRewardFactor = PreciseMathUtils.percOf(\\n earningsPool.cumulativeRewardFactor,\\n totalStake,\\n delegatorsRewards.add(totalStake)\\n );\\n }\\n\\n uint256 delegatorsFees = MathUtils.percOf(_fees, earningsPool.transcoderFeeShare);\\n uint256 transcoderCommissionFees = _fees.sub(delegatorsFees);\\n // Calculate the fees earned by the transcoder's earned rewards\\n uint256 transcoderRewardStakeFees = PreciseMathUtils.percOf(\\n delegatorsFees,\\n activeCumulativeRewards,\\n totalStake\\n );\\n // Track fees earned by the transcoder based on its earned rewards and feeShare\\n t.cumulativeFees = t.cumulativeFees.add(transcoderRewardStakeFees).add(transcoderCommissionFees);\\n // Update cumulative fee factor with new fees\\n // The cumulativeFeeFactor is used to calculate fees for all delegators including the transcoder (self-delegated)\\n // Note that delegatorsFees includes transcoderRewardStakeFees, but no delegator will claim that amount using\\n // the earnings claiming algorithm and instead that amount is accounted for in the transcoder's cumulativeFees field\\n earningsPool.updateCumulativeFeeFactor(prevEarningsPool, delegatorsFees);\\n\\n t.lastFeeRound = currentRound;\\n }\\n\\n /**\\n * @notice Slash a transcoder. Only callable by the Verifier\\n * @param _transcoder Transcoder address\\n * @param _finder Finder that proved a transcoder violated a slashing condition. Null address if there is no finder\\n * @param _slashAmount Percentage of transcoder bond to be slashed\\n * @param _finderFee Percentage of penalty awarded to finder. Zero if there is no finder\\n */\\n function slashTranscoder(\\n address _transcoder,\\n address _finder,\\n uint256 _slashAmount,\\n uint256 _finderFee\\n ) external whenSystemNotPaused onlyVerifier {\\n Delegator storage del = delegators[_transcoder];\\n\\n if (del.bondedAmount > 0) {\\n uint256 penalty = MathUtils.percOf(delegators[_transcoder].bondedAmount, _slashAmount);\\n\\n // If active transcoder, resign it\\n if (transcoderPool.contains(_transcoder)) {\\n resignTranscoder(_transcoder);\\n }\\n\\n // Decrease bonded stake\\n del.bondedAmount = del.bondedAmount.sub(penalty);\\n\\n // If still bonded decrease delegate's delegated amount\\n if (delegatorStatus(_transcoder) == DelegatorStatus.Bonded) {\\n delegators[del.delegateAddress].delegatedAmount = delegators[del.delegateAddress].delegatedAmount.sub(\\n penalty\\n );\\n }\\n\\n // Account for penalty\\n uint256 burnAmount = penalty;\\n\\n // Award finder fee if there is a finder address\\n if (_finder != address(0)) {\\n uint256 finderAmount = MathUtils.percOf(penalty, _finderFee);\\n minter().trustedTransferTokens(_finder, finderAmount);\\n\\n // Minter burns the slashed funds - finder reward\\n minter().trustedBurnTokens(burnAmount.sub(finderAmount));\\n\\n emit TranscoderSlashed(_transcoder, _finder, penalty, finderAmount);\\n } else {\\n // Minter burns the slashed funds\\n minter().trustedBurnTokens(burnAmount);\\n\\n emit TranscoderSlashed(_transcoder, address(0), penalty, 0);\\n }\\n } else {\\n emit TranscoderSlashed(_transcoder, _finder, 0, 0);\\n }\\n }\\n\\n /**\\n * @notice Claim token pools shares for a delegator from its lastClaimRound through the end round\\n * @param _endRound The last round for which to claim token pools shares for a delegator\\n */\\n function claimEarnings(uint256 _endRound) external whenSystemNotPaused currentRoundInitialized {\\n // Silence unused param compiler warning\\n _endRound;\\n\\n _autoClaimEarnings();\\n }\\n\\n /**\\n * @notice Called during round initialization to set the total active stake for the round. Only callable by the RoundsManager\\n */\\n function setCurrentRoundTotalActiveStake() external onlyRoundsManager {\\n currentRoundTotalActiveStake = nextRoundTotalActiveStake;\\n }\\n\\n /**\\n * @notice Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it using an optional list hint\\n * @dev Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR. If the caller is going to be added to the pool, the\\n * caller can provide an optional hint for the insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will\\n * be executed starting at the hint to find the correct position - in the best case, the hint is the correct position so no search is executed.\\n * See SortedDoublyLL.sol for details on list hints\\n * @param _rewardCut % of reward paid to transcoder by a delegator\\n * @param _feeShare % of fees paid to delegators by a transcoder\\n * @param _newPosPrev Address of previous transcoder in pool if the caller joins the pool\\n * @param _newPosNext Address of next transcoder in pool if the caller joins the pool\\n */\\n function transcoderWithHint(\\n uint256 _rewardCut,\\n uint256 _feeShare,\\n address _newPosPrev,\\n address _newPosNext\\n ) public whenSystemNotPaused currentRoundInitialized {\\n require(!roundsManager().currentRoundLocked(), \\\"can't update transcoder params, current round is locked\\\");\\n require(MathUtils.validPerc(_rewardCut), \\\"invalid rewardCut percentage\\\");\\n require(MathUtils.validPerc(_feeShare), \\\"invalid feeShare percentage\\\");\\n require(isRegisteredTranscoder(msg.sender), \\\"transcoder must be registered\\\");\\n\\n Transcoder storage t = transcoders[msg.sender];\\n uint256 currentRound = roundsManager().currentRound();\\n\\n require(\\n !isActiveTranscoder(msg.sender) || t.lastRewardRound == currentRound,\\n \\\"caller can't be active or must have already called reward for the current round\\\"\\n );\\n\\n t.rewardCut = _rewardCut;\\n t.feeShare = _feeShare;\\n\\n if (!transcoderPool.contains(msg.sender)) {\\n tryToJoinActiveSet(\\n msg.sender,\\n delegators[msg.sender].delegatedAmount,\\n currentRound.add(1),\\n _newPosPrev,\\n _newPosNext\\n );\\n }\\n\\n emit TranscoderUpdate(msg.sender, _rewardCut, _feeShare);\\n }\\n\\n /**\\n * @notice Delegates stake \\\"on behalf of\\\" another address towards a specific address\\n * and updates the transcoder pool using optional list hints if needed\\n * @dev If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint\\n * for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params.\\n * If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the\\n * insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params.\\n * In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint\\n * is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\\n * @param _amount The amount of tokens to stake.\\n * @param _owner The address of the owner of the bond\\n * @param _to The address of the transcoder to stake towards\\n * @param _oldDelegateNewPosPrev The address of the previous transcoder in the pool for the old delegate\\n * @param _oldDelegateNewPosNext The address of the next transcoder in the pool for the old delegate\\n * @param _currDelegateNewPosPrev The address of the previous transcoder in the pool for the current delegate\\n * @param _currDelegateNewPosNext The address of the next transcoder in the pool for the current delegate\\n */\\n function bondForWithHint(\\n uint256 _amount,\\n address _owner,\\n address _to,\\n address _oldDelegateNewPosPrev,\\n address _oldDelegateNewPosNext,\\n address _currDelegateNewPosPrev,\\n address _currDelegateNewPosNext\\n ) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {\\n Delegator storage del = delegators[_owner];\\n\\n uint256 currentRound = roundsManager().currentRound();\\n // Amount to delegate\\n uint256 delegationAmount = _amount;\\n // Current delegate\\n address currentDelegate = del.delegateAddress;\\n // Current bonded amount\\n uint256 currentBondedAmount = del.bondedAmount;\\n\\n if (delegatorStatus(_owner) == DelegatorStatus.Unbonded) {\\n // New delegate\\n // Set start round\\n // Don't set start round if delegator is in pending state because the start round would not change\\n del.startRound = currentRound.add(1);\\n // Unbonded state = no existing delegate and no bonded stake\\n // Thus, delegation amount = provided amount\\n } else if (currentBondedAmount > 0 && currentDelegate != _to) {\\n // A registered transcoder cannot delegate its bonded stake toward another address\\n // because it can only be delegated toward itself\\n // In the future, if delegation towards another registered transcoder as an already\\n // registered transcoder becomes useful (i.e. for transitive delegation), this restriction\\n // could be removed\\n require(!isRegisteredTranscoder(_owner), \\\"registered transcoders can't delegate towards other addresses\\\");\\n // Changing delegate\\n // Set start round\\n del.startRound = currentRound.add(1);\\n // Update amount to delegate with previous delegation amount\\n delegationAmount = delegationAmount.add(currentBondedAmount);\\n\\n decreaseTotalStake(currentDelegate, currentBondedAmount, _oldDelegateNewPosPrev, _oldDelegateNewPosNext);\\n }\\n\\n {\\n Transcoder storage newDelegate = transcoders[_to];\\n EarningsPool.Data storage currPool = newDelegate.earningsPoolPerRound[currentRound];\\n if (currPool.cumulativeRewardFactor == 0) {\\n currPool.cumulativeRewardFactor = cumulativeFactorsPool(newDelegate, newDelegate.lastRewardRound)\\n .cumulativeRewardFactor;\\n }\\n if (currPool.cumulativeFeeFactor == 0) {\\n currPool.cumulativeFeeFactor = cumulativeFactorsPool(newDelegate, newDelegate.lastFeeRound)\\n .cumulativeFeeFactor;\\n }\\n }\\n\\n // cannot delegate to someone without having bonded stake\\n require(delegationAmount > 0, \\\"delegation amount must be greater than 0\\\");\\n // Update delegate\\n del.delegateAddress = _to;\\n // Update bonded amount\\n del.bondedAmount = currentBondedAmount.add(_amount);\\n\\n increaseTotalStake(_to, delegationAmount, _currDelegateNewPosPrev, _currDelegateNewPosNext);\\n\\n if (_amount > 0) {\\n // Transfer the LPT to the Minter\\n livepeerToken().transferFrom(msg.sender, address(minter()), _amount);\\n }\\n\\n emit Bond(_to, currentDelegate, _owner, _amount, del.bondedAmount);\\n }\\n\\n /**\\n * @notice Delegates stake towards a specific address and updates the transcoder pool using optional list hints if needed\\n * @dev If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint\\n * for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params.\\n * If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the\\n * insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params.\\n * In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint\\n * is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\\n * @param _amount The amount of tokens to stake.\\n * @param _to The address of the transcoder to stake towards\\n * @param _oldDelegateNewPosPrev The address of the previous transcoder in the pool for the old delegate\\n * @param _oldDelegateNewPosNext The address of the next transcoder in the pool for the old delegate\\n * @param _currDelegateNewPosPrev The address of the previous transcoder in the pool for the current delegate\\n * @param _currDelegateNewPosNext The address of the next transcoder in the pool for the current delegate\\n */\\n function bondWithHint(\\n uint256 _amount,\\n address _to,\\n address _oldDelegateNewPosPrev,\\n address _oldDelegateNewPosNext,\\n address _currDelegateNewPosPrev,\\n address _currDelegateNewPosNext\\n ) public {\\n bondForWithHint(\\n _amount,\\n msg.sender,\\n _to,\\n _oldDelegateNewPosPrev,\\n _oldDelegateNewPosNext,\\n _currDelegateNewPosPrev,\\n _currDelegateNewPosNext\\n );\\n }\\n\\n /**\\n * @notice Transfers ownership of a bond to a new delegator using optional hints if needed\\n *\\n * If the receiver is already bonded to a different delegate than the bond owner then the stake goes\\n * to the receiver's delegate otherwise the receiver's delegate is set as the owner's delegate\\n *\\n * @dev If the original delegate is in the transcoder pool, the caller can provide an optional hint for the\\n * insertion position of the delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params.\\n * If the target delegate is in the transcoder pool, the caller can provide an optional hint for the\\n * insertion position of the delegate via the `_newDelegateNewPosPrev` and `_newDelegateNewPosNext` params.\\n *\\n * In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint\\n * is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\\n * @param _delegator Receiver of the bond\\n * @param _amount Portion of the bond to transfer to receiver\\n * @param _oldDelegateNewPosPrev Address of previous transcoder in pool if the delegate remains in the pool\\n * @param _oldDelegateNewPosNext Address of next transcoder in pool if the delegate remains in the pool\\n * @param _newDelegateNewPosPrev Address of previous transcoder in pool if the delegate is in the pool\\n * @param _newDelegateNewPosNext Address of next transcoder in pool if the delegate is in the pool\\n */\\n function transferBond(\\n address _delegator,\\n uint256 _amount,\\n address _oldDelegateNewPosPrev,\\n address _oldDelegateNewPosNext,\\n address _newDelegateNewPosPrev,\\n address _newDelegateNewPosNext\\n ) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {\\n Delegator storage oldDel = delegators[msg.sender];\\n // Cache delegate address of caller before unbondWithHint because\\n // if unbondWithHint is for a full unbond the caller's delegate address will be set to null\\n address oldDelDelegate = oldDel.delegateAddress;\\n\\n unbondWithHint(_amount, _oldDelegateNewPosPrev, _oldDelegateNewPosNext);\\n\\n Delegator storage newDel = delegators[_delegator];\\n\\n uint256 oldDelUnbondingLockId = oldDel.nextUnbondingLockId.sub(1);\\n uint256 withdrawRound = oldDel.unbondingLocks[oldDelUnbondingLockId].withdrawRound;\\n\\n // Burn lock for current owner\\n delete oldDel.unbondingLocks[oldDelUnbondingLockId];\\n\\n // Create lock for new owner\\n uint256 newDelUnbondingLockId = newDel.nextUnbondingLockId;\\n\\n newDel.unbondingLocks[newDelUnbondingLockId] = UnbondingLock({ amount: _amount, withdrawRound: withdrawRound });\\n newDel.nextUnbondingLockId = newDel.nextUnbondingLockId.add(1);\\n\\n emit TransferBond(msg.sender, _delegator, oldDelUnbondingLockId, newDelUnbondingLockId, _amount);\\n\\n // Claim earnings for receiver before processing unbonding lock\\n uint256 currentRound = roundsManager().currentRound();\\n uint256 lastClaimRound = newDel.lastClaimRound;\\n if (lastClaimRound < currentRound) {\\n updateDelegatorWithEarnings(_delegator, currentRound, lastClaimRound);\\n }\\n\\n // Rebond lock for new owner\\n if (newDel.delegateAddress == address(0)) {\\n newDel.delegateAddress = oldDelDelegate;\\n }\\n\\n // Move to Pending state if receiver is currently in Unbonded state\\n if (delegatorStatus(_delegator) == DelegatorStatus.Unbonded) {\\n newDel.startRound = currentRound.add(1);\\n }\\n\\n // Process rebond using unbonding lock\\n processRebond(_delegator, newDelUnbondingLockId, _newDelegateNewPosPrev, _newDelegateNewPosNext);\\n }\\n\\n /**\\n * @notice Unbond an amount of the delegator's bonded stake and updates the transcoder pool using an optional list hint if needed\\n * @dev If the caller remains in the transcoder pool, the caller can provide an optional hint for its insertion position in the\\n * pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position.\\n * In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints\\n * @param _amount Amount of tokens to unbond\\n * @param _newPosPrev Address of previous transcoder in pool if the caller remains in the pool\\n * @param _newPosNext Address of next transcoder in pool if the caller remains in the pool\\n */\\n function unbondWithHint(\\n uint256 _amount,\\n address _newPosPrev,\\n address _newPosNext\\n ) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {\\n require(delegatorStatus(msg.sender) == DelegatorStatus.Bonded, \\\"caller must be bonded\\\");\\n\\n Delegator storage del = delegators[msg.sender];\\n\\n require(_amount > 0, \\\"unbond amount must be greater than 0\\\");\\n require(_amount <= del.bondedAmount, \\\"amount is greater than bonded amount\\\");\\n\\n address currentDelegate = del.delegateAddress;\\n uint256 currentRound = roundsManager().currentRound();\\n uint256 withdrawRound = currentRound.add(unbondingPeriod);\\n uint256 unbondingLockId = del.nextUnbondingLockId;\\n\\n // Create new unbonding lock\\n del.unbondingLocks[unbondingLockId] = UnbondingLock({ amount: _amount, withdrawRound: withdrawRound });\\n // Increment ID for next unbonding lock\\n del.nextUnbondingLockId = unbondingLockId.add(1);\\n // Decrease delegator's bonded amount\\n del.bondedAmount = del.bondedAmount.sub(_amount);\\n\\n if (del.bondedAmount == 0) {\\n // Delegator no longer delegated to anyone if it does not have a bonded amount\\n del.delegateAddress = address(0);\\n // Delegator does not have a start round if it is no longer delegated to anyone\\n del.startRound = 0;\\n\\n if (transcoderPool.contains(msg.sender)) {\\n resignTranscoder(msg.sender);\\n }\\n }\\n\\n // If msg.sender was resigned this statement will only decrease delegators[currentDelegate].delegatedAmount\\n decreaseTotalStake(currentDelegate, _amount, _newPosPrev, _newPosNext);\\n\\n emit Unbond(currentDelegate, msg.sender, unbondingLockId, _amount, withdrawRound);\\n }\\n\\n /**\\n * @notice Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status and updates\\n * the transcoder pool using an optional list hint if needed\\n * @dev If the delegate is in the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the\\n * pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position.\\n * In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints\\n * @param _unbondingLockId ID of unbonding lock to rebond with\\n * @param _newPosPrev Address of previous transcoder in pool if the delegate is in the pool\\n * @param _newPosNext Address of next transcoder in pool if the delegate is in the pool\\n */\\n function rebondWithHint(\\n uint256 _unbondingLockId,\\n address _newPosPrev,\\n address _newPosNext\\n ) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {\\n require(delegatorStatus(msg.sender) != DelegatorStatus.Unbonded, \\\"caller must be bonded\\\");\\n\\n // Process rebond using unbonding lock\\n processRebond(msg.sender, _unbondingLockId, _newPosPrev, _newPosNext);\\n }\\n\\n /**\\n * @notice Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status and updates the transcoder pool using\\n * an optional list hint if needed\\n * @dev If the delegate joins the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the\\n * pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position.\\n * In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\\n * @param _to Address of delegate\\n * @param _unbondingLockId ID of unbonding lock to rebond with\\n * @param _newPosPrev Address of previous transcoder in pool if the delegate joins the pool\\n * @param _newPosNext Address of next transcoder in pool if the delegate joins the pool\\n */\\n function rebondFromUnbondedWithHint(\\n address _to,\\n uint256 _unbondingLockId,\\n address _newPosPrev,\\n address _newPosNext\\n ) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {\\n require(delegatorStatus(msg.sender) == DelegatorStatus.Unbonded, \\\"caller must be unbonded\\\");\\n\\n // Set delegator's start round and transition into Pending state\\n delegators[msg.sender].startRound = roundsManager().currentRound().add(1);\\n // Set delegator's delegate\\n delegators[msg.sender].delegateAddress = _to;\\n // Process rebond using unbonding lock\\n processRebond(msg.sender, _unbondingLockId, _newPosPrev, _newPosNext);\\n }\\n\\n /**\\n * @notice Mint token rewards for an active transcoder and its delegators and update the transcoder pool using an optional list hint if needed\\n * @dev If the caller is in the transcoder pool, the caller can provide an optional hint for its insertion position in the\\n * pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position.\\n * In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints\\n * @param _newPosPrev Address of previous transcoder in pool if the caller is in the pool\\n * @param _newPosNext Address of next transcoder in pool if the caller is in the pool\\n */\\n function rewardWithHint(address _newPosPrev, address _newPosNext)\\n public\\n whenSystemNotPaused\\n currentRoundInitialized\\n {\\n uint256 currentRound = roundsManager().currentRound();\\n\\n require(isActiveTranscoder(msg.sender), \\\"caller must be an active transcoder\\\");\\n require(\\n transcoders[msg.sender].lastRewardRound != currentRound,\\n \\\"caller has already called reward for the current round\\\"\\n );\\n\\n Transcoder storage t = transcoders[msg.sender];\\n EarningsPool.Data storage earningsPool = t.earningsPoolPerRound[currentRound];\\n\\n // Set last round that transcoder called reward\\n earningsPool.setCommission(t.rewardCut, t.feeShare);\\n\\n // If transcoder didn't receive stake updates during the previous round and hasn't called reward for > 1 round\\n // the 'totalStake' on its 'EarningsPool' for the current round wouldn't be initialized\\n // Thus we sync the the transcoder's stake to when it was last updated\\n // 'updateTrancoderWithRewards()' will set the update round to 'currentRound +1' so this synchronization shouldn't occur frequently\\n uint256 lastUpdateRound = t.lastActiveStakeUpdateRound;\\n if (lastUpdateRound < currentRound) {\\n earningsPool.setStake(t.earningsPoolPerRound[lastUpdateRound].totalStake);\\n }\\n\\n // Create reward based on active transcoder's stake relative to the total active stake\\n // rewardTokens = (current mintable tokens for the round * active transcoder stake) / total active stake\\n uint256 rewardTokens = minter().createReward(earningsPool.totalStake, currentRoundTotalActiveStake);\\n\\n updateTranscoderWithRewards(msg.sender, rewardTokens, currentRound, _newPosPrev, _newPosNext);\\n\\n // Set last round that transcoder called reward\\n t.lastRewardRound = currentRound;\\n\\n emit Reward(msg.sender, rewardTokens);\\n }\\n\\n /**\\n * @notice Returns pending bonded stake for a delegator from its lastClaimRound through an end round\\n * @param _delegator Address of delegator\\n * @param _endRound The last round to compute pending stake from\\n * @return Pending bonded stake for '_delegator' since last claiming rewards\\n */\\n function pendingStake(address _delegator, uint256 _endRound) public view returns (uint256) {\\n // Silence unused param compiler warning\\n _endRound;\\n\\n uint256 endRound = roundsManager().currentRound();\\n (uint256 stake, ) = pendingStakeAndFees(_delegator, endRound);\\n return stake;\\n }\\n\\n /**\\n * @notice Returns pending fees for a delegator from its lastClaimRound through an end round\\n * @param _delegator Address of delegator\\n * @param _endRound The last round to compute pending fees from\\n * @return Pending fees for '_delegator' since last claiming fees\\n */\\n function pendingFees(address _delegator, uint256 _endRound) public view returns (uint256) {\\n // Silence unused param compiler warning\\n _endRound;\\n\\n uint256 endRound = roundsManager().currentRound();\\n (, uint256 fees) = pendingStakeAndFees(_delegator, endRound);\\n return fees;\\n }\\n\\n /**\\n * @notice Returns total bonded stake for a transcoder\\n * @param _transcoder Address of transcoder\\n * @return total bonded stake for a delegator\\n */\\n function transcoderTotalStake(address _transcoder) public view returns (uint256) {\\n return delegators[_transcoder].delegatedAmount;\\n }\\n\\n /**\\n * @notice Computes transcoder status\\n * @param _transcoder Address of transcoder\\n * @return registered or not registered transcoder status\\n */\\n function transcoderStatus(address _transcoder) public view returns (TranscoderStatus) {\\n if (isRegisteredTranscoder(_transcoder)) return TranscoderStatus.Registered;\\n return TranscoderStatus.NotRegistered;\\n }\\n\\n /**\\n * @notice Computes delegator status\\n * @param _delegator Address of delegator\\n * @return bonded, unbonded or pending delegator status\\n */\\n function delegatorStatus(address _delegator) public view returns (DelegatorStatus) {\\n Delegator storage del = delegators[_delegator];\\n\\n if (del.bondedAmount == 0) {\\n // Delegator unbonded all its tokens\\n return DelegatorStatus.Unbonded;\\n } else if (del.startRound > roundsManager().currentRound()) {\\n // Delegator round start is in the future\\n return DelegatorStatus.Pending;\\n } else {\\n // Delegator round start is now or in the past\\n // del.startRound != 0 here because if del.startRound = 0 then del.bondedAmount = 0 which\\n // would trigger the first if clause\\n return DelegatorStatus.Bonded;\\n }\\n }\\n\\n /**\\n * @notice Return transcoder information\\n * @param _transcoder Address of transcoder\\n * @return lastRewardRound Trancoder's last reward round\\n * @return rewardCut Transcoder's reward cut\\n * @return feeShare Transcoder's fee share\\n * @return lastActiveStakeUpdateRound Round in which transcoder's stake was last updated while active\\n * @return activationRound Round in which transcoder became active\\n * @return deactivationRound Round in which transcoder will no longer be active\\n * @return activeCumulativeRewards Transcoder's cumulative rewards that are currently active\\n * @return cumulativeRewards Transcoder's cumulative rewards (earned via its active staked rewards and its reward cut)\\n * @return cumulativeFees Transcoder's cumulative fees (earned via its active staked rewards and its fee share)\\n * @return lastFeeRound Latest round that the transcoder received fees\\n */\\n function getTranscoder(address _transcoder)\\n public\\n view\\n returns (\\n uint256 lastRewardRound,\\n uint256 rewardCut,\\n uint256 feeShare,\\n uint256 lastActiveStakeUpdateRound,\\n uint256 activationRound,\\n uint256 deactivationRound,\\n uint256 activeCumulativeRewards,\\n uint256 cumulativeRewards,\\n uint256 cumulativeFees,\\n uint256 lastFeeRound\\n )\\n {\\n Transcoder storage t = transcoders[_transcoder];\\n\\n lastRewardRound = t.lastRewardRound;\\n rewardCut = t.rewardCut;\\n feeShare = t.feeShare;\\n lastActiveStakeUpdateRound = t.lastActiveStakeUpdateRound;\\n activationRound = t.activationRound;\\n deactivationRound = t.deactivationRound;\\n activeCumulativeRewards = t.activeCumulativeRewards;\\n cumulativeRewards = t.cumulativeRewards;\\n cumulativeFees = t.cumulativeFees;\\n lastFeeRound = t.lastFeeRound;\\n }\\n\\n /**\\n * @notice Return transcoder's earnings pool for a given round\\n * @param _transcoder Address of transcoder\\n * @param _round Round number\\n * @return totalStake Transcoder's total stake in '_round'\\n * @return transcoderRewardCut Transcoder's reward cut for '_round'\\n * @return transcoderFeeShare Transcoder's fee share for '_round'\\n * @return cumulativeRewardFactor The cumulative reward factor for delegator rewards calculation (only used after LIP-36)\\n * @return cumulativeFeeFactor The cumulative fee factor for delegator fees calculation (only used after LIP-36)\\n */\\n function getTranscoderEarningsPoolForRound(address _transcoder, uint256 _round)\\n public\\n view\\n returns (\\n uint256 totalStake,\\n uint256 transcoderRewardCut,\\n uint256 transcoderFeeShare,\\n uint256 cumulativeRewardFactor,\\n uint256 cumulativeFeeFactor\\n )\\n {\\n EarningsPool.Data storage earningsPool = transcoders[_transcoder].earningsPoolPerRound[_round];\\n\\n totalStake = earningsPool.totalStake;\\n transcoderRewardCut = earningsPool.transcoderRewardCut;\\n transcoderFeeShare = earningsPool.transcoderFeeShare;\\n cumulativeRewardFactor = earningsPool.cumulativeRewardFactor;\\n cumulativeFeeFactor = earningsPool.cumulativeFeeFactor;\\n }\\n\\n /**\\n * @notice Return delegator info\\n * @param _delegator Address of delegator\\n * @return bondedAmount total amount bonded by '_delegator'\\n * @return fees amount of fees collected by '_delegator'\\n * @return delegateAddress address '_delegator' has bonded to\\n * @return delegatedAmount total amount delegated to '_delegator'\\n * @return startRound round in which bond for '_delegator' became effective\\n * @return lastClaimRound round for which '_delegator' has last claimed earnings\\n * @return nextUnbondingLockId ID for the next unbonding lock created for '_delegator'\\n */\\n function getDelegator(address _delegator)\\n public\\n view\\n returns (\\n uint256 bondedAmount,\\n uint256 fees,\\n address delegateAddress,\\n uint256 delegatedAmount,\\n uint256 startRound,\\n uint256 lastClaimRound,\\n uint256 nextUnbondingLockId\\n )\\n {\\n Delegator storage del = delegators[_delegator];\\n\\n bondedAmount = del.bondedAmount;\\n fees = del.fees;\\n delegateAddress = del.delegateAddress;\\n delegatedAmount = del.delegatedAmount;\\n startRound = del.startRound;\\n lastClaimRound = del.lastClaimRound;\\n nextUnbondingLockId = del.nextUnbondingLockId;\\n }\\n\\n /**\\n * @notice Return delegator's unbonding lock info\\n * @param _delegator Address of delegator\\n * @param _unbondingLockId ID of unbonding lock\\n * @return amount of stake locked up by unbonding lock\\n * @return withdrawRound round in which 'amount' becomes available for withdrawal\\n */\\n function getDelegatorUnbondingLock(address _delegator, uint256 _unbondingLockId)\\n public\\n view\\n returns (uint256 amount, uint256 withdrawRound)\\n {\\n UnbondingLock storage lock = delegators[_delegator].unbondingLocks[_unbondingLockId];\\n\\n return (lock.amount, lock.withdrawRound);\\n }\\n\\n /**\\n * @notice Returns max size of transcoder pool\\n * @return transcoder pool max size\\n */\\n function getTranscoderPoolMaxSize() public view returns (uint256) {\\n return transcoderPool.getMaxSize();\\n }\\n\\n /**\\n * @notice Returns size of transcoder pool\\n * @return transcoder pool current size\\n */\\n function getTranscoderPoolSize() public view returns (uint256) {\\n return transcoderPool.getSize();\\n }\\n\\n /**\\n * @notice Returns transcoder with most stake in pool\\n * @return address for transcoder with highest stake in transcoder pool\\n */\\n function getFirstTranscoderInPool() public view returns (address) {\\n return transcoderPool.getFirst();\\n }\\n\\n /**\\n * @notice Returns next transcoder in pool for a given transcoder\\n * @param _transcoder Address of a transcoder in the pool\\n * @return address for the transcoder after '_transcoder' in transcoder pool\\n */\\n function getNextTranscoderInPool(address _transcoder) public view returns (address) {\\n return transcoderPool.getNext(_transcoder);\\n }\\n\\n /**\\n * @notice Return total bonded tokens\\n * @return total active stake for the current round\\n */\\n function getTotalBonded() public view returns (uint256) {\\n return currentRoundTotalActiveStake;\\n }\\n\\n /**\\n * @notice Return whether a transcoder is active for the current round\\n * @param _transcoder Transcoder address\\n * @return true if transcoder is active\\n */\\n function isActiveTranscoder(address _transcoder) public view returns (bool) {\\n Transcoder storage t = transcoders[_transcoder];\\n uint256 currentRound = roundsManager().currentRound();\\n return t.activationRound <= currentRound && currentRound < t.deactivationRound;\\n }\\n\\n /**\\n * @notice Return whether a transcoder is registered\\n * @param _transcoder Transcoder address\\n * @return true if transcoder is self-bonded\\n */\\n function isRegisteredTranscoder(address _transcoder) public view returns (bool) {\\n Delegator storage d = delegators[_transcoder];\\n return d.delegateAddress == _transcoder && d.bondedAmount > 0;\\n }\\n\\n /**\\n * @notice Return whether an unbonding lock for a delegator is valid\\n * @param _delegator Address of delegator\\n * @param _unbondingLockId ID of unbonding lock\\n * @return true if unbondingLock for ID has a non-zero withdraw round\\n */\\n function isValidUnbondingLock(address _delegator, uint256 _unbondingLockId) public view returns (bool) {\\n // A unbonding lock is only valid if it has a non-zero withdraw round (the default value is zero)\\n return delegators[_delegator].unbondingLocks[_unbondingLockId].withdrawRound > 0;\\n }\\n\\n /**\\n * @notice Return an EarningsPool.Data struct with cumulative factors for a given round that are rescaled if needed\\n * @param _transcoder Storage pointer to a transcoder struct\\n * @param _round The round to fetch the cumulative factors for\\n */\\n function cumulativeFactorsPool(Transcoder storage _transcoder, uint256 _round)\\n internal\\n view\\n returns (EarningsPool.Data memory pool)\\n {\\n pool.cumulativeRewardFactor = _transcoder.earningsPoolPerRound[_round].cumulativeRewardFactor;\\n pool.cumulativeFeeFactor = _transcoder.earningsPoolPerRound[_round].cumulativeFeeFactor;\\n\\n return pool;\\n }\\n\\n /**\\n * @notice Return an EarningsPool.Data struct with the latest cumulative factors for a given round\\n * @param _transcoder Storage pointer to a transcoder struct\\n * @param _round The round to fetch the latest cumulative factors for\\n * @return pool An EarningsPool.Data populated with the latest cumulative factors for _round\\n */\\n function latestCumulativeFactorsPool(Transcoder storage _transcoder, uint256 _round)\\n internal\\n view\\n returns (EarningsPool.Data memory pool)\\n {\\n pool = cumulativeFactorsPool(_transcoder, _round);\\n\\n uint256 lastRewardRound = _transcoder.lastRewardRound;\\n // Only use the cumulativeRewardFactor for lastRewardRound if lastRewardRound is before _round\\n if (pool.cumulativeRewardFactor == 0 && lastRewardRound < _round) {\\n pool.cumulativeRewardFactor = cumulativeFactorsPool(_transcoder, lastRewardRound).cumulativeRewardFactor;\\n }\\n\\n uint256 lastFeeRound = _transcoder.lastFeeRound;\\n // Only use the cumulativeFeeFactor for lastFeeRound if lastFeeRound is before _round\\n if (pool.cumulativeFeeFactor == 0 && lastFeeRound < _round) {\\n pool.cumulativeFeeFactor = cumulativeFactorsPool(_transcoder, lastFeeRound).cumulativeFeeFactor;\\n }\\n\\n return pool;\\n }\\n\\n /**\\n * @notice Return a delegator's cumulative stake and fees using the LIP-36 earnings claiming algorithm\\n * @param _transcoder Storage pointer to a transcoder struct for a delegator's delegate\\n * @param _startRound The round for the start cumulative factors\\n * @param _endRound The round for the end cumulative factors\\n * @param _stake The delegator's initial stake before including earned rewards\\n * @param _fees The delegator's initial fees before including earned fees\\n * @return cStake , cFees where cStake is the delegator's cumulative stake including earned rewards and cFees is the delegator's cumulative fees including earned fees\\n */\\n function delegatorCumulativeStakeAndFees(\\n Transcoder storage _transcoder,\\n uint256 _startRound,\\n uint256 _endRound,\\n uint256 _stake,\\n uint256 _fees\\n ) internal view returns (uint256 cStake, uint256 cFees) {\\n // Fetch start cumulative factors\\n EarningsPool.Data memory startPool = cumulativeFactorsPool(_transcoder, _startRound);\\n\\n // If the start cumulativeRewardFactor is 0 set the default value to PreciseMathUtils.percPoints(1, 1)\\n if (startPool.cumulativeRewardFactor == 0) {\\n startPool.cumulativeRewardFactor = PreciseMathUtils.percPoints(1, 1);\\n }\\n\\n // Fetch end cumulative factors\\n EarningsPool.Data memory endPool = latestCumulativeFactorsPool(_transcoder, _endRound);\\n\\n // If the end cumulativeRewardFactor is 0 set the default value to PreciseMathUtils.percPoints(1, 1)\\n if (endPool.cumulativeRewardFactor == 0) {\\n endPool.cumulativeRewardFactor = PreciseMathUtils.percPoints(1, 1);\\n }\\n\\n cFees = _fees.add(\\n PreciseMathUtils.percOf(\\n _stake,\\n endPool.cumulativeFeeFactor.sub(startPool.cumulativeFeeFactor),\\n startPool.cumulativeRewardFactor\\n )\\n );\\n\\n cStake = PreciseMathUtils.percOf(_stake, endPool.cumulativeRewardFactor, startPool.cumulativeRewardFactor);\\n\\n return (cStake, cFees);\\n }\\n\\n /**\\n * @notice Return the pending stake and fees for a delegator\\n * @param _delegator Address of a delegator\\n * @param _endRound The last round to claim earnings for when calculating the pending stake and fees\\n * @return stake , fees where stake is the delegator's pending stake and fees is the delegator's pending fees\\n */\\n function pendingStakeAndFees(address _delegator, uint256 _endRound)\\n internal\\n view\\n returns (uint256 stake, uint256 fees)\\n {\\n Delegator storage del = delegators[_delegator];\\n Transcoder storage t = transcoders[del.delegateAddress];\\n\\n fees = del.fees;\\n stake = del.bondedAmount;\\n\\n uint256 startRound = del.lastClaimRound.add(1);\\n address delegateAddr = del.delegateAddress;\\n bool isTranscoder = _delegator == delegateAddr;\\n\\n // Make sure there is a round to claim i.e. end round - (start round - 1) > 0\\n if (startRound <= _endRound) {\\n (stake, fees) = delegatorCumulativeStakeAndFees(t, startRound.sub(1), _endRound, stake, fees);\\n }\\n // cumulativeRewards and cumulativeFees will track *all* rewards/fees earned by the transcoder\\n // so it is important that this is only executed with the end round as the current round or else\\n // the returned stake and fees will reflect rewards/fees earned in the future relative to the end round\\n if (isTranscoder) {\\n stake = stake.add(t.cumulativeRewards);\\n fees = fees.add(t.cumulativeFees);\\n }\\n\\n return (stake, fees);\\n }\\n\\n /**\\n * @dev Increase the total stake for a delegate and updates its 'lastActiveStakeUpdateRound'\\n * @param _delegate The delegate to increase the stake for\\n * @param _amount The amount to increase the stake for '_delegate' by\\n */\\n function increaseTotalStake(\\n address _delegate,\\n uint256 _amount,\\n address _newPosPrev,\\n address _newPosNext\\n ) internal {\\n if (isRegisteredTranscoder(_delegate)) {\\n uint256 currStake = transcoderTotalStake(_delegate);\\n uint256 newStake = currStake.add(_amount);\\n uint256 currRound = roundsManager().currentRound();\\n uint256 nextRound = currRound.add(1);\\n\\n // If the transcoder is already in the active set update its stake and return\\n if (transcoderPool.contains(_delegate)) {\\n transcoderPool.updateKey(_delegate, newStake, _newPosPrev, _newPosNext);\\n nextRoundTotalActiveStake = nextRoundTotalActiveStake.add(_amount);\\n Transcoder storage t = transcoders[_delegate];\\n\\n // currStake (the transcoder's delegatedAmount field) will reflect the transcoder's stake from lastActiveStakeUpdateRound\\n // because it is updated every time lastActiveStakeUpdateRound is updated\\n // The current active total stake is set to currStake to ensure that the value can be used in updateTranscoderWithRewards()\\n // and updateTranscoderWithFees() when lastActiveStakeUpdateRound > currentRound\\n if (t.lastActiveStakeUpdateRound < currRound) {\\n t.earningsPoolPerRound[currRound].setStake(currStake);\\n }\\n\\n t.earningsPoolPerRound[nextRound].setStake(newStake);\\n t.lastActiveStakeUpdateRound = nextRound;\\n } else {\\n // Check if the transcoder is eligible to join the active set in the update round\\n tryToJoinActiveSet(_delegate, newStake, nextRound, _newPosPrev, _newPosNext);\\n }\\n }\\n\\n // Increase delegate's delegated amount\\n delegators[_delegate].delegatedAmount = delegators[_delegate].delegatedAmount.add(_amount);\\n }\\n\\n /**\\n * @dev Decrease the total stake for a delegate and updates its 'lastActiveStakeUpdateRound'\\n * @param _delegate The transcoder to decrease the stake for\\n * @param _amount The amount to decrease the stake for '_delegate' by\\n */\\n function decreaseTotalStake(\\n address _delegate,\\n uint256 _amount,\\n address _newPosPrev,\\n address _newPosNext\\n ) internal {\\n if (transcoderPool.contains(_delegate)) {\\n uint256 currStake = transcoderTotalStake(_delegate);\\n uint256 newStake = currStake.sub(_amount);\\n uint256 currRound = roundsManager().currentRound();\\n uint256 nextRound = currRound.add(1);\\n\\n transcoderPool.updateKey(_delegate, newStake, _newPosPrev, _newPosNext);\\n nextRoundTotalActiveStake = nextRoundTotalActiveStake.sub(_amount);\\n Transcoder storage t = transcoders[_delegate];\\n\\n // currStake (the transcoder's delegatedAmount field) will reflect the transcoder's stake from lastActiveStakeUpdateRound\\n // because it is updated every time lastActiveStakeUpdateRound is updated\\n // The current active total stake is set to currStake to ensure that the value can be used in updateTranscoderWithRewards()\\n // and updateTranscoderWithFees() when lastActiveStakeUpdateRound > currentRound\\n if (t.lastActiveStakeUpdateRound < currRound) {\\n t.earningsPoolPerRound[currRound].setStake(currStake);\\n }\\n\\n t.lastActiveStakeUpdateRound = nextRound;\\n t.earningsPoolPerRound[nextRound].setStake(newStake);\\n }\\n\\n // Decrease old delegate's delegated amount\\n delegators[_delegate].delegatedAmount = delegators[_delegate].delegatedAmount.sub(_amount);\\n }\\n\\n /**\\n * @dev Tries to add a transcoder to active transcoder pool, evicts the active transcoder with the lowest stake if the pool is full\\n * @param _transcoder The transcoder to insert into the transcoder pool\\n * @param _totalStake The total stake for '_transcoder'\\n * @param _activationRound The round in which the transcoder should become active\\n */\\n function tryToJoinActiveSet(\\n address _transcoder,\\n uint256 _totalStake,\\n uint256 _activationRound,\\n address _newPosPrev,\\n address _newPosNext\\n ) internal {\\n uint256 pendingNextRoundTotalActiveStake = nextRoundTotalActiveStake;\\n\\n if (transcoderPool.isFull()) {\\n address lastTranscoder = transcoderPool.getLast();\\n uint256 lastStake = transcoderTotalStake(lastTranscoder);\\n\\n // If the pool is full and the transcoder has less stake than the least stake transcoder in the pool\\n // then the transcoder is unable to join the active set for the next round\\n if (_totalStake <= lastStake) {\\n return;\\n }\\n\\n // Evict the least stake transcoder from the active set for the next round\\n // Not zeroing 'Transcoder.lastActiveStakeUpdateRound' saves gas (5k when transcoder is evicted and 20k when transcoder is reinserted)\\n // There should be no side-effects as long as the value is properly updated on stake updates\\n // Not zeroing the stake on the current round's 'EarningsPool' saves gas and should have no side effects as long as\\n // 'EarningsPool.setStake()' is called whenever a transcoder becomes active again.\\n transcoderPool.remove(lastTranscoder);\\n transcoders[lastTranscoder].deactivationRound = _activationRound;\\n pendingNextRoundTotalActiveStake = pendingNextRoundTotalActiveStake.sub(lastStake);\\n\\n emit TranscoderDeactivated(lastTranscoder, _activationRound);\\n }\\n\\n transcoderPool.insert(_transcoder, _totalStake, _newPosPrev, _newPosNext);\\n pendingNextRoundTotalActiveStake = pendingNextRoundTotalActiveStake.add(_totalStake);\\n Transcoder storage t = transcoders[_transcoder];\\n t.lastActiveStakeUpdateRound = _activationRound;\\n t.activationRound = _activationRound;\\n t.deactivationRound = MAX_FUTURE_ROUND;\\n t.earningsPoolPerRound[_activationRound].setStake(_totalStake);\\n nextRoundTotalActiveStake = pendingNextRoundTotalActiveStake;\\n emit TranscoderActivated(_transcoder, _activationRound);\\n }\\n\\n /**\\n * @dev Remove a transcoder from the pool and deactivate it\\n */\\n function resignTranscoder(address _transcoder) internal {\\n // Not zeroing 'Transcoder.lastActiveStakeUpdateRound' saves gas (5k when transcoder is evicted and 20k when transcoder is reinserted)\\n // There should be no side-effects as long as the value is properly updated on stake updates\\n // Not zeroing the stake on the current round's 'EarningsPool' saves gas and should have no side effects as long as\\n // 'EarningsPool.setStake()' is called whenever a transcoder becomes active again.\\n transcoderPool.remove(_transcoder);\\n nextRoundTotalActiveStake = nextRoundTotalActiveStake.sub(transcoderTotalStake(_transcoder));\\n uint256 deactivationRound = roundsManager().currentRound().add(1);\\n transcoders[_transcoder].deactivationRound = deactivationRound;\\n emit TranscoderDeactivated(_transcoder, deactivationRound);\\n }\\n\\n /**\\n * @dev Update a transcoder with rewards and update the transcoder pool with an optional list hint if needed.\\n * See SortedDoublyLL.sol for details on list hints\\n * @param _transcoder Address of transcoder\\n * @param _rewards Amount of rewards\\n * @param _round Round that transcoder is updated\\n * @param _newPosPrev Address of previous transcoder in pool if the transcoder is in the pool\\n * @param _newPosNext Address of next transcoder in pool if the transcoder is in the pool\\n */\\n function updateTranscoderWithRewards(\\n address _transcoder,\\n uint256 _rewards,\\n uint256 _round,\\n address _newPosPrev,\\n address _newPosNext\\n ) internal {\\n Transcoder storage t = transcoders[_transcoder];\\n EarningsPool.Data storage earningsPool = t.earningsPoolPerRound[_round];\\n EarningsPool.Data memory prevEarningsPool = cumulativeFactorsPool(t, t.lastRewardRound);\\n\\n t.activeCumulativeRewards = t.cumulativeRewards;\\n\\n uint256 transcoderCommissionRewards = MathUtils.percOf(_rewards, earningsPool.transcoderRewardCut);\\n uint256 delegatorsRewards = _rewards.sub(transcoderCommissionRewards);\\n // Calculate the rewards earned by the transcoder's earned rewards\\n uint256 transcoderRewardStakeRewards = PreciseMathUtils.percOf(\\n delegatorsRewards,\\n t.activeCumulativeRewards,\\n earningsPool.totalStake\\n );\\n // Track rewards earned by the transcoder based on its earned rewards and rewardCut\\n t.cumulativeRewards = t.cumulativeRewards.add(transcoderRewardStakeRewards).add(transcoderCommissionRewards);\\n // Update cumulative reward factor with new rewards\\n // The cumulativeRewardFactor is used to calculate rewards for all delegators including the transcoder (self-delegated)\\n // Note that delegatorsRewards includes transcoderRewardStakeRewards, but no delegator will claim that amount using\\n // the earnings claiming algorithm and instead that amount is accounted for in the transcoder's cumulativeRewards field\\n earningsPool.updateCumulativeRewardFactor(prevEarningsPool, delegatorsRewards);\\n // Update transcoder's total stake with rewards\\n increaseTotalStake(_transcoder, _rewards, _newPosPrev, _newPosNext);\\n }\\n\\n /**\\n * @dev Update a delegator with token pools shares from its lastClaimRound through a given round\\n * @param _delegator Delegator address\\n * @param _endRound The last round for which to update a delegator's stake with earnings pool shares\\n * @param _lastClaimRound The round for which a delegator has last claimed earnings\\n */\\n function updateDelegatorWithEarnings(\\n address _delegator,\\n uint256 _endRound,\\n uint256 _lastClaimRound\\n ) internal {\\n Delegator storage del = delegators[_delegator];\\n uint256 startRound = _lastClaimRound.add(1);\\n uint256 currentBondedAmount = del.bondedAmount;\\n uint256 currentFees = del.fees;\\n\\n // Only will have earnings to claim if you have a delegate\\n // If not delegated, skip the earnings claim process\\n if (del.delegateAddress != address(0)) {\\n (currentBondedAmount, currentFees) = pendingStakeAndFees(_delegator, _endRound);\\n\\n // Check whether the endEarningsPool is initialised\\n // If it is not initialised set it's cumulative factors so that they can be used when a delegator\\n // next claims earnings as the start cumulative factors (see delegatorCumulativeStakeAndFees())\\n Transcoder storage t = transcoders[del.delegateAddress];\\n EarningsPool.Data storage endEarningsPool = t.earningsPoolPerRound[_endRound];\\n if (endEarningsPool.cumulativeRewardFactor == 0) {\\n uint256 lastRewardRound = t.lastRewardRound;\\n if (lastRewardRound < _endRound) {\\n endEarningsPool.cumulativeRewardFactor = cumulativeFactorsPool(t, lastRewardRound)\\n .cumulativeRewardFactor;\\n }\\n }\\n if (endEarningsPool.cumulativeFeeFactor == 0) {\\n uint256 lastFeeRound = t.lastFeeRound;\\n if (lastFeeRound < _endRound) {\\n endEarningsPool.cumulativeFeeFactor = cumulativeFactorsPool(t, lastFeeRound).cumulativeFeeFactor;\\n }\\n }\\n\\n if (del.delegateAddress == _delegator) {\\n t.cumulativeFees = 0;\\n t.cumulativeRewards = 0;\\n // activeCumulativeRewards is not cleared here because the next reward() call will set it to cumulativeRewards\\n }\\n }\\n\\n emit EarningsClaimed(\\n del.delegateAddress,\\n _delegator,\\n currentBondedAmount.sub(del.bondedAmount),\\n currentFees.sub(del.fees),\\n startRound,\\n _endRound\\n );\\n\\n del.lastClaimRound = _endRound;\\n // Rewards are bonded by default\\n del.bondedAmount = currentBondedAmount;\\n del.fees = currentFees;\\n }\\n\\n /**\\n * @dev Update the state of a delegator and its delegate by processing a rebond using an unbonding lock and update the transcoder pool with an optional\\n * list hint if needed. See SortedDoublyLL.sol for details on list hints\\n * @param _delegator Address of delegator\\n * @param _unbondingLockId ID of unbonding lock to rebond with\\n * @param _newPosPrev Address of previous transcoder in pool if the delegate is already in or joins the pool\\n * @param _newPosNext Address of next transcoder in pool if the delegate is already in or joins the pool\\n */\\n function processRebond(\\n address _delegator,\\n uint256 _unbondingLockId,\\n address _newPosPrev,\\n address _newPosNext\\n ) internal {\\n Delegator storage del = delegators[_delegator];\\n UnbondingLock storage lock = del.unbondingLocks[_unbondingLockId];\\n\\n require(isValidUnbondingLock(_delegator, _unbondingLockId), \\\"invalid unbonding lock ID\\\");\\n\\n uint256 amount = lock.amount;\\n // Increase delegator's bonded amount\\n del.bondedAmount = del.bondedAmount.add(amount);\\n\\n // Delete lock\\n delete del.unbondingLocks[_unbondingLockId];\\n\\n increaseTotalStake(del.delegateAddress, amount, _newPosPrev, _newPosNext);\\n\\n emit Rebond(del.delegateAddress, _delegator, _unbondingLockId, amount);\\n }\\n\\n /**\\n * @dev Return LivepeerToken interface\\n * @return Livepeer token contract registered with Controller\\n */\\n function livepeerToken() internal view returns (ILivepeerToken) {\\n return ILivepeerToken(controller.getContract(keccak256(\\\"LivepeerToken\\\")));\\n }\\n\\n /**\\n * @dev Return Minter interface\\n * @return Minter contract registered with Controller\\n */\\n function minter() internal view returns (IMinter) {\\n return IMinter(controller.getContract(keccak256(\\\"Minter\\\")));\\n }\\n\\n /**\\n * @dev Return RoundsManager interface\\n * @return RoundsManager contract registered with Controller\\n */\\n function roundsManager() internal view returns (IRoundsManager) {\\n return IRoundsManager(controller.getContract(keccak256(\\\"RoundsManager\\\")));\\n }\\n\\n function _onlyTicketBroker() internal view {\\n require(msg.sender == controller.getContract(keccak256(\\\"TicketBroker\\\")), \\\"caller must be TicketBroker\\\");\\n }\\n\\n function _onlyRoundsManager() internal view {\\n require(msg.sender == controller.getContract(keccak256(\\\"RoundsManager\\\")), \\\"caller must be RoundsManager\\\");\\n }\\n\\n function _onlyVerifier() internal view {\\n require(msg.sender == controller.getContract(keccak256(\\\"Verifier\\\")), \\\"caller must be Verifier\\\");\\n }\\n\\n function _currentRoundInitialized() internal view {\\n require(roundsManager().currentRoundInitialized(), \\\"current round is not initialized\\\");\\n }\\n\\n function _autoClaimEarnings() internal {\\n uint256 currentRound = roundsManager().currentRound();\\n uint256 lastClaimRound = delegators[msg.sender].lastClaimRound;\\n if (lastClaimRound < currentRound) {\\n updateDelegatorWithEarnings(msg.sender, currentRound, lastClaimRound);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1bbb7de3d413515bb96cd745429e4bbb3f68f7fcc1a275dc31827472df9162d\",\"license\":\"MIT\"},\"contracts/bonding/IBondingManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\n/**\\n * @title Interface for BondingManager\\n * TODO: switch to interface type\\n */\\ninterface IBondingManager {\\n event TranscoderUpdate(address indexed transcoder, uint256 rewardCut, uint256 feeShare);\\n event TranscoderActivated(address indexed transcoder, uint256 activationRound);\\n event TranscoderDeactivated(address indexed transcoder, uint256 deactivationRound);\\n event TranscoderSlashed(address indexed transcoder, address finder, uint256 penalty, uint256 finderReward);\\n event Reward(address indexed transcoder, uint256 amount);\\n event Bond(\\n address indexed newDelegate,\\n address indexed oldDelegate,\\n address indexed delegator,\\n uint256 additionalAmount,\\n uint256 bondedAmount\\n );\\n event Unbond(\\n address indexed delegate,\\n address indexed delegator,\\n uint256 unbondingLockId,\\n uint256 amount,\\n uint256 withdrawRound\\n );\\n event Rebond(address indexed delegate, address indexed delegator, uint256 unbondingLockId, uint256 amount);\\n event TransferBond(\\n address indexed oldDelegator,\\n address indexed newDelegator,\\n uint256 oldUnbondingLockId,\\n uint256 newUnbondingLockId,\\n uint256 amount\\n );\\n event WithdrawStake(address indexed delegator, uint256 unbondingLockId, uint256 amount, uint256 withdrawRound);\\n event WithdrawFees(address indexed delegator, address recipient, uint256 amount);\\n event EarningsClaimed(\\n address indexed delegate,\\n address indexed delegator,\\n uint256 rewards,\\n uint256 fees,\\n uint256 startRound,\\n uint256 endRound\\n );\\n\\n // Deprecated events\\n // These event signatures can be used to construct the appropriate topic hashes to filter for past logs corresponding\\n // to these deprecated events.\\n // event Bond(address indexed delegate, address indexed delegator);\\n // event Unbond(address indexed delegate, address indexed delegator);\\n // event WithdrawStake(address indexed delegator);\\n // event TranscoderUpdate(address indexed transcoder, uint256 pendingRewardCut, uint256 pendingFeeShare, uint256 pendingPricePerSegment, bool registered);\\n // event TranscoderEvicted(address indexed transcoder);\\n // event TranscoderResigned(address indexed transcoder);\\n\\n // External functions\\n function updateTranscoderWithFees(\\n address _transcoder,\\n uint256 _fees,\\n uint256 _round\\n ) external;\\n\\n function slashTranscoder(\\n address _transcoder,\\n address _finder,\\n uint256 _slashAmount,\\n uint256 _finderFee\\n ) external;\\n\\n function setCurrentRoundTotalActiveStake() external;\\n\\n // Public functions\\n function getTranscoderPoolSize() external view returns (uint256);\\n\\n function transcoderTotalStake(address _transcoder) external view returns (uint256);\\n\\n function isActiveTranscoder(address _transcoder) external view returns (bool);\\n\\n function getTotalBonded() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x6406378868b556ca91b1ab6cccd036695c8984d30a225f75a5979cb9aa7c1df2\",\"license\":\"MIT\"},\"contracts/bonding/libraries/EarningsPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"../../libraries/MathUtils.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\n/**\\n * @title EarningsPool\\n * @dev Manages reward and fee pools for delegators and transcoders\\n */\\nlibrary EarningsPool {\\n using SafeMath for uint256;\\n\\n struct Data {\\n uint256 totalStake; // Transcoder's total stake during the earnings pool's round\\n uint256 transcoderRewardCut; // Transcoder's reward cut during the earnings pool's round\\n uint256 transcoderFeeShare; // Transcoder's fee share during the earnings pool's round\\n // LIP-36 (https://github.com/livepeer/LIPs/blob/master/LIPs/LIP-36.md) fields\\n // See EarningsPoolLIP36.sol\\n uint256 cumulativeRewardFactor;\\n uint256 cumulativeFeeFactor;\\n }\\n\\n /**\\n * @dev Sets transcoderRewardCut and transcoderFeeshare for an EarningsPool\\n * @param earningsPool Storage pointer to EarningsPool struct\\n * @param _rewardCut Reward cut of transcoder during the earnings pool's round\\n * @param _feeShare Fee share of transcoder during the earnings pool's round\\n */\\n function setCommission(\\n EarningsPool.Data storage earningsPool,\\n uint256 _rewardCut,\\n uint256 _feeShare\\n ) internal {\\n earningsPool.transcoderRewardCut = _rewardCut;\\n earningsPool.transcoderFeeShare = _feeShare;\\n }\\n\\n /**\\n * @dev Sets totalStake for an EarningsPool\\n * @param earningsPool Storage pointer to EarningsPool struct\\n * @param _stake Total stake of the transcoder during the earnings pool's round\\n */\\n function setStake(EarningsPool.Data storage earningsPool, uint256 _stake) internal {\\n earningsPool.totalStake = _stake;\\n }\\n}\\n\",\"keccak256\":\"0x0a281920caf1429fc6afe7de303b8067c182190a450a190c8b9dc282aa7edfa0\",\"license\":\"MIT\"},\"contracts/bonding/libraries/EarningsPoolLIP36.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./EarningsPool.sol\\\";\\nimport \\\"../../libraries/PreciseMathUtils.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\nlibrary EarningsPoolLIP36 {\\n using SafeMath for uint256;\\n\\n /**\\n * @notice Update the cumulative fee factor stored in an earnings pool with new fees\\n * @param earningsPool Storage pointer to EarningsPools.Data struct\\n * @param _prevEarningsPool In-memory EarningsPool.Data struct that stores the previous cumulative reward and fee factors\\n * @param _fees Amount of new fees\\n */\\n function updateCumulativeFeeFactor(\\n EarningsPool.Data storage earningsPool,\\n EarningsPool.Data memory _prevEarningsPool,\\n uint256 _fees\\n ) internal {\\n uint256 prevCumulativeFeeFactor = _prevEarningsPool.cumulativeFeeFactor;\\n uint256 prevCumulativeRewardFactor = _prevEarningsPool.cumulativeRewardFactor != 0\\n ? _prevEarningsPool.cumulativeRewardFactor\\n : PreciseMathUtils.percPoints(1, 1);\\n\\n // Initialize the cumulativeFeeFactor when adding fees for the first time\\n if (earningsPool.cumulativeFeeFactor == 0) {\\n earningsPool.cumulativeFeeFactor = prevCumulativeFeeFactor.add(\\n PreciseMathUtils.percOf(prevCumulativeRewardFactor, _fees, earningsPool.totalStake)\\n );\\n return;\\n }\\n\\n earningsPool.cumulativeFeeFactor = earningsPool.cumulativeFeeFactor.add(\\n PreciseMathUtils.percOf(prevCumulativeRewardFactor, _fees, earningsPool.totalStake)\\n );\\n }\\n\\n /**\\n * @notice Update the cumulative reward factor stored in an earnings pool with new rewards\\n * @param earningsPool Storage pointer to EarningsPool.Data struct\\n * @param _prevEarningsPool Storage pointer to EarningsPool.Data struct that stores the previous cumulative reward factor\\n * @param _rewards Amount of new rewards\\n */\\n function updateCumulativeRewardFactor(\\n EarningsPool.Data storage earningsPool,\\n EarningsPool.Data memory _prevEarningsPool,\\n uint256 _rewards\\n ) internal {\\n uint256 prevCumulativeRewardFactor = _prevEarningsPool.cumulativeRewardFactor != 0\\n ? _prevEarningsPool.cumulativeRewardFactor\\n : PreciseMathUtils.percPoints(1, 1);\\n\\n earningsPool.cumulativeRewardFactor = prevCumulativeRewardFactor.add(\\n PreciseMathUtils.percOf(prevCumulativeRewardFactor, _rewards, earningsPool.totalStake)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbcdc25cc40f8c62d38ed116d67b6c05469cc32e1fc97846e853f7860f29ac8e7\",\"license\":\"MIT\"},\"contracts/libraries/MathUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\nlibrary MathUtils {\\n using SafeMath for uint256;\\n\\n // Divisor used for representing percentages\\n uint256 public constant PERC_DIVISOR = 1000000;\\n\\n /**\\n * @dev Returns whether an amount is a valid percentage out of PERC_DIVISOR\\n * @param _amount Amount that is supposed to be a percentage\\n */\\n function validPerc(uint256 _amount) internal pure returns (bool) {\\n return _amount <= PERC_DIVISOR;\\n }\\n\\n /**\\n * @dev Compute percentage of a value with the percentage represented by a fraction\\n * @param _amount Amount to take the percentage of\\n * @param _fracNum Numerator of fraction representing the percentage\\n * @param _fracDenom Denominator of fraction representing the percentage\\n */\\n function percOf(\\n uint256 _amount,\\n uint256 _fracNum,\\n uint256 _fracDenom\\n ) internal pure returns (uint256) {\\n return _amount.mul(percPoints(_fracNum, _fracDenom)).div(PERC_DIVISOR);\\n }\\n\\n /**\\n * @dev Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR\\n * @param _amount Amount to take the percentage of\\n * @param _fracNum Numerator of fraction representing the percentage with PERC_DIVISOR as the denominator\\n */\\n function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {\\n return _amount.mul(_fracNum).div(PERC_DIVISOR);\\n }\\n\\n /**\\n * @dev Compute percentage representation of a fraction\\n * @param _fracNum Numerator of fraction represeting the percentage\\n * @param _fracDenom Denominator of fraction represeting the percentage\\n */\\n function percPoints(uint256 _fracNum, uint256 _fracDenom) internal pure returns (uint256) {\\n return _fracNum.mul(PERC_DIVISOR).div(_fracDenom);\\n }\\n}\\n\",\"keccak256\":\"0x1df26c159dc63d804d3fda28e41b18487e8619009082c56e013aa6c9a58de253\",\"license\":\"MIT\"},\"contracts/libraries/PreciseMathUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\nlibrary PreciseMathUtils {\\n using SafeMath for uint256;\\n\\n // Divisor used for representing percentages\\n uint256 public constant PERC_DIVISOR = 10**27;\\n\\n /**\\n * @dev Returns whether an amount is a valid percentage out of PERC_DIVISOR\\n * @param _amount Amount that is supposed to be a percentage\\n */\\n function validPerc(uint256 _amount) internal pure returns (bool) {\\n return _amount <= PERC_DIVISOR;\\n }\\n\\n /**\\n * @dev Compute percentage of a value with the percentage represented by a fraction\\n * @param _amount Amount to take the percentage of\\n * @param _fracNum Numerator of fraction representing the percentage\\n * @param _fracDenom Denominator of fraction representing the percentage\\n */\\n function percOf(\\n uint256 _amount,\\n uint256 _fracNum,\\n uint256 _fracDenom\\n ) internal pure returns (uint256) {\\n return _amount.mul(percPoints(_fracNum, _fracDenom)).div(PERC_DIVISOR);\\n }\\n\\n /**\\n * @dev Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR\\n * @param _amount Amount to take the percentage of\\n * @param _fracNum Numerator of fraction representing the percentage with PERC_DIVISOR as the denominator\\n */\\n function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {\\n return _amount.mul(_fracNum).div(PERC_DIVISOR);\\n }\\n\\n /**\\n * @dev Compute percentage representation of a fraction\\n * @param _fracNum Numerator of fraction represeting the percentage\\n * @param _fracDenom Denominator of fraction represeting the percentage\\n */\\n function percPoints(uint256 _fracNum, uint256 _fracDenom) internal pure returns (uint256) {\\n return _fracNum.mul(PERC_DIVISOR).div(_fracDenom);\\n }\\n}\\n\",\"keccak256\":\"0x89ebb6e1db8b184d655c6c2726e3fd862a239767f8d249ca376b286ade675a9d\",\"license\":\"MIT\"},\"contracts/libraries/SortedDoublyLL.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\n\\n/**\\n * @title A sorted doubly linked list with nodes sorted in descending order. Optionally accepts insert position hints\\n *\\n * Given a new node with a `key`, a hint is of the form `(prevId, nextId)` s.t. `prevId` and `nextId` are adjacent in the list.\\n * `prevId` is a node with a key >= `key` and `nextId` is a node with a key <= `key`. If the sender provides a hint that is a valid insert position\\n * the insert operation is a constant time storage write. However, the provided hint in a given transaction might be a valid insert position, but if other transactions are included first, when\\n * the given transaction is executed the provided hint may no longer be a valid insert position. For example, one of the nodes referenced might be removed or their keys may\\n * be updated such that the the pair of nodes in the hint no longer represent a valid insert position. If one of the nodes in the hint becomes invalid, we still try to use the other\\n * valid node as a starting point for finding the appropriate insert position. If both nodes in the hint become invalid, we use the head of the list as a starting point\\n * to find the appropriate insert position.\\n */\\nlibrary SortedDoublyLL {\\n using SafeMath for uint256;\\n\\n // Information for a node in the list\\n struct Node {\\n uint256 key; // Node's key used for sorting\\n address nextId; // Id of next node (smaller key) in the list\\n address prevId; // Id of previous node (larger key) in the list\\n }\\n\\n // Information for the list\\n struct Data {\\n address head; // Head of the list. Also the node in the list with the largest key\\n address tail; // Tail of the list. Also the node in the list with the smallest key\\n uint256 maxSize; // Maximum size of the list\\n uint256 size; // Current size of the list\\n mapping(address => Node) nodes; // Track the corresponding ids for each node in the list\\n }\\n\\n /**\\n * @dev Set the maximum size of the list\\n * @param _size Maximum size\\n */\\n function setMaxSize(Data storage self, uint256 _size) public {\\n require(_size > self.maxSize, \\\"new max size must be greater than old max size\\\");\\n\\n self.maxSize = _size;\\n }\\n\\n /**\\n * @dev Add a node to the list\\n * @param _id Node's id\\n * @param _key Node's key\\n * @param _prevId Id of previous node for the insert position\\n * @param _nextId Id of next node for the insert position\\n */\\n function insert(\\n Data storage self,\\n address _id,\\n uint256 _key,\\n address _prevId,\\n address _nextId\\n ) public {\\n // List must not be full\\n require(!isFull(self), \\\"list is full\\\");\\n // List must not already contain node\\n require(!contains(self, _id), \\\"node already in list\\\");\\n // Node id must not be null\\n require(_id != address(0), \\\"node id is null\\\");\\n // Key must be non-zero\\n require(_key > 0, \\\"key is zero\\\");\\n\\n address prevId = _prevId;\\n address nextId = _nextId;\\n\\n if (!validInsertPosition(self, _key, prevId, nextId)) {\\n // Sender's hint was not a valid insert position\\n // Use sender's hint to find a valid insert position\\n (prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);\\n }\\n\\n self.nodes[_id].key = _key;\\n\\n if (prevId == address(0) && nextId == address(0)) {\\n // Insert as head and tail\\n self.head = _id;\\n self.tail = _id;\\n } else if (prevId == address(0)) {\\n // Insert before `prevId` as the head\\n self.nodes[_id].nextId = self.head;\\n self.nodes[self.head].prevId = _id;\\n self.head = _id;\\n } else if (nextId == address(0)) {\\n // Insert after `nextId` as the tail\\n self.nodes[_id].prevId = self.tail;\\n self.nodes[self.tail].nextId = _id;\\n self.tail = _id;\\n } else {\\n // Insert at insert position between `prevId` and `nextId`\\n self.nodes[_id].nextId = nextId;\\n self.nodes[_id].prevId = prevId;\\n self.nodes[prevId].nextId = _id;\\n self.nodes[nextId].prevId = _id;\\n }\\n\\n self.size = self.size.add(1);\\n }\\n\\n /**\\n * @dev Remove a node from the list\\n * @param _id Node's id\\n */\\n function remove(Data storage self, address _id) public {\\n // List must contain the node\\n require(contains(self, _id), \\\"node not in list\\\");\\n\\n if (self.size > 1) {\\n // List contains more than a single node\\n if (_id == self.head) {\\n // The removed node is the head\\n // Set head to next node\\n self.head = self.nodes[_id].nextId;\\n // Set prev pointer of new head to null\\n self.nodes[self.head].prevId = address(0);\\n } else if (_id == self.tail) {\\n // The removed node is the tail\\n // Set tail to previous node\\n self.tail = self.nodes[_id].prevId;\\n // Set next pointer of new tail to null\\n self.nodes[self.tail].nextId = address(0);\\n } else {\\n // The removed node is neither the head nor the tail\\n // Set next pointer of previous node to the next node\\n self.nodes[self.nodes[_id].prevId].nextId = self.nodes[_id].nextId;\\n // Set prev pointer of next node to the previous node\\n self.nodes[self.nodes[_id].nextId].prevId = self.nodes[_id].prevId;\\n }\\n } else {\\n // List contains a single node\\n // Set the head and tail to null\\n self.head = address(0);\\n self.tail = address(0);\\n }\\n\\n delete self.nodes[_id];\\n self.size = self.size.sub(1);\\n }\\n\\n /**\\n * @dev Update the key of a node in the list\\n * @param _id Node's id\\n * @param _newKey Node's new key\\n * @param _prevId Id of previous node for the new insert position\\n * @param _nextId Id of next node for the new insert position\\n */\\n function updateKey(\\n Data storage self,\\n address _id,\\n uint256 _newKey,\\n address _prevId,\\n address _nextId\\n ) public {\\n // List must contain the node\\n require(contains(self, _id), \\\"node not in list\\\");\\n\\n // Remove node from the list\\n remove(self, _id);\\n\\n if (_newKey > 0) {\\n // Insert node if it has a non-zero key\\n insert(self, _id, _newKey, _prevId, _nextId);\\n }\\n }\\n\\n /**\\n * @dev Checks if the list contains a node\\n * @param _id Address of transcoder\\n * @return true if '_id' is in list\\n */\\n function contains(Data storage self, address _id) public view returns (bool) {\\n // List only contains non-zero keys, so if key is non-zero the node exists\\n return self.nodes[_id].key > 0;\\n }\\n\\n /**\\n * @dev Checks if the list is full\\n * @return true if list is full\\n */\\n function isFull(Data storage self) public view returns (bool) {\\n return self.size == self.maxSize;\\n }\\n\\n /**\\n * @dev Checks if the list is empty\\n * @return true if list is empty\\n */\\n function isEmpty(Data storage self) public view returns (bool) {\\n return self.size == 0;\\n }\\n\\n /**\\n * @dev Returns the current size of the list\\n * @return current size of the list\\n */\\n function getSize(Data storage self) public view returns (uint256) {\\n return self.size;\\n }\\n\\n /**\\n * @dev Returns the maximum size of the list\\n */\\n function getMaxSize(Data storage self) public view returns (uint256) {\\n return self.maxSize;\\n }\\n\\n /**\\n * @dev Returns the key of a node in the list\\n * @param _id Node's id\\n * @return key for node with '_id'\\n */\\n function getKey(Data storage self, address _id) public view returns (uint256) {\\n return self.nodes[_id].key;\\n }\\n\\n /**\\n * @dev Returns the first node in the list (node with the largest key)\\n * @return address for the head of the list\\n */\\n function getFirst(Data storage self) public view returns (address) {\\n return self.head;\\n }\\n\\n /**\\n * @dev Returns the last node in the list (node with the smallest key)\\n * @return address for the tail of the list\\n */\\n function getLast(Data storage self) public view returns (address) {\\n return self.tail;\\n }\\n\\n /**\\n * @dev Returns the next node (with a smaller key) in the list for a given node\\n * @param _id Node's id\\n * @return address for the node following node in list with '_id'\\n */\\n function getNext(Data storage self, address _id) public view returns (address) {\\n return self.nodes[_id].nextId;\\n }\\n\\n /**\\n * @dev Returns the previous node (with a larger key) in the list for a given node\\n * @param _id Node's id\\n * address for the node before node in list with '_id'\\n */\\n function getPrev(Data storage self, address _id) public view returns (address) {\\n return self.nodes[_id].prevId;\\n }\\n\\n /**\\n * @dev Check if a pair of nodes is a valid insertion point for a new node with the given key\\n * @param _key Node's key\\n * @param _prevId Id of previous node for the insert position\\n * @param _nextId Id of next node for the insert position\\n * @return if the insert position is valid\\n */\\n function validInsertPosition(\\n Data storage self,\\n uint256 _key,\\n address _prevId,\\n address _nextId\\n ) public view returns (bool) {\\n if (_prevId == address(0) && _nextId == address(0)) {\\n // `(null, null)` is a valid insert position if the list is empty\\n return isEmpty(self);\\n } else if (_prevId == address(0)) {\\n // `(null, _nextId)` is a valid insert position if `_nextId` is the head of the list\\n return self.head == _nextId && _key >= self.nodes[_nextId].key;\\n } else if (_nextId == address(0)) {\\n // `(_prevId, null)` is a valid insert position if `_prevId` is the tail of the list\\n return self.tail == _prevId && _key <= self.nodes[_prevId].key;\\n } else {\\n // `(_prevId, _nextId)` is a valid insert position if they are adjacent nodes and `_key` falls between the two nodes' keys\\n return\\n self.nodes[_prevId].nextId == _nextId &&\\n self.nodes[_prevId].key >= _key &&\\n _key >= self.nodes[_nextId].key;\\n }\\n }\\n\\n /**\\n * @dev Descend the list (larger keys to smaller keys) to find a valid insert position\\n * @param _key Node's key\\n * @param _startId Id of node to start ascending the list from\\n */\\n function descendList(\\n Data storage self,\\n uint256 _key,\\n address _startId\\n ) private view returns (address, address) {\\n // If `_startId` is the head, check if the insert position is before the head\\n if (self.head == _startId && _key >= self.nodes[_startId].key) {\\n return (address(0), _startId);\\n }\\n\\n address prevId = _startId;\\n address nextId = self.nodes[prevId].nextId;\\n\\n // Descend the list until we reach the end or until we find a valid insert position\\n while (prevId != address(0) && !validInsertPosition(self, _key, prevId, nextId)) {\\n prevId = self.nodes[prevId].nextId;\\n nextId = self.nodes[prevId].nextId;\\n }\\n\\n return (prevId, nextId);\\n }\\n\\n /**\\n * @dev Ascend the list (smaller keys to larger keys) to find a valid insert position\\n * @param _key Node's key\\n * @param _startId Id of node to start descending the list from\\n */\\n function ascendList(\\n Data storage self,\\n uint256 _key,\\n address _startId\\n ) private view returns (address, address) {\\n // If `_startId` is the tail, check if the insert position is after the tail\\n if (self.tail == _startId && _key <= self.nodes[_startId].key) {\\n return (_startId, address(0));\\n }\\n\\n address nextId = _startId;\\n address prevId = self.nodes[nextId].prevId;\\n\\n // Ascend the list until we reach the end or until we find a valid insertion point\\n while (nextId != address(0) && !validInsertPosition(self, _key, prevId, nextId)) {\\n nextId = self.nodes[nextId].prevId;\\n prevId = self.nodes[nextId].prevId;\\n }\\n\\n return (prevId, nextId);\\n }\\n\\n /**\\n * @dev Find the insert position for a new node with the given key\\n * @param _key Node's key\\n * @param _prevId Id of previous node for the insert position\\n * @param _nextId Id of next node for the insert position\\n */\\n function findInsertPosition(\\n Data storage self,\\n uint256 _key,\\n address _prevId,\\n address _nextId\\n ) private view returns (address, address) {\\n address prevId = _prevId;\\n address nextId = _nextId;\\n\\n if (prevId != address(0)) {\\n if (!contains(self, prevId) || _key > self.nodes[prevId].key) {\\n // `prevId` does not exist anymore or now has a smaller key than the given key\\n prevId = address(0);\\n }\\n }\\n\\n if (nextId != address(0)) {\\n if (!contains(self, nextId) || _key < self.nodes[nextId].key) {\\n // `nextId` does not exist anymore or now has a larger key than the given key\\n nextId = address(0);\\n }\\n }\\n\\n if (prevId == address(0) && nextId == address(0)) {\\n // No hint - descend list starting from head\\n return descendList(self, _key, self.head);\\n } else if (prevId == address(0)) {\\n // No `prevId` for hint - ascend list starting from `nextId`\\n return ascendList(self, _key, nextId);\\n } else if (nextId == address(0)) {\\n // No `nextId` for hint - descend list starting from `prevId`\\n return descendList(self, _key, prevId);\\n } else {\\n // Descend list starting from `prevId`\\n return descendList(self, _key, prevId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xdd26a77d6b76a7885f1a59c4b8cc6b8c1e21382012cbd9da136529160370e216\",\"license\":\"MIT\"},\"contracts/rounds/IRoundsManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\n/**\\n * @title RoundsManager interface\\n */\\ninterface IRoundsManager {\\n // Events\\n event NewRound(uint256 indexed round, bytes32 blockHash);\\n\\n // Deprecated events\\n // These event signatures can be used to construct the appropriate topic hashes to filter for past logs corresponding\\n // to these deprecated events.\\n // event NewRound(uint256 round)\\n\\n // External functions\\n function initializeRound() external;\\n\\n function lipUpgradeRound(uint256 _lip) external view returns (uint256);\\n\\n // Public functions\\n function blockNum() external view returns (uint256);\\n\\n function blockHash(uint256 _block) external view returns (bytes32);\\n\\n function blockHashForRound(uint256 _round) external view returns (bytes32);\\n\\n function currentRound() external view returns (uint256);\\n\\n function currentRoundStartBlock() external view returns (uint256);\\n\\n function currentRoundInitialized() external view returns (bool);\\n\\n function currentRoundLocked() external view returns (bool);\\n}\\n\",\"keccak256\":\"0xfc453a476bb68b874c21678a128b46ffcad0af69008e0e3e857d46499214f75f\",\"license\":\"MIT\"},\"contracts/snapshots/IMerkleSnapshot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\ninterface IMerkleSnapshot {\\n function verify(\\n bytes32 _id,\\n bytes32[] calldata _proof,\\n bytes32 _leaf\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xdc35b4faac2739b596a0773123dfe4dadfe3ecabc2ac48325b4732146cd90180\",\"license\":\"MIT\"},\"contracts/token/ILivepeerToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ninterface ILivepeerToken is IERC20 {\\n function mint(address _to, uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0xe9f35b4fd415a199993ac13e273149f9f8f2cf3d14c06927f05c40a9d6d048e1\",\"license\":\"MIT\"},\"contracts/token/IMinter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"../IController.sol\\\";\\n\\n/**\\n * @title Minter interface\\n */\\ninterface IMinter {\\n // Events\\n event SetCurrentRewardTokens(uint256 currentMintableTokens, uint256 currentInflation);\\n\\n // External functions\\n function createReward(uint256 _fracNum, uint256 _fracDenom) external returns (uint256);\\n\\n function trustedTransferTokens(address _to, uint256 _amount) external;\\n\\n function trustedBurnTokens(uint256 _amount) external;\\n\\n function trustedWithdrawETH(address payable _to, uint256 _amount) external;\\n\\n function depositETH() external payable returns (bool);\\n\\n function setCurrentRewardTokens() external;\\n\\n function currentMintableTokens() external view returns (uint256);\\n\\n function currentMintedTokens() external view returns (uint256);\\n\\n // Public functions\\n function getController() external view returns (IController);\\n}\\n\",\"keccak256\":\"0x3fbb7a4239a8b5979fb4c45a41495e9694a9f454de82dca3cf6a14dfe71255c7\",\"license\":\"MIT\"},\"contracts/zeppelin/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\n/**\\n * @title Ownable\\n * @dev The Ownable contract has an owner address, and provides basic authorization control\\n * functions, this simplifies the implementation of \\\"user permissions\\\".\\n */\\ncontract Ownable {\\n address public owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\\n * account.\\n */\\n constructor() {\\n owner = msg.sender;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n /**\\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\\n * @param newOwner The address to transfer ownership to.\\n */\\n function transferOwnership(address newOwner) public onlyOwner {\\n require(newOwner != address(0));\\n emit OwnershipTransferred(owner, newOwner);\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x64f114689f2f161c4a4b8fc8442ab914436a33e6021bf17401eaeac73319a419\",\"license\":\"MIT\"},\"contracts/zeppelin/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport \\\"./Ownable.sol\\\";\\n\\n/**\\n * @title Pausable\\n * @dev Base contract which allows children to implement an emergency stop mechanism.\\n */\\ncontract Pausable is Ownable {\\n event Pause();\\n event Unpause();\\n\\n bool public paused;\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused);\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n */\\n modifier whenPaused() {\\n require(paused);\\n _;\\n }\\n\\n /**\\n * @dev called by the owner to pause, triggers stopped state\\n */\\n function pause() public onlyOwner whenNotPaused {\\n paused = true;\\n emit Pause();\\n }\\n\\n /**\\n * @dev called by the owner to unpause, returns to normal state\\n */\\n function unpause() public onlyOwner whenPaused {\\n paused = false;\\n emit Unpause();\\n }\\n}\\n\",\"keccak256\":\"0xe9635fcac46c22547a08f6977a8c75e7341411f1201f60bdd4c79c26e6c286ef\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620049753803806200497583398101604081905262000034916200005a565b600080546001600160a01b0319166001600160a01b03929092169190911790556200008c565b6000602082840312156200006d57600080fd5b81516001600160a01b03811681146200008557600080fd5b9392505050565b6148d9806200009c6000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c80635c50c3561161015c57806392eefe9b116100ce578063b78d27dc11610087578063b78d27dc14610751578063eaffb3f914610764578063ee4e804a14610777578063f10d1de11461078a578063f595f1cc1461079d578063f77c4791146107b057600080fd5b806392eefe9b146106545780639500ed9b146106675780639d0b2c7a1461067a5780639ef9df941461068d578063a64ad595146106a0578063ad3b1b471461073e57600080fd5b80636cf6d675116101205780636cf6d675146105d1578063713f2216146105fe5780637fc4606f14610606578063818710561461061957806388a6c7491461062c5780638b2f16521461063457600080fd5b80635c50c356146104de5780635dce9948146104e6578063673a456b1461059857806368ba170c146105ab5780636bd9add4146105be57600080fd5b806327de9e32116101f5578063412f83b6116101b9578063412f83b6146104515780634196ee75146104a857806343d3461a146104b1578063465501d3146104c457806351720b41146104cd5780635a2a75a9146104d657600080fd5b806327de9e32146103ef5780632a4e0d55146104025780633550aa10146104185780633a080e931461042b5780633aeb512c1461043e57600080fd5b8063228cb73311610247578063228cb7331461030757806322bf9d7c1461030f578063235c96031461032257806324454fc41461034d57806324b1babf146103c957806325d5971f146103dc57600080fd5b80630584a37314610284578063062e98b81461029957806308802374146102ac5780630fd02fc1146102d45780631544fc67146102e7575b600080fd5b6102976102923660046143c7565b6107c3565b005b6102976102a736600461441a565b610913565b6102bf6102ba366004614493565b610b8e565b60405190151581526020015b60405180910390f35b6102bf6102e23660046144b0565b610c40565b6102fa6102f5366004614493565b610c71565b6040516102cb91906144f2565b610297610d2d565b61029761031d36600461450c565b610d3a565b610335610330366004614493565b611111565b6040516001600160a01b0390911681526020016102cb565b6103a161035b3660046144b0565b6001600160a01b03909116600090815260046020818152604080842094845260039485019091529091208054600182015460028301549483015492909301549094929392565b604080519586526020860194909452928401919091526060830152608082015260a0016102cb565b6102976103d7366004614552565b6111ac565b6102976103ea366004614552565b6111c7565b6102976103fd366004614552565b611407565b61040a611413565b6040519081526020016102cb565b61029761042636600461456b565b61149f565b6102976104393660046144b0565b6118d3565b61029761044c36600461459a565b6118e4565b61049361045f3660046144b0565b6001600160a01b03919091166000908152600360209081526040808320938352600790930190522080546001909101549091565b604080519283526020830191909152016102cb565b61040a60055481565b6102976104bf3660046145cf565b611beb565b61040a60065481565b61040a60015481565b61040a611bf8565b60055461040a565b61054e6104f4366004614493565b6001600160a01b031660009081526004602081905260409091208054600182015460028301549383015460058401546006850154600786015460088701546009880154600a90980154969995989794969395929491939092565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e0840152610100830152610120820152610140016102cb565b6102976105a6366004614552565b611c33565b6102bf6105b9366004614493565b611d06565b6102976105cc3660046145f1565b611d3e565b6002546105e59067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016102cb565b610297611d55565b61029761061436600461462c565b611d65565b61029761062736600461466e565b611df0565b610335612093565b610647610642366004614493565b612119565b6040516102cb91906146a7565b610297610662366004614493565b612139565b61029761067536600461462c565b61218f565b61040a6106883660046144b0565b6124e8565b61040a61069b366004614493565b61257b565b6106fb6106ae366004614493565b6001600160a01b0390811660009081526003602081905260409091208054600182015460028301549383015460048401546005850154600690950154939792969590951694909390929091565b6040805197885260208801969096526001600160a01b03909416948601949094526060850191909152608084015260a083019190915260c082015260e0016102cb565b61029761074c3660046144b0565b61259a565b61029761075f3660046146bb565b612731565b610297610772366004614552565b612741565b6102976107853660046146e0565b61274d565b61029761079836600461476d565b612b30565b61040a6107ab3660046144b0565b612ba9565b600054610335906001600160a01b031681565b6107cb612c3c565b6107d3612d00565b6107db612dc4565b60026107e633610c71565b60028111156107f7576107f76144dc565b146108495760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206d75737420626520756e626f6e64656400000000000000000060448201526064015b60405180910390fd5b6108cc6001610856612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190614797565b90612ee0565b3360008181526003602052604090206004810192909255600290910180546001600160a01b0319166001600160a01b03871617905561090d90848484612eec565b50505050565b61091b612c3c565b610923612d00565b61092b612dc4565b33600090815260036020526040902060028101546001600160a01b031661095387878761218f565b6001600160a01b0388166000908152600360205260408120600684015490919061097e906001612ffc565b905060008460070160008381526020019081526020016000206001015490508460070160008381526020019081526020016000206000808201600090556001820160009055505060008360060154905060405180604001604052808c8152602001838152508460070160008381526020019081526020016000206000820151816000015560208201518160010155905050610a2760018560060154612ee090919063ffffffff16565b600685015560408051848152602081018390529081018c90526001600160a01b038d169033907ff136b986590e86cf1abd7b6600186a7a1178ad3cbbdf0f3312e79f6214a2a5679060600160405180910390a36000610a84612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610abc57600080fd5b505afa158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af49190614797565b600586015490915081811015610b0f57610b0f8e8383613008565b60028601546001600160a01b0316610b3f576002860180546001600160a01b0319166001600160a01b0389161790555b6002610b4a8f610c71565b6002811115610b5b57610b5b6144dc565b1415610b7257610b6c826001612ee0565b60048701555b610b7e8e848c8c612eec565b5050505050505050505050505050565b6001600160a01b038116600090815260046020526040812081610baf612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610be757600080fd5b505afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f9190614797565b905080826005015411158015610c385750816006015481105b949350505050565b6001600160a01b03919091166000908152600360209081526040808320938352600790930190522060010154151590565b6001600160a01b03811660009081526003602052604081208054610c985750600292915050565b610ca0612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd857600080fd5b505afa158015610cec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d109190614797565b81600401541115610d245750600092915050565b50600192915050565b610d38600080611df0565b565b610d42612c3c565b610d4a613194565b6001600160a01b03841660009081526003602052604090208054156110b6576001600160a01b038516600090815260036020526040812054610d8c908561328f565b60405163b0138c4760e01b8152600760048201526001600160a01b038816602482015290915073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b0138c479060440160206040518083038186803b158015610de957600080fd5b505af4158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2191906147b0565b15610e2f57610e2f866132a8565b8154610e3b9082612ffc565b82556001610e4887610c71565b6002811115610e5957610e596144dc565b1415610eac5760028201546001600160a01b031660009081526003602081905260409091200154610e8a9082612ffc565b60028301546001600160a01b0316600090815260036020819052604090912001555b806001600160a01b03861615610ffb576000610ec8838661328f565b9050610ed26133a1565b60405163e7a49c2b60e01b81526001600160a01b03898116600483015260248201849052919091169063e7a49c2b90604401600060405180830381600087803b158015610f1e57600080fd5b505af1158015610f32573d6000803e3d6000fd5b50505050610f3e6133a1565b6001600160a01b031663c7ee98c2610f568484612ffc565b6040518263ffffffff1660e01b8152600401610f7491815260200190565b600060405180830381600087803b158015610f8e57600080fd5b505af1158015610fa2573d6000803e3d6000fd5b5050604080516001600160a01b038b8116825260208201889052918101859052908b1692507ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c22915060600160405180910390a2506110af565b6110036133a1565b6001600160a01b031663c7ee98c2826040518263ffffffff1660e01b815260040161103091815260200190565b600060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b5050604080516000808252602082018790528183015290516001600160a01b038b1693507ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c2292509081900360600190a25b505061110a565b604080516001600160a01b03868116825260006020830181905292820192909252908616907ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c22906060015b60405180910390a25b5050505050565b60405163e189dedb60e01b8152600760048201526001600160a01b038216602482015260009073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063e189dedb9060440160206040518083038186803b15801561116e57600080fd5b505af4158015611182573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a691906147d2565b92915050565b6111b4612c3c565b6111bc612d00565b6111c4612dc4565b50565b6111cf612c3c565b6111d7612d00565b3360008181526003602090815260408083208584526007810190925290912090916112029084610c40565b61124a5760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081d5b989bdb991a5b99c81b1bd8dac81251603a1b6044820152606401610840565b611252612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c29190614797565b8160010154111561133b5760405162461bcd60e51b815260206004820152603b60248201527f776974686472617720726f756e64206d757374206265206265666f7265206f7260448201527f20657175616c20746f207468652063757272656e7420726f756e6400000000006064820152608401610840565b805460018083015460008681526007860160205260408120818155909201919091556113656133a1565b60405163e7a49c2b60e01b8152336004820152602481018490526001600160a01b03919091169063e7a49c2b90604401600060405180830381600087803b1580156113af57600080fd5b505af11580156113c3573d6000803e3d6000fd5b505060408051888152602081018690529081018490523392507f1340f1a8f3d456a649e1a12071dfa15655e3d09252131d0f980c3b405cc8dd2e9150606001611101565b6111c48160008061218f565b604051631665d9cb60e31b81526007600482015260009073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b32ece58906024015b60206040518083038186803b15801561146257600080fd5b505af4158015611476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a9190614797565b905090565b6114a7612c3c565b6114af612d00565b6114b7612e67565b6001600160a01b0316636841f2536040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ef57600080fd5b505afa158015611503573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152791906147b0565b1561159a5760405162461bcd60e51b815260206004820152603760248201527f63616e277420757064617465207472616e73636f64657220706172616d732c2060448201527f63757272656e7420726f756e64206973206c6f636b65640000000000000000006064820152608401610840565b6115a784620f4240101590565b6115f35760405162461bcd60e51b815260206004820152601c60248201527f696e76616c6964207265776172644375742070657263656e74616765000000006044820152606401610840565b61160083620f4240101590565b61164c5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642066656553686172652070657263656e7461676500000000006044820152606401610840565b61165533611d06565b6116a15760405162461bcd60e51b815260206004820152601d60248201527f7472616e73636f646572206d75737420626520726567697374657265640000006044820152606401610840565b336000908152600460205260408120906116b9612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116f157600080fd5b505afa158015611705573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117299190614797565b905061173433610b8e565b15806117405750815481145b6117ca5760405162461bcd60e51b815260206004820152604f60248201527f63616c6c65722063616e277420626520616374697665206f72206d757374206860448201527f61766520616c72656164792063616c6c65642072657761726420666f7220746860648201526e194818dd5c9c995b9d081c9bdd5b99608a1b608482015260a401610840565b600182018690556002820185905560405163b0138c4760e01b81526007600482015233602482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b0138c479060440160206040518083038186803b15801561182957600080fd5b505af415801561183d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186191906147b0565b6118905733600081815260036020819052604090912001546118909190611889846001612ee0565b87876133f2565b604080518781526020810187905233917f7346854431dbb3eb8e373c604abf89e90f4865b8447e1e2834d7b3e4677bf544910160405180910390a2505050505050565b6118e082826000806107c3565b5050565b6118ec612c3c565b6118f4613709565b6118fd83611d06565b6119495760405162461bcd60e51b815260206004820152601d60248201527f7472616e73636f646572206d75737420626520726567697374657265640000006044820152606401610840565b6000611953612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561198b57600080fd5b505afa15801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190614797565b6001600160a01b03851660009081526004602090815260408083208054600782015486865260038301909452918420949550939092611a0c85611a07886001612ffc565b613804565b905083861115611a565760018581015460028088015492850191909155830155600485015486811015611a4d57600081815260038701602052604090205483555b85600801549350505b81546060820151158015611a6957508685145b15611b7b576000611a786133a1565b90506000611b35611b2c836001600160a01b0316632de22cdb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611abb57600080fd5b505afa158015611acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af39190614797565b846001600160a01b0316639ae6309a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b846005546138a9565b90506000611b4782876001015461328f565b90506000611b558383612ffc565b6003880154909150611b719086611b6c8482612ee0565b6138a9565b6060870152505050505b6000611b8b8a856002015461328f565b90506000611b998b83612ffc565b90506000611ba88388866138a9565b9050611bc5826108c6838c60090154612ee090919063ffffffff16565b60098a0155611bd58686856138cf565b50505050600a9094019490945550505050505050565b6118e0828260008061149f565b6040516339ade16560e11b81526007600482015260009073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063735bc2ca9060240161144a565b611c3b61394a565b60405163a176adaf60e01b8152600760048201526024810182905273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063a176adaf9060440160006040518083038186803b158015611c8d57600080fd5b505af4158015611ca1573d6000803e3d6000fd5b505050507f9f5033568d78ae30f29f01e944f97b2216493bd19d1b46d429673acff3dcd674604051611cfb906020808252601490820152736e756d4163746976655472616e73636f6465727360601b604082015260600190565b60405180910390a150565b6001600160a01b0380821660008181526003602052604081206002810154919390929116148015611d375750805415155b9392505050565b611d4d8633878787878761274d565b505050505050565b611d5d613a2e565b600654600555565b611d6d612c3c565b611d75612d00565b611d7d612dc4565b6002611d8833610c71565b6002811115611d9957611d996144dc565b1415611ddf5760405162461bcd60e51b815260206004820152601560248201527418d85b1b195c881b5d5cdd08189948189bdb991959605a1b6044820152606401610840565b611deb33848484612eec565b505050565b611df8612c3c565b611e00612d00565b6000611e0a612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e4257600080fd5b505afa158015611e56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7a9190614797565b9050611e8533610b8e565b611edd5760405162461bcd60e51b815260206004820152602360248201527f63616c6c6572206d75737420626520616e20616374697665207472616e73636f6044820152623232b960e91b6064820152608401610840565b33600090815260046020526040902054811415611f5b5760405162461bcd60e51b815260206004820152603660248201527f63616c6c65722068617320616c72656164792063616c6c65642072657761726460448201527508199bdc881d1a194818dd5c9c995b9d081c9bdd5b9960521b6064820152608401610840565b3360009081526004602090815260408083208484526003810190925290912060018083015460028085015492840191909155820155600482015483811015611fb157600081815260038401602052604090205482555b6000611fbb6133a1565b8354600554604051637dbedad560e01b8152600481019290925260248201526001600160a01b039190911690637dbedad590604401602060405180830381600087803b15801561200a57600080fd5b505af115801561201e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120429190614797565b90506120513382878a8a613b29565b84845560405181815233907f619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9906020015b60405180910390a250505050505050565b604051632ebb2fed60e01b81526007600482015260009073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb90632ebb2fed9060240160206040518083038186803b1580156120e157600080fd5b505af41580156120f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a91906147d2565b600061212482611d06565b1561213157506001919050565b506000919050565b612141613beb565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f7090602001611cfb565b612197612c3c565b61219f612d00565b6121a7612dc4565b60016121b233610c71565b60028111156121c3576121c36144dc565b146122085760405162461bcd60e51b815260206004820152601560248201527418d85b1b195c881b5d5cdd08189948189bdb991959605a1b6044820152606401610840565b336000908152600360205260409020836122705760405162461bcd60e51b8152602060048201526024808201527f756e626f6e6420616d6f756e74206d75737420626520677265617465722074686044820152630616e20360e41b6064820152608401610840565b80548411156122cd5760405162461bcd60e51b8152602060048201526024808201527f616d6f756e742069732067726561746572207468616e20626f6e64656420616d6044820152631bdd5b9d60e21b6064820152608401610840565b60028101546001600160a01b031660006122e5612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561231d57600080fd5b505afa158015612331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123559190614797565b60025490915060009061237390839067ffffffffffffffff16612ee0565b60068501546040805180820182528a81526020808201858152600085815260078b01909252929020905181559051600191820155919250906123b6908290612ee0565b600686015584546123c79089612ffc565b808655612484576002850180546001600160a01b0319169055600060048087019190915560405163b0138c4760e01b815260079181019190915233602482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b0138c479060440160206040518083038186803b15801561243e57600080fd5b505af4158015612452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247691906147b0565b1561248457612484336132a8565b61249084898989613c45565b60408051828152602081018a905290810183905233906001600160a01b038616907f2d5d98d189bee5496a08db2a5948cb7e5e786f09d17d0c3f228eb41776c24a069060600160405180910390a35050505050505050565b6000806124f3612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561252b57600080fd5b505afa15801561253f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125639190614797565b905060006125718583613ea8565b5095945050505050565b6001600160a01b03166000908152600360208190526040909120015490565b6125a2612c3c565b6125aa612d00565b6125b2612dc4565b6001600160a01b0382166125fc5760405162461bcd60e51b81526020600482015260116024820152701a5b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606401610840565b336000908152600360205260409020600101548181101561265f5760405162461bcd60e51b815260206004820152601d60248201527f696e73756666696369656e74206665657320746f2077697468647261770000006044820152606401610840565b6126698183612ffc565b336000908152600360205260409020600101556126846133a1565b6040516320283da960e01b81526001600160a01b0385811660048301526024820185905291909116906320283da990604401600060405180830381600087803b1580156126d057600080fd5b505af11580156126e4573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690523393507f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e492500160405180910390a2505050565b6118e08282600080600080611d3e565b6111c481600080611d65565b612755612c3c565b61275d612d00565b612765612dc4565b6001600160a01b038616600090815260036020526040812090612786612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127be57600080fd5b505afa1580156127d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f69190614797565b60028084015484549293508b926001600160a01b03909116916128188c610c71565b6002811115612829576128296144dc565b14156128445761283a846001612ee0565b600486015561290f565b6000811180156128665750896001600160a01b0316826001600160a01b031614155b1561290f576128748b611d06565b156128e75760405162461bcd60e51b815260206004820152603d60248201527f72656769737465726564207472616e73636f646572732063616e27742064656c60448201527f656761746520746f7761726473206f74686572206164647265737365730000006064820152608401610840565b6128f2846001612ee0565b60048601556129018382612ee0565b925061290f82828b8b613c45565b6001600160a01b038a16600090815260046020908152604080832087845260038082019093529220908101546129575761294d828360000154613f6d565b6060015160038201555b60048101546129785761296e8283600a0154613f6d565b6080015160048201555b5050600083116129db5760405162461bcd60e51b815260206004820152602860248201527f64656c65676174696f6e20616d6f756e74206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610840565b6002850180546001600160a01b0319166001600160a01b038c16179055612a02818d612ee0565b8555612a108a848989613fd0565b8b15612abe57612a1e61422e565b6001600160a01b03166323b872dd33612a356133a1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018f9052606401602060405180830381600087803b158015612a8457600080fd5b505af1158015612a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612abc91906147b0565b505b8a6001600160a01b0316826001600160a01b03168b6001600160a01b03167fe5917769f276ddca9f2ee7c6b0b33e1d1e1b61008010ce622c632dd20d168a238f8960000154604051612b1a929190918252602082015260400190565b60405180910390a4505050505050505050505050565b612b3861394a565b6002805467ffffffffffffffff831667ffffffffffffffff199091161790556040517f9f5033568d78ae30f29f01e944f97b2216493bd19d1b46d429673acff3dcd67490611cfb906020808252600f908201526e1d5b989bdb991a5b99d4195c9a5bd9608a1b604082015260600190565b600080612bb4612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015612bec57600080fd5b505afa158015612c00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c249190614797565b90506000612c328583613ea8565b9695505050505050565b60008054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8857600080fd5b505afa158015612c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc091906147b0565b15610d385760405162461bcd60e51b815260206004820152601060248201526f1cde5cdd195b481a5cc81c185d5cd95960821b6044820152606401610840565b612d08612e67565b6001600160a01b031663219bc76c6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d4057600080fd5b505afa158015612d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7891906147b0565b610d385760405162461bcd60e51b815260206004820181905260248201527f63757272656e7420726f756e64206973206e6f7420696e697469616c697a65646044820152606401610840565b6000612dce612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015612e0657600080fd5b505afa158015612e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3e9190614797565b33600090815260036020526040902060050154909150818110156118e0576118e0338383613008565b60008054604051631c2d8fb360e31b81527fe8438ea868df48e3fc21f2f087b993c9b1837dc0f6135064161ce7d7a1701fe860048201526001600160a01b039091169063e16c7d98906024015b60206040518083038186803b158015612ecc57600080fd5b505afa1580156120f5573d6000803e3d6000fd5b6000611d378284614805565b6001600160a01b038416600090815260036020908152604080832086845260078101909252909120612f1e8686610c40565b612f665760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081d5b989bdb991a5b99c81b1bd8dac81251603a1b6044820152606401610840565b80548254612f749082612ee0565b835560008681526007840160205260408120818155600101556002830154612fa7906001600160a01b0316828787613fd0565b600283015460408051888152602081018490526001600160a01b038a81169316917f9f5b64cc71e1e26ff178caaa7877a04d8ce66fde989251870e80e6fbee690c17910160405180910390a350505050505050565b6000611d37828461481d565b6001600160a01b03831660009081526003602052604081209061302c836001612ee0565b82546001840154600285015492935090916001600160a01b031615613106576130558787613ea8565b60028601546001600160a01b031660009081526004602090815260408083208b84526003808201909352922090810154939550919350916130b0578154888110156130ae576130a48382613f6d565b6060015160038301555b505b60048101546130dc57600a820154888110156130da576130d08382613f6d565b6080015160048301555b505b60028601546001600160a01b038a8116911614156131035760006009830181905560088301555b50505b600284015484546001600160a01b03808a169216907fd7eab0765b772ea6ea859d5633baf737502198012e930f257f90013d9b21109490613148908690612ffc565b6001880154613158908690612ffc565b6040805192835260208301919091528101879052606081018a905260800160405180910390a36005840195909555825550600101919091555050565b600054604051631c2d8fb360e31b81527f121833d5ee4fda5e1a4034c2b7be8155c158142541dea26f39122c796649233f60048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b1580156131f757600080fd5b505afa15801561320b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322f91906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206d7573742062652056657269666965720000000000000000006044820152606401610840565b6000611d37620f42406132a2858561427f565b9061428b565b604051635d35e00760e01b8152600760048201526001600160a01b038216602482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb90635d35e0079060440160006040518083038186803b15801561330257600080fd5b505af4158015613316573d6000803e3d6000fd5b5050505061332f6133268261257b565b60065490612ffc565b60065560006133416001610856612e67565b6001600160a01b0383166000818152600460205260409081902060060183905551919250907ffee3e693fc72d0a0a673805f3e606c551f4c677b9072444b90dd2d0406bc995c906133959084815260200190565b60405180910390a25050565b60008054604051631c2d8fb360e31b81527f6e58ad548d72b425ea94c15f453bf26caddb061d82b2551db7fdd3cefe0e994060048201526001600160a01b039091169063e16c7d9890602401612eb4565b6006546040516304aa129960e41b81526007600482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb90634aa129909060240160206040518083038186803b15801561344057600080fd5b505af4158015613454573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347891906147b0565b1561360357604051633972059360e11b81526007600482015260009073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb906372e40b269060240160206040518083038186803b1580156134cb57600080fd5b505af41580156134df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061350391906147d2565b905060006135108261257b565b90508087116135215750505061110a565b604051635d35e00760e01b8152600760048201526001600160a01b038316602482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb90635d35e0079060440160006040518083038186803b15801561357b57600080fd5b505af415801561358f573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600460205260409020600601879055506135bb8382612ffc565b9250816001600160a01b03167ffee3e693fc72d0a0a673805f3e606c551f4c677b9072444b90dd2d0406bc995c876040516135f891815260200190565b60405180910390a250505b6040516327dd54d360e11b815273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb90634fbaa9a690613643906007908a908a9089908990600401614834565b60006040518083038186803b15801561365b57600080fd5b505af415801561366f573d6000803e3d6000fd5b505050506136868582612ee090919063ffffffff16565b6001600160a01b03871660009081526004602081815260408084209283018990556005830189905560001960068401558884526003830190915290912087905590915060068290556040518581526001600160a01b038816907f65d72d782835d64c3287844a829608d5abdc7e864cc9affe96d910ab3db665e990602001612082565b600054604051631c2d8fb360e31b81527fbd1aa3e8d2464256d7fd3dcf645c16418d5d8c51d971f1ad7d57e7b1b5eee23960048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b15801561376c57600080fd5b505afa158015613780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a491906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601b60248201527f63616c6c6572206d757374206265205469636b657442726f6b657200000000006044820152606401610840565b6138366040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6138408383613f6d565b835460608201519192509015801561385757508281105b15613871576138668482613f6d565b606090810151908301525b600a840154608083015115801561388757508381105b156138a1576138968582613f6d565b608090810151908401525b505092915050565b6000610c386b033b2e3c9fd0803ce80000006132a26138c88686614297565b879061427f565b608082015160608301516000906138f0576138eb600180614297565b6138f6565b83606001515b905084600401546000141561392d5761391e613917828588600001546138a9565b8390612ee0565b85600401819055505050505050565b61391e61393f828588600001546138a9565b600487015490612ee0565b60008054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561399657600080fd5b505afa1580156139aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ce91906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601f60248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572206f776e6572006044820152606401610840565b600054604051631c2d8fb360e31b81527fe8438ea868df48e3fc21f2f087b993c9b1837dc0f6135064161ce7d7a1701fe860048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b158015613a9157600080fd5b505afa158015613aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac991906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601c60248201527f63616c6c6572206d75737420626520526f756e64734d616e61676572000000006044820152606401610840565b6001600160a01b0385166000908152600460209081526040808320868452600381019092528220815491929091613b61908490613f6d565b9050826008015483600701819055506000613b8088846001015461328f565b90506000613b8e8983612ffc565b90506000613ba582876007015487600001546138a9565b9050613bc2836108c6838960080154612ee090919063ffffffff16565b6008870155613bd28585846142b3565b613bde8b8b8a8a613fd0565b5050505050505050505050565b6000546001600160a01b03163314610d385760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572000000000000006044820152606401610840565b60405163b0138c4760e01b8152600760048201526001600160a01b038516602482015273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b0138c479060440160206040518083038186803b158015613c9f57600080fd5b505af4158015613cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cd791906147b0565b15613e5b576000613ce78561257b565b90506000613cf58286612ffc565b90506000613d01612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015613d3957600080fd5b505afa158015613d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d719190614797565b90506000613d80826001612ee0565b604051631c11bf7f60e11b815290915073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb906338237efe90613dc3906007908c9088908c908c90600401614834565b60006040518083038186803b158015613ddb57600080fd5b505af4158015613def573d6000803e3d6000fd5b5050600654613e019250905088612ffc565b6006556001600160a01b038816600090815260046020819052604090912090810154831115613e3e57600083815260038201602052604090208590555b600481018290556000918252600301602052604090209190915550505b6001600160a01b03841660009081526003602081905260409091200154613e829084612ffc565b6001600160a01b0390941660009081526003602081905260409091200193909355505050565b6001600160a01b03808316600090815260036020908152604080832060028101549094168352600490915281206001808401548454600586015490959194919392613ef39190612ee0565b60028401549091506001600160a01b039081169088168114878311613f2f57613f2984613f21856001612ffc565b8a8a8a614301565b90975095505b8015613f61576008840154613f45908890612ee0565b9650613f5e846009015487612ee090919063ffffffff16565b95505b50505050509250929050565b613f9f6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6000828152600393840160208181526040832095860154606085015293909152909152600490910154608082015290565b613fd984611d06565b15614207576000613fe98561257b565b90506000613ff78286612ee0565b90506000614003612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403b57600080fd5b505afa15801561404f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140739190614797565b90506000614082826001612ee0565b60405163b0138c4760e01b8152600760048201526001600160a01b038a16602482015290915073C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb9063b0138c479060440160206040518083038186803b1580156140df57600080fd5b505af41580156140f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061411791906147b0565b156141f557604051631c11bf7f60e11b815273C45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb906338237efe9061415c906007908c9088908c908c90600401614834565b60006040518083038186803b15801561417457600080fd5b505af4158015614188573d6000803e3d6000fd5b505060065461419a9250905088612ee0565b6006556001600160a01b0388166000908152600460208190526040909120908101548311156141d757600083815260038201602052604090208590555b60008281526003820160205260409020849055600401819055614202565b61420288848389896133f2565b505050505b6001600160a01b03841660009081526003602081905260409091200154613e829084612ee0565b60008054604051631c2d8fb360e31b81527f3443e257065fe41dd0e4d1f5a1b73a22a62e300962b57f30cddf41d0f8273ba760048201526001600160a01b039091169063e16c7d9890602401612eb4565b6000611d378284614862565b6000611d378284614881565b6000611d37826132a2856b033b2e3c9fd0803ce800000061427f565b60008260600151600014156142d2576142cd600180614297565b6142d8565b82606001515b90506142f36142ec828487600001546138a9565b8290612ee0565b846003018190555050505050565b60008060006143108888613f6d565b90508060600151600014156143305761432a600180614297565b60608201525b600061433c8988613804565b905080606001516000141561435c57614356600180614297565b60608201525b61438f6143888761437e85608001518560800151612ffc90919063ffffffff16565b85606001516138a9565b8690612ee0565b92506143a486826060015184606001516138a9565b935050509550959350505050565b6001600160a01b03811681146111c457600080fd5b600080600080608085870312156143dd57600080fd5b84356143e8816143b2565b93506020850135925060408501356143ff816143b2565b9150606085013561440f816143b2565b939692955090935050565b60008060008060008060c0878903121561443357600080fd5b863561443e816143b2565b9550602087013594506040870135614455816143b2565b93506060870135614465816143b2565b92506080870135614475816143b2565b915060a0870135614485816143b2565b809150509295509295509295565b6000602082840312156144a557600080fd5b8135611d37816143b2565b600080604083850312156144c357600080fd5b82356144ce816143b2565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614506576145066144dc565b91905290565b6000806000806080858703121561452257600080fd5b843561452d816143b2565b9350602085013561453d816143b2565b93969395505050506040820135916060013590565b60006020828403121561456457600080fd5b5035919050565b6000806000806080858703121561458157600080fd5b843593506020850135925060408501356143ff816143b2565b6000806000606084860312156145af57600080fd5b83356145ba816143b2565b95602085013595506040909401359392505050565b600080604083850312156145e257600080fd5b50508035926020909101359150565b60008060008060008060c0878903121561460a57600080fd5b86359550602087013561461c816143b2565b94506040870135614455816143b2565b60008060006060848603121561464157600080fd5b833592506020840135614653816143b2565b91506040840135614663816143b2565b809150509250925092565b6000806040838503121561468157600080fd5b823561468c816143b2565b9150602083013561469c816143b2565b809150509250929050565b6020810160028310614506576145066144dc565b600080604083850312156146ce57600080fd5b82359150602083013561469c816143b2565b600080600080600080600060e0888a0312156146fb57600080fd5b87359650602088013561470d816143b2565b9550604088013561471d816143b2565b9450606088013561472d816143b2565b9350608088013561473d816143b2565b925060a088013561474d816143b2565b915060c088013561475d816143b2565b8091505092959891949750929550565b60006020828403121561477f57600080fd5b813567ffffffffffffffff81168114611d3757600080fd5b6000602082840312156147a957600080fd5b5051919050565b6000602082840312156147c257600080fd5b81518015158114611d3757600080fd5b6000602082840312156147e457600080fd5b8151611d37816143b2565b634e487b7160e01b600052601160045260246000fd5b60008219821115614818576148186147ef565b500190565b60008282101561482f5761482f6147ef565b500390565b9485526001600160a01b03938416602086015260408501929092528216606084015216608082015260a00190565b600081600019048311821515161561487c5761487c6147ef565b500290565b60008261489e57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122084ef728ebfb0333127dbaf5c1958d15f6c7667ad0536c0afa147b43b535ef28b64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80635c50c3561161015c57806392eefe9b116100ce578063b78d27dc11610087578063b78d27dc14610751578063eaffb3f914610764578063ee4e804a14610777578063f10d1de11461078a578063f595f1cc1461079d578063f77c4791146107b057600080fd5b806392eefe9b146106545780639500ed9b146106675780639d0b2c7a1461067a5780639ef9df941461068d578063a64ad595146106a0578063ad3b1b471461073e57600080fd5b80636cf6d675116101205780636cf6d675146105d1578063713f2216146105fe5780637fc4606f14610606578063818710561461061957806388a6c7491461062c5780638b2f16521461063457600080fd5b80635c50c356146104de5780635dce9948146104e6578063673a456b1461059857806368ba170c146105ab5780636bd9add4146105be57600080fd5b806327de9e32116101f5578063412f83b6116101b9578063412f83b6146104515780634196ee75146104a857806343d3461a146104b1578063465501d3146104c457806351720b41146104cd5780635a2a75a9146104d657600080fd5b806327de9e32146103ef5780632a4e0d55146104025780633550aa10146104185780633a080e931461042b5780633aeb512c1461043e57600080fd5b8063228cb73311610247578063228cb7331461030757806322bf9d7c1461030f578063235c96031461032257806324454fc41461034d57806324b1babf146103c957806325d5971f146103dc57600080fd5b80630584a37314610284578063062e98b81461029957806308802374146102ac5780630fd02fc1146102d45780631544fc67146102e7575b600080fd5b6102976102923660046143c7565b6107c3565b005b6102976102a736600461441a565b610913565b6102bf6102ba366004614493565b610b8e565b60405190151581526020015b60405180910390f35b6102bf6102e23660046144b0565b610c40565b6102fa6102f5366004614493565b610c71565b6040516102cb91906144f2565b610297610d2d565b61029761031d36600461450c565b610d3a565b610335610330366004614493565b611111565b6040516001600160a01b0390911681526020016102cb565b6103a161035b3660046144b0565b6001600160a01b03909116600090815260046020818152604080842094845260039485019091529091208054600182015460028301549483015492909301549094929392565b604080519586526020860194909452928401919091526060830152608082015260a0016102cb565b6102976103d7366004614552565b6111ac565b6102976103ea366004614552565b6111c7565b6102976103fd366004614552565b611407565b61040a611413565b6040519081526020016102cb565b61029761042636600461456b565b61149f565b6102976104393660046144b0565b6118d3565b61029761044c36600461459a565b6118e4565b61049361045f3660046144b0565b6001600160a01b03919091166000908152600360209081526040808320938352600790930190522080546001909101549091565b604080519283526020830191909152016102cb565b61040a60055481565b6102976104bf3660046145cf565b611beb565b61040a60065481565b61040a60015481565b61040a611bf8565b60055461040a565b61054e6104f4366004614493565b6001600160a01b031660009081526004602081905260409091208054600182015460028301549383015460058401546006850154600786015460088701546009880154600a90980154969995989794969395929491939092565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e0840152610100830152610120820152610140016102cb565b6102976105a6366004614552565b611c33565b6102bf6105b9366004614493565b611d06565b6102976105cc3660046145f1565b611d3e565b6002546105e59067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016102cb565b610297611d55565b61029761061436600461462c565b611d65565b61029761062736600461466e565b611df0565b610335612093565b610647610642366004614493565b612119565b6040516102cb91906146a7565b610297610662366004614493565b612139565b61029761067536600461462c565b61218f565b61040a6106883660046144b0565b6124e8565b61040a61069b366004614493565b61257b565b6106fb6106ae366004614493565b6001600160a01b0390811660009081526003602081905260409091208054600182015460028301549383015460048401546005850154600690950154939792969590951694909390929091565b6040805197885260208801969096526001600160a01b03909416948601949094526060850191909152608084015260a083019190915260c082015260e0016102cb565b61029761074c3660046144b0565b61259a565b61029761075f3660046146bb565b612731565b610297610772366004614552565b612741565b6102976107853660046146e0565b61274d565b61029761079836600461476d565b612b30565b61040a6107ab3660046144b0565b612ba9565b600054610335906001600160a01b031681565b6107cb612c3c565b6107d3612d00565b6107db612dc4565b60026107e633610c71565b60028111156107f7576107f76144dc565b146108495760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206d75737420626520756e626f6e64656400000000000000000060448201526064015b60405180910390fd5b6108cc6001610856612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190614797565b90612ee0565b3360008181526003602052604090206004810192909255600290910180546001600160a01b0319166001600160a01b03871617905561090d90848484612eec565b50505050565b61091b612c3c565b610923612d00565b61092b612dc4565b33600090815260036020526040902060028101546001600160a01b031661095387878761218f565b6001600160a01b0388166000908152600360205260408120600684015490919061097e906001612ffc565b905060008460070160008381526020019081526020016000206001015490508460070160008381526020019081526020016000206000808201600090556001820160009055505060008360060154905060405180604001604052808c8152602001838152508460070160008381526020019081526020016000206000820151816000015560208201518160010155905050610a2760018560060154612ee090919063ffffffff16565b600685015560408051848152602081018390529081018c90526001600160a01b038d169033907ff136b986590e86cf1abd7b6600186a7a1178ad3cbbdf0f3312e79f6214a2a5679060600160405180910390a36000610a84612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610abc57600080fd5b505afa158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af49190614797565b600586015490915081811015610b0f57610b0f8e8383613008565b60028601546001600160a01b0316610b3f576002860180546001600160a01b0319166001600160a01b0389161790555b6002610b4a8f610c71565b6002811115610b5b57610b5b6144dc565b1415610b7257610b6c826001612ee0565b60048701555b610b7e8e848c8c612eec565b5050505050505050505050505050565b6001600160a01b038116600090815260046020526040812081610baf612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610be757600080fd5b505afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f9190614797565b905080826005015411158015610c385750816006015481105b949350505050565b6001600160a01b03919091166000908152600360209081526040808320938352600790930190522060010154151590565b6001600160a01b03811660009081526003602052604081208054610c985750600292915050565b610ca0612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd857600080fd5b505afa158015610cec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d109190614797565b81600401541115610d245750600092915050565b50600192915050565b610d38600080611df0565b565b610d42612c3c565b610d4a613194565b6001600160a01b03841660009081526003602052604090208054156110b6576001600160a01b038516600090815260036020526040812054610d8c908561328f565b60405163b0138c4760e01b8152600760048201526001600160a01b038816602482015290915073__$d23c89be677d40ab24c636937040b6165f$__9063b0138c479060440160206040518083038186803b158015610de957600080fd5b505af4158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2191906147b0565b15610e2f57610e2f866132a8565b8154610e3b9082612ffc565b82556001610e4887610c71565b6002811115610e5957610e596144dc565b1415610eac5760028201546001600160a01b031660009081526003602081905260409091200154610e8a9082612ffc565b60028301546001600160a01b0316600090815260036020819052604090912001555b806001600160a01b03861615610ffb576000610ec8838661328f565b9050610ed26133a1565b60405163e7a49c2b60e01b81526001600160a01b03898116600483015260248201849052919091169063e7a49c2b90604401600060405180830381600087803b158015610f1e57600080fd5b505af1158015610f32573d6000803e3d6000fd5b50505050610f3e6133a1565b6001600160a01b031663c7ee98c2610f568484612ffc565b6040518263ffffffff1660e01b8152600401610f7491815260200190565b600060405180830381600087803b158015610f8e57600080fd5b505af1158015610fa2573d6000803e3d6000fd5b5050604080516001600160a01b038b8116825260208201889052918101859052908b1692507ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c22915060600160405180910390a2506110af565b6110036133a1565b6001600160a01b031663c7ee98c2826040518263ffffffff1660e01b815260040161103091815260200190565b600060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b5050604080516000808252602082018790528183015290516001600160a01b038b1693507ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c2292509081900360600190a25b505061110a565b604080516001600160a01b03868116825260006020830181905292820192909252908616907ff4b71fed8e2c9a8c67c388bc6d35ad20b9368a24eed6d565459f2b277b6c0c22906060015b60405180910390a25b5050505050565b60405163e189dedb60e01b8152600760048201526001600160a01b038216602482015260009073__$d23c89be677d40ab24c636937040b6165f$__9063e189dedb9060440160206040518083038186803b15801561116e57600080fd5b505af4158015611182573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a691906147d2565b92915050565b6111b4612c3c565b6111bc612d00565b6111c4612dc4565b50565b6111cf612c3c565b6111d7612d00565b3360008181526003602090815260408083208584526007810190925290912090916112029084610c40565b61124a5760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081d5b989bdb991a5b99c81b1bd8dac81251603a1b6044820152606401610840565b611252612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c29190614797565b8160010154111561133b5760405162461bcd60e51b815260206004820152603b60248201527f776974686472617720726f756e64206d757374206265206265666f7265206f7260448201527f20657175616c20746f207468652063757272656e7420726f756e6400000000006064820152608401610840565b805460018083015460008681526007860160205260408120818155909201919091556113656133a1565b60405163e7a49c2b60e01b8152336004820152602481018490526001600160a01b03919091169063e7a49c2b90604401600060405180830381600087803b1580156113af57600080fd5b505af11580156113c3573d6000803e3d6000fd5b505060408051888152602081018690529081018490523392507f1340f1a8f3d456a649e1a12071dfa15655e3d09252131d0f980c3b405cc8dd2e9150606001611101565b6111c48160008061218f565b604051631665d9cb60e31b81526007600482015260009073__$d23c89be677d40ab24c636937040b6165f$__9063b32ece58906024015b60206040518083038186803b15801561146257600080fd5b505af4158015611476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a9190614797565b905090565b6114a7612c3c565b6114af612d00565b6114b7612e67565b6001600160a01b0316636841f2536040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ef57600080fd5b505afa158015611503573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152791906147b0565b1561159a5760405162461bcd60e51b815260206004820152603760248201527f63616e277420757064617465207472616e73636f64657220706172616d732c2060448201527f63757272656e7420726f756e64206973206c6f636b65640000000000000000006064820152608401610840565b6115a784620f4240101590565b6115f35760405162461bcd60e51b815260206004820152601c60248201527f696e76616c6964207265776172644375742070657263656e74616765000000006044820152606401610840565b61160083620f4240101590565b61164c5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642066656553686172652070657263656e7461676500000000006044820152606401610840565b61165533611d06565b6116a15760405162461bcd60e51b815260206004820152601d60248201527f7472616e73636f646572206d75737420626520726567697374657265640000006044820152606401610840565b336000908152600460205260408120906116b9612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116f157600080fd5b505afa158015611705573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117299190614797565b905061173433610b8e565b15806117405750815481145b6117ca5760405162461bcd60e51b815260206004820152604f60248201527f63616c6c65722063616e277420626520616374697665206f72206d757374206860448201527f61766520616c72656164792063616c6c65642072657761726420666f7220746860648201526e194818dd5c9c995b9d081c9bdd5b99608a1b608482015260a401610840565b600182018690556002820185905560405163b0138c4760e01b81526007600482015233602482015273__$d23c89be677d40ab24c636937040b6165f$__9063b0138c479060440160206040518083038186803b15801561182957600080fd5b505af415801561183d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186191906147b0565b6118905733600081815260036020819052604090912001546118909190611889846001612ee0565b87876133f2565b604080518781526020810187905233917f7346854431dbb3eb8e373c604abf89e90f4865b8447e1e2834d7b3e4677bf544910160405180910390a2505050505050565b6118e082826000806107c3565b5050565b6118ec612c3c565b6118f4613709565b6118fd83611d06565b6119495760405162461bcd60e51b815260206004820152601d60248201527f7472616e73636f646572206d75737420626520726567697374657265640000006044820152606401610840565b6000611953612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561198b57600080fd5b505afa15801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190614797565b6001600160a01b03851660009081526004602090815260408083208054600782015486865260038301909452918420949550939092611a0c85611a07886001612ffc565b613804565b905083861115611a565760018581015460028088015492850191909155830155600485015486811015611a4d57600081815260038701602052604090205483555b85600801549350505b81546060820151158015611a6957508685145b15611b7b576000611a786133a1565b90506000611b35611b2c836001600160a01b0316632de22cdb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611abb57600080fd5b505afa158015611acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af39190614797565b846001600160a01b0316639ae6309a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b846005546138a9565b90506000611b4782876001015461328f565b90506000611b558383612ffc565b6003880154909150611b719086611b6c8482612ee0565b6138a9565b6060870152505050505b6000611b8b8a856002015461328f565b90506000611b998b83612ffc565b90506000611ba88388866138a9565b9050611bc5826108c6838c60090154612ee090919063ffffffff16565b60098a0155611bd58686856138cf565b50505050600a9094019490945550505050505050565b6118e0828260008061149f565b6040516339ade16560e11b81526007600482015260009073__$d23c89be677d40ab24c636937040b6165f$__9063735bc2ca9060240161144a565b611c3b61394a565b60405163a176adaf60e01b8152600760048201526024810182905273__$d23c89be677d40ab24c636937040b6165f$__9063a176adaf9060440160006040518083038186803b158015611c8d57600080fd5b505af4158015611ca1573d6000803e3d6000fd5b505050507f9f5033568d78ae30f29f01e944f97b2216493bd19d1b46d429673acff3dcd674604051611cfb906020808252601490820152736e756d4163746976655472616e73636f6465727360601b604082015260600190565b60405180910390a150565b6001600160a01b0380821660008181526003602052604081206002810154919390929116148015611d375750805415155b9392505050565b611d4d8633878787878761274d565b505050505050565b611d5d613a2e565b600654600555565b611d6d612c3c565b611d75612d00565b611d7d612dc4565b6002611d8833610c71565b6002811115611d9957611d996144dc565b1415611ddf5760405162461bcd60e51b815260206004820152601560248201527418d85b1b195c881b5d5cdd08189948189bdb991959605a1b6044820152606401610840565b611deb33848484612eec565b505050565b611df8612c3c565b611e00612d00565b6000611e0a612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e4257600080fd5b505afa158015611e56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7a9190614797565b9050611e8533610b8e565b611edd5760405162461bcd60e51b815260206004820152602360248201527f63616c6c6572206d75737420626520616e20616374697665207472616e73636f6044820152623232b960e91b6064820152608401610840565b33600090815260046020526040902054811415611f5b5760405162461bcd60e51b815260206004820152603660248201527f63616c6c65722068617320616c72656164792063616c6c65642072657761726460448201527508199bdc881d1a194818dd5c9c995b9d081c9bdd5b9960521b6064820152608401610840565b3360009081526004602090815260408083208484526003810190925290912060018083015460028085015492840191909155820155600482015483811015611fb157600081815260038401602052604090205482555b6000611fbb6133a1565b8354600554604051637dbedad560e01b8152600481019290925260248201526001600160a01b039190911690637dbedad590604401602060405180830381600087803b15801561200a57600080fd5b505af115801561201e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120429190614797565b90506120513382878a8a613b29565b84845560405181815233907f619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9906020015b60405180910390a250505050505050565b604051632ebb2fed60e01b81526007600482015260009073__$d23c89be677d40ab24c636937040b6165f$__90632ebb2fed9060240160206040518083038186803b1580156120e157600080fd5b505af41580156120f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a91906147d2565b600061212482611d06565b1561213157506001919050565b506000919050565b612141613beb565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f7090602001611cfb565b612197612c3c565b61219f612d00565b6121a7612dc4565b60016121b233610c71565b60028111156121c3576121c36144dc565b146122085760405162461bcd60e51b815260206004820152601560248201527418d85b1b195c881b5d5cdd08189948189bdb991959605a1b6044820152606401610840565b336000908152600360205260409020836122705760405162461bcd60e51b8152602060048201526024808201527f756e626f6e6420616d6f756e74206d75737420626520677265617465722074686044820152630616e20360e41b6064820152608401610840565b80548411156122cd5760405162461bcd60e51b8152602060048201526024808201527f616d6f756e742069732067726561746572207468616e20626f6e64656420616d6044820152631bdd5b9d60e21b6064820152608401610840565b60028101546001600160a01b031660006122e5612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561231d57600080fd5b505afa158015612331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123559190614797565b60025490915060009061237390839067ffffffffffffffff16612ee0565b60068501546040805180820182528a81526020808201858152600085815260078b01909252929020905181559051600191820155919250906123b6908290612ee0565b600686015584546123c79089612ffc565b808655612484576002850180546001600160a01b0319169055600060048087019190915560405163b0138c4760e01b815260079181019190915233602482015273__$d23c89be677d40ab24c636937040b6165f$__9063b0138c479060440160206040518083038186803b15801561243e57600080fd5b505af4158015612452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247691906147b0565b1561248457612484336132a8565b61249084898989613c45565b60408051828152602081018a905290810183905233906001600160a01b038616907f2d5d98d189bee5496a08db2a5948cb7e5e786f09d17d0c3f228eb41776c24a069060600160405180910390a35050505050505050565b6000806124f3612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561252b57600080fd5b505afa15801561253f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125639190614797565b905060006125718583613ea8565b5095945050505050565b6001600160a01b03166000908152600360208190526040909120015490565b6125a2612c3c565b6125aa612d00565b6125b2612dc4565b6001600160a01b0382166125fc5760405162461bcd60e51b81526020600482015260116024820152701a5b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606401610840565b336000908152600360205260409020600101548181101561265f5760405162461bcd60e51b815260206004820152601d60248201527f696e73756666696369656e74206665657320746f2077697468647261770000006044820152606401610840565b6126698183612ffc565b336000908152600360205260409020600101556126846133a1565b6040516320283da960e01b81526001600160a01b0385811660048301526024820185905291909116906320283da990604401600060405180830381600087803b1580156126d057600080fd5b505af11580156126e4573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690523393507f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e492500160405180910390a2505050565b6118e08282600080600080611d3e565b6111c481600080611d65565b612755612c3c565b61275d612d00565b612765612dc4565b6001600160a01b038616600090815260036020526040812090612786612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127be57600080fd5b505afa1580156127d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f69190614797565b60028084015484549293508b926001600160a01b03909116916128188c610c71565b6002811115612829576128296144dc565b14156128445761283a846001612ee0565b600486015561290f565b6000811180156128665750896001600160a01b0316826001600160a01b031614155b1561290f576128748b611d06565b156128e75760405162461bcd60e51b815260206004820152603d60248201527f72656769737465726564207472616e73636f646572732063616e27742064656c60448201527f656761746520746f7761726473206f74686572206164647265737365730000006064820152608401610840565b6128f2846001612ee0565b60048601556129018382612ee0565b925061290f82828b8b613c45565b6001600160a01b038a16600090815260046020908152604080832087845260038082019093529220908101546129575761294d828360000154613f6d565b6060015160038201555b60048101546129785761296e8283600a0154613f6d565b6080015160048201555b5050600083116129db5760405162461bcd60e51b815260206004820152602860248201527f64656c65676174696f6e20616d6f756e74206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610840565b6002850180546001600160a01b0319166001600160a01b038c16179055612a02818d612ee0565b8555612a108a848989613fd0565b8b15612abe57612a1e61422e565b6001600160a01b03166323b872dd33612a356133a1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018f9052606401602060405180830381600087803b158015612a8457600080fd5b505af1158015612a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612abc91906147b0565b505b8a6001600160a01b0316826001600160a01b03168b6001600160a01b03167fe5917769f276ddca9f2ee7c6b0b33e1d1e1b61008010ce622c632dd20d168a238f8960000154604051612b1a929190918252602082015260400190565b60405180910390a4505050505050505050505050565b612b3861394a565b6002805467ffffffffffffffff831667ffffffffffffffff199091161790556040517f9f5033568d78ae30f29f01e944f97b2216493bd19d1b46d429673acff3dcd67490611cfb906020808252600f908201526e1d5b989bdb991a5b99d4195c9a5bd9608a1b604082015260600190565b600080612bb4612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015612bec57600080fd5b505afa158015612c00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c249190614797565b90506000612c328583613ea8565b9695505050505050565b60008054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8857600080fd5b505afa158015612c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc091906147b0565b15610d385760405162461bcd60e51b815260206004820152601060248201526f1cde5cdd195b481a5cc81c185d5cd95960821b6044820152606401610840565b612d08612e67565b6001600160a01b031663219bc76c6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d4057600080fd5b505afa158015612d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7891906147b0565b610d385760405162461bcd60e51b815260206004820181905260248201527f63757272656e7420726f756e64206973206e6f7420696e697469616c697a65646044820152606401610840565b6000612dce612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015612e0657600080fd5b505afa158015612e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3e9190614797565b33600090815260036020526040902060050154909150818110156118e0576118e0338383613008565b60008054604051631c2d8fb360e31b81527fe8438ea868df48e3fc21f2f087b993c9b1837dc0f6135064161ce7d7a1701fe860048201526001600160a01b039091169063e16c7d98906024015b60206040518083038186803b158015612ecc57600080fd5b505afa1580156120f5573d6000803e3d6000fd5b6000611d378284614805565b6001600160a01b038416600090815260036020908152604080832086845260078101909252909120612f1e8686610c40565b612f665760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081d5b989bdb991a5b99c81b1bd8dac81251603a1b6044820152606401610840565b80548254612f749082612ee0565b835560008681526007840160205260408120818155600101556002830154612fa7906001600160a01b0316828787613fd0565b600283015460408051888152602081018490526001600160a01b038a81169316917f9f5b64cc71e1e26ff178caaa7877a04d8ce66fde989251870e80e6fbee690c17910160405180910390a350505050505050565b6000611d37828461481d565b6001600160a01b03831660009081526003602052604081209061302c836001612ee0565b82546001840154600285015492935090916001600160a01b031615613106576130558787613ea8565b60028601546001600160a01b031660009081526004602090815260408083208b84526003808201909352922090810154939550919350916130b0578154888110156130ae576130a48382613f6d565b6060015160038301555b505b60048101546130dc57600a820154888110156130da576130d08382613f6d565b6080015160048301555b505b60028601546001600160a01b038a8116911614156131035760006009830181905560088301555b50505b600284015484546001600160a01b03808a169216907fd7eab0765b772ea6ea859d5633baf737502198012e930f257f90013d9b21109490613148908690612ffc565b6001880154613158908690612ffc565b6040805192835260208301919091528101879052606081018a905260800160405180910390a36005840195909555825550600101919091555050565b600054604051631c2d8fb360e31b81527f121833d5ee4fda5e1a4034c2b7be8155c158142541dea26f39122c796649233f60048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b1580156131f757600080fd5b505afa15801561320b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322f91906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206d7573742062652056657269666965720000000000000000006044820152606401610840565b6000611d37620f42406132a2858561427f565b9061428b565b604051635d35e00760e01b8152600760048201526001600160a01b038216602482015273__$d23c89be677d40ab24c636937040b6165f$__90635d35e0079060440160006040518083038186803b15801561330257600080fd5b505af4158015613316573d6000803e3d6000fd5b5050505061332f6133268261257b565b60065490612ffc565b60065560006133416001610856612e67565b6001600160a01b0383166000818152600460205260409081902060060183905551919250907ffee3e693fc72d0a0a673805f3e606c551f4c677b9072444b90dd2d0406bc995c906133959084815260200190565b60405180910390a25050565b60008054604051631c2d8fb360e31b81527f6e58ad548d72b425ea94c15f453bf26caddb061d82b2551db7fdd3cefe0e994060048201526001600160a01b039091169063e16c7d9890602401612eb4565b6006546040516304aa129960e41b81526007600482015273__$d23c89be677d40ab24c636937040b6165f$__90634aa129909060240160206040518083038186803b15801561344057600080fd5b505af4158015613454573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347891906147b0565b1561360357604051633972059360e11b81526007600482015260009073__$d23c89be677d40ab24c636937040b6165f$__906372e40b269060240160206040518083038186803b1580156134cb57600080fd5b505af41580156134df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061350391906147d2565b905060006135108261257b565b90508087116135215750505061110a565b604051635d35e00760e01b8152600760048201526001600160a01b038316602482015273__$d23c89be677d40ab24c636937040b6165f$__90635d35e0079060440160006040518083038186803b15801561357b57600080fd5b505af415801561358f573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600460205260409020600601879055506135bb8382612ffc565b9250816001600160a01b03167ffee3e693fc72d0a0a673805f3e606c551f4c677b9072444b90dd2d0406bc995c876040516135f891815260200190565b60405180910390a250505b6040516327dd54d360e11b815273__$d23c89be677d40ab24c636937040b6165f$__90634fbaa9a690613643906007908a908a9089908990600401614834565b60006040518083038186803b15801561365b57600080fd5b505af415801561366f573d6000803e3d6000fd5b505050506136868582612ee090919063ffffffff16565b6001600160a01b03871660009081526004602081815260408084209283018990556005830189905560001960068401558884526003830190915290912087905590915060068290556040518581526001600160a01b038816907f65d72d782835d64c3287844a829608d5abdc7e864cc9affe96d910ab3db665e990602001612082565b600054604051631c2d8fb360e31b81527fbd1aa3e8d2464256d7fd3dcf645c16418d5d8c51d971f1ad7d57e7b1b5eee23960048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b15801561376c57600080fd5b505afa158015613780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a491906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601b60248201527f63616c6c6572206d757374206265205469636b657442726f6b657200000000006044820152606401610840565b6138366040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6138408383613f6d565b835460608201519192509015801561385757508281105b15613871576138668482613f6d565b606090810151908301525b600a840154608083015115801561388757508381105b156138a1576138968582613f6d565b608090810151908401525b505092915050565b6000610c386b033b2e3c9fd0803ce80000006132a26138c88686614297565b879061427f565b608082015160608301516000906138f0576138eb600180614297565b6138f6565b83606001515b905084600401546000141561392d5761391e613917828588600001546138a9565b8390612ee0565b85600401819055505050505050565b61391e61393f828588600001546138a9565b600487015490612ee0565b60008054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561399657600080fd5b505afa1580156139aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ce91906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601f60248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572206f776e6572006044820152606401610840565b600054604051631c2d8fb360e31b81527fe8438ea868df48e3fc21f2f087b993c9b1837dc0f6135064161ce7d7a1701fe860048201526001600160a01b039091169063e16c7d989060240160206040518083038186803b158015613a9157600080fd5b505afa158015613aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac991906147d2565b6001600160a01b0316336001600160a01b031614610d385760405162461bcd60e51b815260206004820152601c60248201527f63616c6c6572206d75737420626520526f756e64734d616e61676572000000006044820152606401610840565b6001600160a01b0385166000908152600460209081526040808320868452600381019092528220815491929091613b61908490613f6d565b9050826008015483600701819055506000613b8088846001015461328f565b90506000613b8e8983612ffc565b90506000613ba582876007015487600001546138a9565b9050613bc2836108c6838960080154612ee090919063ffffffff16565b6008870155613bd28585846142b3565b613bde8b8b8a8a613fd0565b5050505050505050505050565b6000546001600160a01b03163314610d385760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572000000000000006044820152606401610840565b60405163b0138c4760e01b8152600760048201526001600160a01b038516602482015273__$d23c89be677d40ab24c636937040b6165f$__9063b0138c479060440160206040518083038186803b158015613c9f57600080fd5b505af4158015613cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cd791906147b0565b15613e5b576000613ce78561257b565b90506000613cf58286612ffc565b90506000613d01612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b158015613d3957600080fd5b505afa158015613d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d719190614797565b90506000613d80826001612ee0565b604051631c11bf7f60e11b815290915073__$d23c89be677d40ab24c636937040b6165f$__906338237efe90613dc3906007908c9088908c908c90600401614834565b60006040518083038186803b158015613ddb57600080fd5b505af4158015613def573d6000803e3d6000fd5b5050600654613e019250905088612ffc565b6006556001600160a01b038816600090815260046020819052604090912090810154831115613e3e57600083815260038201602052604090208590555b600481018290556000918252600301602052604090209190915550505b6001600160a01b03841660009081526003602081905260409091200154613e829084612ffc565b6001600160a01b0390941660009081526003602081905260409091200193909355505050565b6001600160a01b03808316600090815260036020908152604080832060028101549094168352600490915281206001808401548454600586015490959194919392613ef39190612ee0565b60028401549091506001600160a01b039081169088168114878311613f2f57613f2984613f21856001612ffc565b8a8a8a614301565b90975095505b8015613f61576008840154613f45908890612ee0565b9650613f5e846009015487612ee090919063ffffffff16565b95505b50505050509250929050565b613f9f6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6000828152600393840160208181526040832095860154606085015293909152909152600490910154608082015290565b613fd984611d06565b15614207576000613fe98561257b565b90506000613ff78286612ee0565b90506000614003612e67565b6001600160a01b0316638a19c8bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403b57600080fd5b505afa15801561404f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140739190614797565b90506000614082826001612ee0565b60405163b0138c4760e01b8152600760048201526001600160a01b038a16602482015290915073__$d23c89be677d40ab24c636937040b6165f$__9063b0138c479060440160206040518083038186803b1580156140df57600080fd5b505af41580156140f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061411791906147b0565b156141f557604051631c11bf7f60e11b815273__$d23c89be677d40ab24c636937040b6165f$__906338237efe9061415c906007908c9088908c908c90600401614834565b60006040518083038186803b15801561417457600080fd5b505af4158015614188573d6000803e3d6000fd5b505060065461419a9250905088612ee0565b6006556001600160a01b0388166000908152600460208190526040909120908101548311156141d757600083815260038201602052604090208590555b60008281526003820160205260409020849055600401819055614202565b61420288848389896133f2565b505050505b6001600160a01b03841660009081526003602081905260409091200154613e829084612ee0565b60008054604051631c2d8fb360e31b81527f3443e257065fe41dd0e4d1f5a1b73a22a62e300962b57f30cddf41d0f8273ba760048201526001600160a01b039091169063e16c7d9890602401612eb4565b6000611d378284614862565b6000611d378284614881565b6000611d37826132a2856b033b2e3c9fd0803ce800000061427f565b60008260600151600014156142d2576142cd600180614297565b6142d8565b82606001515b90506142f36142ec828487600001546138a9565b8290612ee0565b846003018190555050505050565b60008060006143108888613f6d565b90508060600151600014156143305761432a600180614297565b60608201525b600061433c8988613804565b905080606001516000141561435c57614356600180614297565b60608201525b61438f6143888761437e85608001518560800151612ffc90919063ffffffff16565b85606001516138a9565b8690612ee0565b92506143a486826060015184606001516138a9565b935050509550959350505050565b6001600160a01b03811681146111c457600080fd5b600080600080608085870312156143dd57600080fd5b84356143e8816143b2565b93506020850135925060408501356143ff816143b2565b9150606085013561440f816143b2565b939692955090935050565b60008060008060008060c0878903121561443357600080fd5b863561443e816143b2565b9550602087013594506040870135614455816143b2565b93506060870135614465816143b2565b92506080870135614475816143b2565b915060a0870135614485816143b2565b809150509295509295509295565b6000602082840312156144a557600080fd5b8135611d37816143b2565b600080604083850312156144c357600080fd5b82356144ce816143b2565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614506576145066144dc565b91905290565b6000806000806080858703121561452257600080fd5b843561452d816143b2565b9350602085013561453d816143b2565b93969395505050506040820135916060013590565b60006020828403121561456457600080fd5b5035919050565b6000806000806080858703121561458157600080fd5b843593506020850135925060408501356143ff816143b2565b6000806000606084860312156145af57600080fd5b83356145ba816143b2565b95602085013595506040909401359392505050565b600080604083850312156145e257600080fd5b50508035926020909101359150565b60008060008060008060c0878903121561460a57600080fd5b86359550602087013561461c816143b2565b94506040870135614455816143b2565b60008060006060848603121561464157600080fd5b833592506020840135614653816143b2565b91506040840135614663816143b2565b809150509250925092565b6000806040838503121561468157600080fd5b823561468c816143b2565b9150602083013561469c816143b2565b809150509250929050565b6020810160028310614506576145066144dc565b600080604083850312156146ce57600080fd5b82359150602083013561469c816143b2565b600080600080600080600060e0888a0312156146fb57600080fd5b87359650602088013561470d816143b2565b9550604088013561471d816143b2565b9450606088013561472d816143b2565b9350608088013561473d816143b2565b925060a088013561474d816143b2565b915060c088013561475d816143b2565b8091505092959891949750929550565b60006020828403121561477f57600080fd5b813567ffffffffffffffff81168114611d3757600080fd5b6000602082840312156147a957600080fd5b5051919050565b6000602082840312156147c257600080fd5b81518015158114611d3757600080fd5b6000602082840312156147e457600080fd5b8151611d37816143b2565b634e487b7160e01b600052601160045260246000fd5b60008219821115614818576148186147ef565b500190565b60008282101561482f5761482f6147ef565b500390565b9485526001600160a01b03938416602086015260408501929092528216606084015216608082015260a00190565b600081600019048311821515161561487c5761487c6147ef565b500290565b60008261489e57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122084ef728ebfb0333127dbaf5c1958d15f6c7667ad0536c0afa147b43b535ef28b64736f6c63430008090033", + "libraries": { + "SortedDoublyLL": "0xC45f6918F7Bcac7aBc8fe05302b3cDF39776cdeb" + }, + "devdoc": { + "kind": "dev", + "methods": { + "bond(uint256,address)": { + "params": { + "_amount": "The amount of tokens to stake", + "_to": "The address of the transcoder to stake towards" + } + }, + "bondForWithHint(uint256,address,address,address,address,address,address)": { + "details": "If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_amount": "The amount of tokens to stake.", + "_currDelegateNewPosNext": "The address of the next transcoder in the pool for the current delegate", + "_currDelegateNewPosPrev": "The address of the previous transcoder in the pool for the current delegate", + "_oldDelegateNewPosNext": "The address of the next transcoder in the pool for the old delegate", + "_oldDelegateNewPosPrev": "The address of the previous transcoder in the pool for the old delegate", + "_owner": "The address of the owner of the bond", + "_to": "The address of the transcoder to stake towards" + } + }, + "bondWithHint(uint256,address,address,address,address,address)": { + "details": "If the caller is decreasing the stake of its old delegate in the transcoder pool, the caller can provide an optional hint for the insertion position of the old delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the caller is delegating to a delegate that is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_currDelegateNewPosPrev` and `_currDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_amount": "The amount of tokens to stake.", + "_currDelegateNewPosNext": "The address of the next transcoder in the pool for the current delegate", + "_currDelegateNewPosPrev": "The address of the previous transcoder in the pool for the current delegate", + "_oldDelegateNewPosNext": "The address of the next transcoder in the pool for the old delegate", + "_oldDelegateNewPosPrev": "The address of the previous transcoder in the pool for the old delegate", + "_to": "The address of the transcoder to stake towards" + } + }, + "claimEarnings(uint256)": { + "params": { + "_endRound": "The last round for which to claim token pools shares for a delegator" + } + }, + "constructor": { + "details": "This constructor will not initialize any state variables besides `controller`. The following setter functions should be used to initialize state variables post-deployment: - setUnbondingPeriod() - setNumActiveTranscoders() - setMaxEarningsClaimsRounds()", + "params": { + "_controller": "Address of Controller that this contract will be registered with" + } + }, + "delegatorStatus(address)": { + "params": { + "_delegator": "Address of delegator" + }, + "returns": { + "_0": "bonded, unbonded or pending delegator status" + } + }, + "getDelegator(address)": { + "params": { + "_delegator": "Address of delegator" + }, + "returns": { + "bondedAmount": "total amount bonded by '_delegator'", + "delegateAddress": "address '_delegator' has bonded to", + "delegatedAmount": "total amount delegated to '_delegator'", + "fees": "amount of fees collected by '_delegator'", + "lastClaimRound": "round for which '_delegator' has last claimed earnings", + "nextUnbondingLockId": "ID for the next unbonding lock created for '_delegator'", + "startRound": "round in which bond for '_delegator' became effective" + } + }, + "getDelegatorUnbondingLock(address,uint256)": { + "params": { + "_delegator": "Address of delegator", + "_unbondingLockId": "ID of unbonding lock" + }, + "returns": { + "amount": "of stake locked up by unbonding lock", + "withdrawRound": "round in which 'amount' becomes available for withdrawal" + } + }, + "getFirstTranscoderInPool()": { + "returns": { + "_0": "address for transcoder with highest stake in transcoder pool" + } + }, + "getNextTranscoderInPool(address)": { + "params": { + "_transcoder": "Address of a transcoder in the pool" + }, + "returns": { + "_0": "address for the transcoder after '_transcoder' in transcoder pool" + } + }, + "getTotalBonded()": { + "returns": { + "_0": "total active stake for the current round" + } + }, + "getTranscoder(address)": { + "params": { + "_transcoder": "Address of transcoder" + }, + "returns": { + "activationRound": "Round in which transcoder became active", + "activeCumulativeRewards": "Transcoder's cumulative rewards that are currently active", + "cumulativeFees": "Transcoder's cumulative fees (earned via its active staked rewards and its fee share)", + "cumulativeRewards": "Transcoder's cumulative rewards (earned via its active staked rewards and its reward cut)", + "deactivationRound": "Round in which transcoder will no longer be active", + "feeShare": "Transcoder's fee share", + "lastActiveStakeUpdateRound": "Round in which transcoder's stake was last updated while active", + "lastFeeRound": "Latest round that the transcoder received fees", + "lastRewardRound": "Trancoder's last reward round", + "rewardCut": "Transcoder's reward cut" + } + }, + "getTranscoderEarningsPoolForRound(address,uint256)": { + "params": { + "_round": "Round number", + "_transcoder": "Address of transcoder" + }, + "returns": { + "cumulativeFeeFactor": "The cumulative fee factor for delegator fees calculation (only used after LIP-36)", + "cumulativeRewardFactor": "The cumulative reward factor for delegator rewards calculation (only used after LIP-36)", + "totalStake": "Transcoder's total stake in '_round'", + "transcoderFeeShare": "Transcoder's fee share for '_round'", + "transcoderRewardCut": "Transcoder's reward cut for '_round'" + } + }, + "getTranscoderPoolMaxSize()": { + "returns": { + "_0": "transcoder pool max size" + } + }, + "getTranscoderPoolSize()": { + "returns": { + "_0": "transcoder pool current size" + } + }, + "isActiveTranscoder(address)": { + "params": { + "_transcoder": "Transcoder address" + }, + "returns": { + "_0": "true if transcoder is active" + } + }, + "isRegisteredTranscoder(address)": { + "params": { + "_transcoder": "Transcoder address" + }, + "returns": { + "_0": "true if transcoder is self-bonded" + } + }, + "isValidUnbondingLock(address,uint256)": { + "params": { + "_delegator": "Address of delegator", + "_unbondingLockId": "ID of unbonding lock" + }, + "returns": { + "_0": "true if unbondingLock for ID has a non-zero withdraw round" + } + }, + "pendingFees(address,uint256)": { + "params": { + "_delegator": "Address of delegator", + "_endRound": "The last round to compute pending fees from" + }, + "returns": { + "_0": "Pending fees for '_delegator' since last claiming fees" + } + }, + "pendingStake(address,uint256)": { + "params": { + "_delegator": "Address of delegator", + "_endRound": "The last round to compute pending stake from" + }, + "returns": { + "_0": "Pending bonded stake for '_delegator' since last claiming rewards" + } + }, + "rebond(uint256)": { + "params": { + "_unbondingLockId": "ID of unbonding lock to rebond with" + } + }, + "rebondFromUnbonded(address,uint256)": { + "params": { + "_to": "Address of delegate", + "_unbondingLockId": "ID of unbonding lock to rebond with" + } + }, + "rebondFromUnbondedWithHint(address,uint256,address,address)": { + "details": "If the delegate joins the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_newPosNext": "Address of next transcoder in pool if the delegate joins the pool", + "_newPosPrev": "Address of previous transcoder in pool if the delegate joins the pool", + "_to": "Address of delegate", + "_unbondingLockId": "ID of unbonding lock to rebond with" + } + }, + "rebondWithHint(uint256,address,address)": { + "details": "If the delegate is in the transcoder pool, the caller can provide an optional hint for the delegate's insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints", + "params": { + "_newPosNext": "Address of next transcoder in pool if the delegate is in the pool", + "_newPosPrev": "Address of previous transcoder in pool if the delegate is in the pool", + "_unbondingLockId": "ID of unbonding lock to rebond with" + } + }, + "rewardWithHint(address,address)": { + "details": "If the caller is in the transcoder pool, the caller can provide an optional hint for its insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_newPosNext": "Address of next transcoder in pool if the caller is in the pool", + "_newPosPrev": "Address of previous transcoder in pool if the caller is in the pool" + } + }, + "setController(address)": { + "params": { + "_controller": "Controller contract address" + } + }, + "setNumActiveTranscoders(uint256)": { + "params": { + "_numActiveTranscoders": "Number of active transcoders" + } + }, + "setUnbondingPeriod(uint64)": { + "params": { + "_unbondingPeriod": "Rounds between unbonding and possible withdrawal" + } + }, + "slashTranscoder(address,address,uint256,uint256)": { + "params": { + "_finder": "Finder that proved a transcoder violated a slashing condition. Null address if there is no finder", + "_finderFee": "Percentage of penalty awarded to finder. Zero if there is no finder", + "_slashAmount": "Percentage of transcoder bond to be slashed", + "_transcoder": "Transcoder address" + } + }, + "transcoder(uint256,uint256)": { + "details": "Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR", + "params": { + "_feeShare": "% of fees paid to delegators by a transcoder", + "_rewardCut": "% of reward paid to transcoder by a delegator" + } + }, + "transcoderStatus(address)": { + "params": { + "_transcoder": "Address of transcoder" + }, + "returns": { + "_0": "registered or not registered transcoder status" + } + }, + "transcoderTotalStake(address)": { + "params": { + "_transcoder": "Address of transcoder" + }, + "returns": { + "_0": "total bonded stake for a delegator" + } + }, + "transcoderWithHint(uint256,uint256,address,address)": { + "details": "Percentages are represented as numerators of fractions over MathUtils.PERC_DIVISOR. If the caller is going to be added to the pool, the caller can provide an optional hint for the insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position - in the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_feeShare": "% of fees paid to delegators by a transcoder", + "_newPosNext": "Address of next transcoder in pool if the caller joins the pool", + "_newPosPrev": "Address of previous transcoder in pool if the caller joins the pool", + "_rewardCut": "% of reward paid to transcoder by a delegator" + } + }, + "transferBond(address,uint256,address,address,address,address)": { + "details": "If the original delegate is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_oldDelegateNewPosPrev` and `_oldDelegateNewPosNext` params. If the target delegate is in the transcoder pool, the caller can provide an optional hint for the insertion position of the delegate via the `_newDelegateNewPosPrev` and `_newDelegateNewPosNext` params. In both cases, a linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints", + "params": { + "_amount": "Portion of the bond to transfer to receiver", + "_delegator": "Receiver of the bond", + "_newDelegateNewPosNext": "Address of next transcoder in pool if the delegate is in the pool", + "_newDelegateNewPosPrev": "Address of previous transcoder in pool if the delegate is in the pool", + "_oldDelegateNewPosNext": "Address of next transcoder in pool if the delegate remains in the pool", + "_oldDelegateNewPosPrev": "Address of previous transcoder in pool if the delegate remains in the pool" + } + }, + "unbond(uint256)": { + "params": { + "_amount": "Amount of tokens to unbond" + } + }, + "unbondWithHint(uint256,address,address)": { + "details": "If the caller remains in the transcoder pool, the caller can provide an optional hint for its insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position. In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol details on list hints", + "params": { + "_amount": "Amount of tokens to unbond", + "_newPosNext": "Address of next transcoder in pool if the caller remains in the pool", + "_newPosPrev": "Address of previous transcoder in pool if the caller remains in the pool" + } + }, + "updateTranscoderWithFees(address,uint256,uint256)": { + "params": { + "_fees": "Fees to be added to the fee pool", + "_transcoder": "Transcoder address" + } + }, + "withdrawStake(uint256)": { + "params": { + "_unbondingLockId": "ID of unbonding lock to withdraw with" + } + } + }, + "title": "BondingManager", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "bond(uint256,address)": { + "notice": "Delegate stake towards a specific address" + }, + "bondForWithHint(uint256,address,address,address,address,address,address)": { + "notice": "Delegates stake \"on behalf of\" another address towards a specific address and updates the transcoder pool using optional list hints if needed" + }, + "bondWithHint(uint256,address,address,address,address,address)": { + "notice": "Delegates stake towards a specific address and updates the transcoder pool using optional list hints if needed" + }, + "claimEarnings(uint256)": { + "notice": "Claim token pools shares for a delegator from its lastClaimRound through the end round" + }, + "constructor": { + "notice": "BondingManager constructor. Only invokes constructor of base Manager contract with provided Controller address" + }, + "delegatorStatus(address)": { + "notice": "Computes delegator status" + }, + "getDelegator(address)": { + "notice": "Return delegator info" + }, + "getDelegatorUnbondingLock(address,uint256)": { + "notice": "Return delegator's unbonding lock info" + }, + "getFirstTranscoderInPool()": { + "notice": "Returns transcoder with most stake in pool" + }, + "getNextTranscoderInPool(address)": { + "notice": "Returns next transcoder in pool for a given transcoder" + }, + "getTotalBonded()": { + "notice": "Return total bonded tokens" + }, + "getTranscoder(address)": { + "notice": "Return transcoder information" + }, + "getTranscoderEarningsPoolForRound(address,uint256)": { + "notice": "Return transcoder's earnings pool for a given round" + }, + "getTranscoderPoolMaxSize()": { + "notice": "Returns max size of transcoder pool" + }, + "getTranscoderPoolSize()": { + "notice": "Returns size of transcoder pool" + }, + "isActiveTranscoder(address)": { + "notice": "Return whether a transcoder is active for the current round" + }, + "isRegisteredTranscoder(address)": { + "notice": "Return whether a transcoder is registered" + }, + "isValidUnbondingLock(address,uint256)": { + "notice": "Return whether an unbonding lock for a delegator is valid" + }, + "pendingFees(address,uint256)": { + "notice": "Returns pending fees for a delegator from its lastClaimRound through an end round" + }, + "pendingStake(address,uint256)": { + "notice": "Returns pending bonded stake for a delegator from its lastClaimRound through an end round" + }, + "rebond(uint256)": { + "notice": "Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status" + }, + "rebondFromUnbonded(address,uint256)": { + "notice": "Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status" + }, + "rebondFromUnbondedWithHint(address,uint256,address,address)": { + "notice": "Rebond tokens for an unbonding lock to a delegate while a delegator is in the Unbonded status and updates the transcoder pool using an optional list hint if needed" + }, + "rebondWithHint(uint256,address,address)": { + "notice": "Rebond tokens for an unbonding lock to a delegator's current delegate while a delegator is in the Bonded or Pending status and updates the transcoder pool using an optional list hint if needed" + }, + "reward()": { + "notice": "Mint token rewards for an active transcoder and its delegators" + }, + "rewardWithHint(address,address)": { + "notice": "Mint token rewards for an active transcoder and its delegators and update the transcoder pool using an optional list hint if needed" + }, + "setController(address)": { + "notice": "Set controller. Only callable by current controller" + }, + "setCurrentRoundTotalActiveStake()": { + "notice": "Called during round initialization to set the total active stake for the round. Only callable by the RoundsManager" + }, + "setNumActiveTranscoders(uint256)": { + "notice": "Set maximum number of active transcoders. Only callable by Controller owner" + }, + "setUnbondingPeriod(uint64)": { + "notice": "Set unbonding period. Only callable by Controller owner" + }, + "slashTranscoder(address,address,uint256,uint256)": { + "notice": "Slash a transcoder. Only callable by the Verifier" + }, + "transcoder(uint256,uint256)": { + "notice": "Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it" + }, + "transcoderStatus(address)": { + "notice": "Computes transcoder status" + }, + "transcoderTotalStake(address)": { + "notice": "Returns total bonded stake for a transcoder" + }, + "transcoderWithHint(uint256,uint256,address,address)": { + "notice": "Sets commission rates as a transcoder and if the caller is not in the transcoder pool tries to add it using an optional list hint" + }, + "transferBond(address,uint256,address,address,address,address)": { + "notice": "Transfers ownership of a bond to a new delegator using optional hints if needed If the receiver is already bonded to a different delegate than the bond owner then the stake goes to the receiver's delegate otherwise the receiver's delegate is set as the owner's delegate" + }, + "unbond(uint256)": { + "notice": "Unbond an amount of the delegator's bonded stake" + }, + "unbondWithHint(uint256,address,address)": { + "notice": "Unbond an amount of the delegator's bonded stake and updates the transcoder pool using an optional list hint if needed" + }, + "updateTranscoderWithFees(address,uint256,uint256)": { + "notice": "Update transcoder's fee pool. Only callable by the TicketBroker" + }, + "withdrawFees(address,uint256)": { + "notice": "Withdraws fees to the caller" + }, + "withdrawStake(uint256)": { + "notice": "Withdraws tokens for an unbonding lock that has existed through an unbonding period" + } + }, + "notice": "Manages bonding, transcoder and rewards/fee accounting related operations of the Livepeer protocol", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2670, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(IController)2645" + }, + { + "astId": 2852, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "targetContractId", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 2962, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "unbondingPeriod", + "offset": 0, + "slot": "2", + "type": "t_uint64" + }, + { + "astId": 3025, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "delegators", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_struct(Delegator)3011_storage)" + }, + { + "astId": 3030, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "transcoders", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_struct(Transcoder)2988_storage)" + }, + { + "astId": 3032, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "currentRoundTotalActiveStake", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 3034, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "nextRoundTotalActiveStake", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 3037, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "transcoderPool", + "offset": 0, + "slot": "7", + "type": "t_struct(Data)7357_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IController)2645": { + "encoding": "inplace", + "label": "contract IController", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Delegator)3011_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct BondingManager.Delegator)", + "numberOfBytes": "32", + "value": "t_struct(Delegator)3011_storage" + }, + "t_mapping(t_address,t_struct(Node)7343_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct SortedDoublyLL.Node)", + "numberOfBytes": "32", + "value": "t_struct(Node)7343_storage" + }, + "t_mapping(t_address,t_struct(Transcoder)2988_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct BondingManager.Transcoder)", + "numberOfBytes": "32", + "value": "t_struct(Transcoder)2988_storage" + }, + "t_mapping(t_uint256,t_struct(Data)6607_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct EarningsPool.Data)", + "numberOfBytes": "32", + "value": "t_struct(Data)6607_storage" + }, + "t_mapping(t_uint256,t_struct(UnbondingLock)3020_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct BondingManager.UnbondingLock)", + "numberOfBytes": "32", + "value": "t_struct(UnbondingLock)3020_storage" + }, + "t_struct(Data)6607_storage": { + "encoding": "inplace", + "label": "struct EarningsPool.Data", + "members": [ + { + "astId": 6598, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "totalStake", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 6600, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "transcoderRewardCut", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 6602, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "transcoderFeeShare", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 6604, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "cumulativeRewardFactor", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 6606, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "cumulativeFeeFactor", + "offset": 0, + "slot": "4", + "type": "t_uint256" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Data)7357_storage": { + "encoding": "inplace", + "label": "struct SortedDoublyLL.Data", + "members": [ + { + "astId": 7345, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "head", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 7347, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "tail", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 7349, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "maxSize", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 7351, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "size", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 7356, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "nodes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_struct(Node)7343_storage)" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Delegator)3011_storage": { + "encoding": "inplace", + "label": "struct BondingManager.Delegator", + "members": [ + { + "astId": 2993, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "bondedAmount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 2995, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "fees", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2997, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "delegateAddress", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 2999, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "delegatedAmount", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 3001, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "startRound", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3003, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "lastClaimRound", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 3005, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "nextUnbondingLockId", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 3010, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "unbondingLocks", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_struct(UnbondingLock)3020_storage)" + } + ], + "numberOfBytes": "256" + }, + "t_struct(Node)7343_storage": { + "encoding": "inplace", + "label": "struct SortedDoublyLL.Node", + "members": [ + { + "astId": 7338, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "key", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 7340, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "nextId", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 7342, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "prevId", + "offset": 0, + "slot": "2", + "type": "t_address" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Transcoder)2988_storage": { + "encoding": "inplace", + "label": "struct BondingManager.Transcoder", + "members": [ + { + "astId": 2964, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "lastRewardRound", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 2966, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "rewardCut", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2968, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "feeShare", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2973, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "earningsPoolPerRound", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_struct(Data)6607_storage)" + }, + { + "astId": 2975, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "lastActiveStakeUpdateRound", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 2977, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "activationRound", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 2979, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "deactivationRound", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 2981, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "activeCumulativeRewards", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 2983, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "cumulativeRewards", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 2985, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "cumulativeFees", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 2987, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "lastFeeRound", + "offset": 0, + "slot": "10", + "type": "t_uint256" + } + ], + "numberOfBytes": "352" + }, + "t_struct(UnbondingLock)3020_storage": { + "encoding": "inplace", + "label": "struct BondingManager.UnbondingLock", + "members": [ + { + "astId": 3017, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 3019, + "contract": "contracts/bonding/BondingManager.sol:BondingManager", + "label": "withdrawRound", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/backend/src/index.js b/backend/src/index.js new file mode 100644 index 0000000..d6f96c5 --- /dev/null +++ b/backend/src/index.js @@ -0,0 +1,4 @@ +//Starting point of backend. Simply imports ESM and calls the actual server.js to be loaded. + +require = require("esm")(module) +module.exports = require("./server.js") diff --git a/backend/src/models/event.js b/backend/src/models/event.js new file mode 100644 index 0000000..5cf6bac --- /dev/null +++ b/backend/src/models/event.js @@ -0,0 +1,31 @@ +import mongoose from 'mongoose'; + + +//database schema for users +const EventSchema = new mongoose.Schema({ + address: { + type: String, + required: true + }, + transactionHash: { + type: String, + required: true + }, + transactionUrl: { + type: String, + required: true + }, + name: { + type: String, + required: true + }, + data: { + type: Object, + required: true + }, +}, { timestamps: true }); + +//define variable User, which corresponds with the schema +const Event = mongoose.model('Event', EventSchema); +//export for use outside of this file +export default Event; \ No newline at end of file diff --git a/backend/src/models/timelapse.js b/backend/src/models/timelapse.js new file mode 100644 index 0000000..5cb0a22 --- /dev/null +++ b/backend/src/models/timelapse.js @@ -0,0 +1,31 @@ +import mongoose from 'mongoose'; + +const timelapseSchema = new mongoose.Schema({ + ownerId: { + type: mongoose.ObjectId, + ref: 'User', + required: true + }, + OwnerIp: { + type: String, + required: true + }, + fullFilename: { + type: String, + required: true + }, + upvotes: { + type: Number, + required: false, + default: 0 + }, + downvotes: { + type: Number, + required: false, + default: 0 + } +}, { timestamps: true }); + + +const timelapseObj = mongoose.model('timelapseSchema', timelapseSchema); +export default timelapseObj; \ No newline at end of file diff --git a/backend/src/models/user.js b/backend/src/models/user.js new file mode 100644 index 0000000..8567edd --- /dev/null +++ b/backend/src/models/user.js @@ -0,0 +1,34 @@ +import mongoose from 'mongoose'; + + +//database schema for users +const UserSchema = new mongoose.Schema({ + ip: { + type: String, + required: true + }, + upvotedTimelapses: { + type: [mongoose.ObjectId], + ref: 'timelapseSchema', + required: false, + default: [] + }, + downvotedTimelapses: { + type: [mongoose.ObjectId], + ref: 'timelapseSchema', + required: false, + default: [] + } +}, { timestamps: true }); + + +//takes a database field as input, returns T/F if entry already exists. +//iterates through entire user DB, any field +UserSchema.statics.doesNotExist = async function (field) { + return await this.where(field).countDocuments() === 0; +}; + +//define variable User, which corresponds with the schema +const User = mongoose.model('User', UserSchema); +//export for use outside of this file +export default User; diff --git a/backend/src/routes/index.js b/backend/src/routes/index.js new file mode 100644 index 0000000..8737861 --- /dev/null +++ b/backend/src/routes/index.js @@ -0,0 +1,7 @@ +//In this document all used routes are defined. +//(in this case this is just user.js and session.js) +import userRouter from './user'; +import sessionRouter from './session'; +import livepeerRouter from './livepeer'; + +export { userRouter, sessionRouter, livepeerRouter }; \ No newline at end of file diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js new file mode 100644 index 0000000..9868d17 --- /dev/null +++ b/backend/src/routes/livepeer.js @@ -0,0 +1,233 @@ +import express from "express"; +import Event from '../models/event'; +const fs = require('fs'); +const apiRouter = express.Router(); +import { + API_CMC, API_L1_HTTP, API_L2_HTTP, API_L2_WS +} from "../config"; + +// Get ETH price & LPT coin prices +const CoinMarketCap = require('coinmarketcap-api'); +const cmcClient = new CoinMarketCap(API_CMC); +// Get gas price on ETH (L2 already gets exported by the O's themselves) +const { createAlchemyWeb3 } = require("@alch/alchemy-web3"); +const web3layer1 = createAlchemyWeb3(API_L1_HTTP); +const web3layer2 = createAlchemyWeb3(API_L2_HTTP); +const web3layer2WS = createAlchemyWeb3(API_L2_WS); + +// Update CMC related api calls every 5 minutes +const timeoutCMC = 300000; +let cmcPriceGet = 0; +let ethPrice = 0; +let lptPrice = 0; +let cmcQuotes = {}; +let cmcCache = {}; + +// Update alchemy related API calls every 2 seconds +const timeoutAlchemy = 2000; +let l2Gwei = 0; +let l1Gwei = 0; +let l2block = 0; +let l1block = 0; +let arbGet = 0; + +// Gas limits on common contract interactions +const redeemRewardGwei = 1053687; +const claimTicketGwei = 1333043; +const withdrawFeeGwei = 688913; +let redeemRewardCostL1 = 0; +let redeemRewardCostL2 = 0; +let claimTicketCostL1 = 0; +let claimTicketCostL2 = 0; +let withdrawFeeCostL1 = 0; +let withdrawFeeCostL2 = 0; + + +// Listen to smart contract emitters. Resync with DB every 5 minutes +const timeoutEvents = 300000; +let eventsCache = []; +let eventsGet = 0; +// https://arbiscan.io/address/0x35Bcf3c30594191d53231E4FF333E8A770453e40#events +const BondingManagerTargetJson = fs.readFileSync('src/abi/BondingManagerTarget.json'); +const BondingManagerTargetAbi = JSON.parse(BondingManagerTargetJson); +const BondingManagerProxyAddr = "0x35Bcf3c30594191d53231E4FF333E8A770453e40"; +const contractInstance = new web3layer2WS.eth.Contract(BondingManagerTargetAbi.abi, BondingManagerProxyAddr); +var BondingManagerProxyListener = contractInstance.events.allEvents(async (error, event) => { + try { + if (error) { + throw error + } + console.log('New event emitted on', BondingManagerProxyAddr); + // Push obj of event to cache and create a new entry for it in the DB + const eventObj = { + address: event.address, + transactionHash: event.transactionHash, + transactionUrl: "https://arbiscan.io/tx/" + event.transactionHash, + name: event.event, + data: event.returnValues + } + const dbObj = new Event(eventObj); + await dbObj.save(); + eventsCache.push(eventObj); + } + catch (err) { + console.log("FATAL ERROR: ", err); + } +}); +console.log("listening for events on", BondingManagerProxyAddr) + +// Splits of the big CMC object into separate datas +const parseCmc = async function () { + try { + cmcCache = await cmcClient.getTickers({ limit: 200 }); + for (var idx = 0; idx < cmcCache.data.length; idx++) { + const coinData = cmcCache.data[idx]; + // Handle specific coins only for the grafana endpoint + if (coinData.symbol == "ETH") { + ethPrice = coinData.quote.USD.price; + } else if (coinData.symbol == "LPT") { + lptPrice = coinData.quote.USD.price; + } + // Sort by name->quotes for quotes endpoint + cmcQuotes[coinData.symbol] = coinData.quote.USD; + } + } + catch (err) { + res.status(400).send(err); + } +} + +// Queries Alchemy for block info and fees +const parseL1Blockchain = async function () { + const l1Wei = await web3layer1.eth.getGasPrice(); + l1block = await web3layer1.eth.getBlockNumber(); + l1Gwei = l1Wei / 1000000000; + redeemRewardCostL1 = (redeemRewardGwei * l1Gwei) / 1000000000; + claimTicketCostL1 = (claimTicketGwei * l1Gwei) / 1000000000; + withdrawFeeCostL1 = (withdrawFeeGwei * l1Gwei) / 1000000000; +} +const parseL2Blockchain = async function () { + const l2Wei = await web3layer2.eth.getGasPrice(); + l2block = await web3layer2.eth.getBlockNumber(); + l2Gwei = l2Wei / 1000000000; + redeemRewardCostL2 = (redeemRewardGwei * l2Gwei) / 1000000000; + claimTicketCostL2 = (claimTicketGwei * l2Gwei) / 1000000000; + withdrawFeeCostL2 = (withdrawFeeGwei * l2Gwei) / 1000000000; +} +const parseEthBlockchain = async function () { + await Promise.all([parseL1Blockchain(), parseL2Blockchain()]); +} + +// Export livepeer and eth coin prices and L1 Eth gas price +apiRouter.get("/grafana", async (req, res) => { + try { + const now = new Date().getTime(); + // Update blockchain data if the cached data has expired + if (now - arbGet > timeoutAlchemy) { + await parseEthBlockchain(); + arbGet = now; + } + // Update coin prices once their data has expired + if (now - cmcPriceGet > timeoutCMC) { + await parseCmc(); + cmcPriceGet = now; + } + res.send({ + timestamp: now, + cmcTime: cmcPriceGet, + blockchainTime: arbGet, + l1GasFeeInGwei: l1Gwei, + l2GasFeeInGwei: l2Gwei, + ethPriceInDollar: ethPrice, + lptPriceInDollar: lptPrice, + redeemRewardCostL1, + redeemRewardCostL2, + claimTicketCostL1, + claimTicketCostL2, + withdrawFeeCostL1, + withdrawFeeCostL2, + quotes: cmcQuotes + }); + } catch (err) { + res.status(400).send(err); + } +}); + +apiRouter.get("/cmc", async (req, res) => { + try { + const now = new Date().getTime(); + // Update cmc once their data has expired + if (now - cmcPriceGet > timeoutCMC) { + await parseCmc(); + cmcPriceGet = now; + } + res.send(cmcCache); + } catch (err) { + res.status(400).send(err); + } +}); + +apiRouter.get("/blockchains", async (req, res) => { + try { + const now = new Date().getTime(); + // Update blockchain data if the cached data has expired + if (now - arbGet > timeoutAlchemy) { + await parseEthBlockchain(); + arbGet = now; + } + res.send({ + timestamp: now, + l1block, + l2block, + blockchainTime: arbGet, + l1GasFeeInGwei: l1Gwei, + l2GasFeeInGwei: l2Gwei, + redeemRewardCostL1, + redeemRewardCostL2, + claimTicketCostL1, + claimTicketCostL2, + withdrawFeeCostL1, + withdrawFeeCostL2 + }); + } catch (err) { + res.status(400).send(err); + } +}); + + +apiRouter.get("/quotes", async (req, res) => { + try { + const now = new Date().getTime(); + // Update cmc once their data has expired + if (now - cmcPriceGet > timeoutCMC) { + cmcCache = await cmcClient.getTickers({ limit: 200 }); + await parseCmc(); + cmcPriceGet = now; + } + res.send(cmcQuotes); + } catch (err) { + res.status(400).send(err); + } +}); + +apiRouter.get("/getEvents", async (req, res) => { + try { + const now = new Date().getTime(); + // Update cmc once their data has expired + if (now - eventsGet > timeoutEvents) { + eventsCache = await Event.find({}, { + address: 1, + transactionHash: 1, + transactionUrl: 1, + name: 1, + data: 1, + _id: 0}); + eventsGet = now; + } + res.send(eventsCache); + } catch (err) { + res.status(400).send(err); + } +}); + +export default apiRouter; \ No newline at end of file diff --git a/backend/src/routes/session.js b/backend/src/routes/session.js new file mode 100644 index 0000000..41b6a27 --- /dev/null +++ b/backend/src/routes/session.js @@ -0,0 +1,51 @@ +import express from "express"; +import User from "../models/user"; +import { SESS_NAME } from "../config"; + +const sessionRouter = express.Router(); + +sessionRouter.post("", async (req, res) => { + try { + const username = req.headers['x-forwarded-for'] || req.socket.remoteAddress; + const user = await User.findOne({ ip: username }); + if (user) { + console.log("User logged in as " + user.ip); + req.session.user = {ip: user.ip}; + res.send({ip: user.ip}); + } else { + const newUser = new User({ ip: username}); + await newUser.save(); + console.log("User logged in as " + user.ip); + req.session.user = {ip: newUser.ip}; + res.send({ip: newUser.ip}); + } + } catch (err) { + res.status(401).send(err); + } +}); + +//on delete request +sessionRouter.delete("", ({ session }, res) => { + try { + const user = session.user; + if (user) { + console.log(user.username + " is logging out"); + session.destroy(err => { + if (err) throw (err); + res.clearCookie(SESS_NAME); + res.send(user); + }); + } else { + throw new Error('Sessie kon niet worden verwijderd'); + } + } catch (err) { + res.status(422).send(err); + } +}); + +//on get request +sessionRouter.get("", ({ session: { user } }, res) => { + res.send({ user }); +}); + +export default sessionRouter; diff --git a/backend/src/routes/user.js b/backend/src/routes/user.js new file mode 100644 index 0000000..4e4ed2f --- /dev/null +++ b/backend/src/routes/user.js @@ -0,0 +1,106 @@ +//The userRouter is used to handle user related functions +import express from 'express'; +import User from '../models/user'; +import timelapseObj from '../models/timelapse'; + +const userRouter = express.Router(); + +userRouter.post("/getVisitorStats", async (req, res) => { + try { + const totalUserCount = await User.countDocuments(); + const activeUserCount = await User.countDocuments({ $or: [ + {"upvotedTimelapses.0": { "$exists": true }}, + {"downvotedTimelapses.0": { "$exists": true }} + ]}); + res.send({totalVisitorCount: totalUserCount, + activeVisitorCount: activeUserCount}); + } catch (err) { + res.status(400).send(err); + } +}); + +userRouter.post("/getCurrentUserVotes", async (req, res) => { + console.log(req.session); + try { + const userObj = await User.findOne({ip: req.session.user.ip}, {upvotedTimelapses: 1, downvotedTimelapses: 1, _id: 0}); + res.send(userObj); + } catch (err) { + res.status(400).send(err); + } +}); + +userRouter.post("/getScoreByTimelapeFilename", async (req, res) => { + try { + const filename = req.body.fullFilename; + const scoreObj = await timelapseObj.findOne({ fullFilename: filename }, { upvotes: 1, downvotes: 1, _id: 1 }); + if (scoreObj) { + res.send(scoreObj); + } else { + res.send({upvotes: 0, downvotes: 0}); + } + } catch (err) { + res.status(400).send(err); + } +}); + +userRouter.post("/setVoteOnTimelapse", async (req, res) => { + try { + var voteValue = req.body.voteValue; + const fullFilename = req.body.fullFilename; + const username = req.session.user.ip; + console.log("voteValue="+voteValue); + console.log("fullFilename="+fullFilename); + console.log("username="+username); + const currentUserObj = await User.findOne({ip: username}); + console.log(currentUserObj); + if (!currentUserObj){ + throw new Error("User not logged in"); + } + var currentTimelapseObj = await timelapseObj.findOne({fullFilename: fullFilename}); + if(!currentTimelapseObj){ + currentTimelapseObj = new timelapseObj({ ownerId: currentUserObj._id, OwnerIp: currentUserObj.ip, fullFilename: fullFilename}); + await currentTimelapseObj.save(); + }else{ + console.log(currentTimelapseObj); + if(currentUserObj.upvotedTimelapses.length && currentUserObj.upvotedTimelapses.includes(currentTimelapseObj._id)){ + currentTimelapseObj.upvotes = currentTimelapseObj.upvotes - 1; + await currentTimelapseObj.save() + await User.updateOne({ip: username},{ + $pullAll: { + upvotedTimelapses: [currentTimelapseObj._id], + }, + }); + } else if(currentUserObj.downvotedTimelapses.length && currentUserObj.downvotedTimelapses.includes(currentTimelapseObj._id)){ + currentTimelapseObj.downvotes = currentTimelapseObj.downvotes - 1; + await currentTimelapseObj.save() + await User.updateOne({ip: username},{ + $pullAll: { + downvotedTimelapses: [currentTimelapseObj._id], + }, + }); + } + } + if (voteValue == 1){ + await User.updateOne( + { ip: username }, + { $push: { upvotedTimelapses: currentTimelapseObj._id } } + ); + currentTimelapseObj.upvotes = currentTimelapseObj.upvotes + 1; + }else if (voteValue == -1){ + await User.updateOne( + { ip: username }, + { $push: { downvotedTimelapses: currentTimelapseObj._id } } + ); + currentTimelapseObj.downvotes = currentTimelapseObj.downvotes + 1; + } + await currentTimelapseObj.save(); + console.log(currentTimelapseObj); + res.send(currentTimelapseObj); + } catch (err) { + res.status(400).send(err); + } +}); + + + +export default userRouter; diff --git a/backend/src/server.js b/backend/src/server.js new file mode 100644 index 0000000..af407e0 --- /dev/null +++ b/backend/src/server.js @@ -0,0 +1,89 @@ +//Server logic. Imports all necessary routes, models, etc +import express from 'express'; +import mongoose from 'mongoose'; +import session from "express-session"; +import connectStore from "connect-mongo"; +import { userRouter, sessionRouter, livepeerRouter } from './routes/index'; +import { + PORT, NODE_ENV, MONGO_URI, SESS_NAME, SESS_SECRET, SESS_LIFETIME , MONGO_URI_DEV, MONGO_URI_LOCAL +} from "./config"; + +const { NODE_ENV: mode } = process.env; + +(async () => { + try { + //first connect with DB + if (mode == "production"){ + await mongoose.connect(MONGO_URI, { useNewUrlParser: true, useFindAndModify: false}); + }else if (mode == "development"){ + await mongoose.connect(MONGO_URI_DEV, { useNewUrlParser: true, useFindAndModify: false}); + }else if (mode == "local"){ + await mongoose.connect(MONGO_URI_LOCAL, { useNewUrlParser: true, useFindAndModify: false}); + }else{ + await mongoose.connect(MONGO_URI, { useNewUrlParser: true, useFindAndModify: false}); + } + console.log('MongoDB connected on ' + mode); + //web application framework + const app = express(); + //disable powered by message, which contains information on + app.disable('x-powered-by'); + //parses and validates requests to make things harder for malicious actors + app.use(express.urlencoded({ extended: true })); + app.use(express.json()); + //import session module + const MongoStore = connectStore(session); + + //define session data + app.use(session({ + name: SESS_NAME, + //TODO: change secret in config file + secret: SESS_SECRET, + //define where to store them + store: new MongoStore({ + mongooseConnection: mongoose.connection, + collection: 'session', + ttl: parseInt(SESS_LIFETIME) / 1000, + }), + saveUninitialized: false, + proxy: NODE_ENV === "production", + resave: false, + //cookie to send to users + cookie: { + sameSite: true, + secure: NODE_ENV === 'production', + maxAge: parseInt(SESS_LIFETIME) + } + })); + //define default router + const apiRouter = express.Router(); + //which handles any request starting with /api + app.use('/api', apiRouter); + //but changes to a different router for different paths + apiRouter.use('/users', userRouter); + apiRouter.use('/session', sessionRouter); + apiRouter.use('/livepeer', livepeerRouter); + + // error handler + app.use(function(err, req, res, next) { + + res.locals.message = err.message; + // set locals, only providing error in development + //res.locals.error = req.app.get('env') === 'development' ? err : {}; + + // add this line to include winston logging + console.log(`${err.status || 500} - ${err.message} - ${req.originalUrl} - ${req.method} - ${req.ip}`); + + // render the error page + res.status(err.status || 500); + res.render('error'); + }); + + //actually start server + app.listen(PORT, "0.0.0.0", function () { + console.log(`Listening on port ${PORT}`); + }); + //and log any errors to the console + } catch (err) { + console.log(err); + } +})(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..aea0b3f --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "LivepeerEvents", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^7.1.2", + "ethers": "^5.4.4", + "http": "^0.0.1-security", + "https": "^1.0.0", + "md5": "^2.3.0", + "react": "^16.12.0", + "react-dom": "^16.12.0", + "react-indiana-drag-scroll": "^2.1.0", + "react-markdown": "^7.1.1", + "react-redux": "^7.2.6", + "react-router-dom": "^6.0.2", + "react-scripts": "3.2.0", + "redux": "^4.1.2", + "redux-thunk": "^2.4.1", + "styled-components": "^5.3.3" + }, + "proxy": "http://localhost:42609", + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/public/50x.html b/public/50x.html new file mode 100755 index 0000000..9071e0a --- /dev/null +++ b/public/50x.html @@ -0,0 +1,21 @@ + + + +Error + + + +

An error occurred.

+

Sorry, the page you are looking for is currently unavailable.
+Please try again later.

+

If you are the system administrator of this resource then you should check +the error log for details.

+

Faithfully yours, nginx.

+ + diff --git a/public/background.jpg b/public/background.jpg new file mode 100644 index 0000000..9e6a640 Binary files /dev/null and b/public/background.jpg differ diff --git a/public/dvdvideo.png b/public/dvdvideo.png new file mode 100644 index 0000000..2c5d7fc Binary files /dev/null and b/public/dvdvideo.png differ diff --git a/public/eth.png b/public/eth.png new file mode 100644 index 0000000..8827b37 Binary files /dev/null and b/public/eth.png differ diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..a9c78cd Binary files /dev/null and b/public/favicon.png differ diff --git a/public/github.png b/public/github.png new file mode 100644 index 0000000..ea6ff54 Binary files /dev/null and b/public/github.png differ diff --git a/public/grafana.png b/public/grafana.png new file mode 100644 index 0000000..5dbec11 Binary files /dev/null and b/public/grafana.png differ diff --git a/public/home.png b/public/home.png new file mode 100644 index 0000000..4f53e72 Binary files /dev/null and b/public/home.png differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..47d1146 --- /dev/null +++ b/public/index.html @@ -0,0 +1,21 @@ + + + + + + + + + + LivepeerEvents + + + + + +
+ + diff --git a/public/livepeer.png b/public/livepeer.png new file mode 100644 index 0000000..a9c78cd Binary files /dev/null and b/public/livepeer.png differ diff --git a/public/loading.png b/public/loading.png new file mode 100644 index 0000000..54be49a Binary files /dev/null and b/public/loading.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..526cf83 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,14 @@ +{ + "short_name": "LivepeerEvents", + "name": "nframe.nl", + "icons": [ + { + "src": "favicon.png", + "type": "image/png" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#855dfe", + "background_color": "#020643" +} diff --git a/public/metamask.svg b/public/metamask.svg new file mode 100644 index 0000000..963c73e --- /dev/null +++ b/public/metamask.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/mistserver.svg b/public/mistserver.svg new file mode 100644 index 0000000..42bfd17 --- /dev/null +++ b/public/mistserver.svg @@ -0,0 +1,142 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/prometheus.png b/public/prometheus.png new file mode 100644 index 0000000..72cb7b6 Binary files /dev/null and b/public/prometheus.png differ diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..01b0f9a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..d71ce26 --- /dev/null +++ b/src/App.js @@ -0,0 +1,34 @@ +import * as React from "react"; +import Home from './home.js'; +import Startup from './loadingScreen.js'; +import Grafana from './grafana.js'; +import Livepeer from './livepeer.js'; + +import { + BrowserRouter as Router, + Routes, + Route +} from "react-router-dom"; + + + +export default function App() { + return ( + + + + } /> + } /> + } /> + + + + + ); +} diff --git a/src/actions/error.js b/src/actions/error.js new file mode 100644 index 0000000..9571eb4 --- /dev/null +++ b/src/actions/error.js @@ -0,0 +1,27 @@ +{/* Ability to receive and clear errors as dispatch actions +Requires this in files where errors can be received: +const mapStateToProps = ({ errors }) => ({ + errors +}); +*/} +export const RECEIVE_ERRORS = "RECEIVE_ERRORS"; +export const RECEIVE_NOTIFICATIONS = "RECEIVE_NOTIFICATIONS"; +export const CLEAR_ERRORS = "CLEAR_ERRORS"; + +export const receiveErrors = ({ message }) => ({ + type: RECEIVE_ERRORS, + message +}); + +export const clearErrors = () => ({ + type: CLEAR_ERRORS +}); + +const receiveNotification = (message) => ({ + type: RECEIVE_NOTIFICATIONS, + message +}) + +export const receiveNotifications = (title, message) => async dispatch => { + return dispatch(receiveNotification({title, message})); +}; diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js new file mode 100644 index 0000000..768428e --- /dev/null +++ b/src/actions/livepeer.js @@ -0,0 +1,43 @@ +import * as apiUtil from "../util/livepeer"; +import { receiveErrors } from "./error"; + +export const RECEIVE_QUOTES = "RECEIVE_QUOTES"; +export const RECEIVE_BLOCKCHAIN_DATA = "RECEIVE_BLOCKCHAIN_DATA"; +export const RECEIVE_EVENTS = "RECEIVE_EVENTS"; + +const setQuotes = message => ({ + type: RECEIVE_QUOTES, message +}); +const setBlockchainData = message => ({ + type: RECEIVE_BLOCKCHAIN_DATA, message +}); +const setEvents = message => ({ + type: RECEIVE_EVENTS, message +}); + +export const getQuotes = () => async dispatch => { + const response = await apiUtil.getQuotes(); + const data = await response.json(); + if (response.ok) { + return dispatch(setQuotes(data)); + } + return dispatch(receiveErrors(data)); +}; + +export const getBlockchainData = () => async dispatch => { + const response = await apiUtil.getBlockchainData(); + const data = await response.json(); + if (response.ok) { + return dispatch(setBlockchainData(data)); + } + return dispatch(receiveErrors(data)); +}; + +export const getEvents = () => async dispatch => { + const response = await apiUtil.getEvents(); + const data = await response.json(); + if (response.ok) { + return dispatch(setEvents(data)); + } + return dispatch(receiveErrors(data)); +}; \ No newline at end of file diff --git a/src/actions/session.js b/src/actions/session.js new file mode 100644 index 0000000..4c2ca63 --- /dev/null +++ b/src/actions/session.js @@ -0,0 +1,18 @@ +import * as apiUtil from "../util/session"; +import { receiveErrors } from "./error"; + +export const RECEIVE_CURRENT_USER = "RECEIVE_CURRENT_USER"; + +const receiveCurrentUser = user => ({ + type: RECEIVE_CURRENT_USER, + user +}); + +export const login = () => async dispatch => { + const response = await apiUtil.login(); + const data = await response.json(); + if (response.ok) { + return dispatch(receiveCurrentUser(data)); + } + return dispatch(receiveErrors(data)); +}; \ No newline at end of file diff --git a/src/actions/user.js b/src/actions/user.js new file mode 100644 index 0000000..04ecbba --- /dev/null +++ b/src/actions/user.js @@ -0,0 +1,50 @@ +import * as apiUtil from "../util/user"; +import { receiveErrors } from "./error"; + +export const RECEIVE_VISITOR_STATS = "RECEIVE_VISITOR_STATS"; +export const RECEIVE_CURRENT_USER_VOTES = "RECEIVE_CURRENT_USER_VOTES"; + +const setVisitorStats = message => ({ + type: RECEIVE_VISITOR_STATS, message +}); + + +const setCurrentUserVotes = message => ({ + type: RECEIVE_CURRENT_USER_VOTES, message +}); + +export const getVisitorStats = () => async dispatch => { + const response = await apiUtil.getVisitorStats(); + const data = await response.json(); + if (response.ok) { + return dispatch(setVisitorStats(data)); + } + return dispatch(receiveErrors(data)); +}; + +export const getCurrentUserVotes = () => async dispatch => { + const response = await apiUtil.getCurrentUserVotes(); + const data = await response.json(); + if (response.ok) { + return dispatch(setCurrentUserVotes(data)); + } + return dispatch(receiveErrors(data)); +}; + +export const getScoreByTimelapeFilename = (fullFilename) => async dispatch => { + const response = await apiUtil.getScoreByTimelapeFilename(fullFilename); + const data = await response.json(); + if (response.ok) { + return data; + } + return dispatch(receiveErrors(data)); +}; + +export const setVoteOnTimelapse = (voteValue, fullFilename) => async dispatch => { + const response = await apiUtil.setVoteOnTimelapse(voteValue, fullFilename); + const data = await response.json(); + if (response.ok) { + return data; + } + return dispatch(receiveErrors(data)); +}; diff --git a/src/eventButton.js b/src/eventButton.js new file mode 100644 index 0000000..e7a6bca --- /dev/null +++ b/src/eventButton.js @@ -0,0 +1,47 @@ +import React from "react"; + +const EventButton = (obj) => { + let eventSpecificInfo; + if (obj.name == "EarningsClaimed") { + eventSpecificInfo =
+

(Round {obj.data.endRound}) Claim: {obj.data.delegator} earned {obj.data.rewards / 1000000000000000000} Eth @ Orchestrator {obj.data.delegate}

+
+ } else if (obj.name == "Unbond") { + eventSpecificInfo =
+

(Round {obj.data.withdrawRound}) Unbond: {obj.data.delegator} unbonded {obj.data.amount / 1000000000000000000} Eth @ Orchestrator {obj.data.delegate}

+
+ } else if (obj.name == "TransferBond") { + eventSpecificInfo =
+

TransferBond: transfered bond worth {obj.data.amount / 1000000000000000000} Eth from {obj.data.oldDelegator} to {obj.data.newDelegator}

+
+ } else if (obj.name == "Bond") { + eventSpecificInfo =
+

Bond: {obj.data.delegator} transfered bond worth {obj.data.bondedAmount / 1000000000000000000} Eth from {obj.data.oldDelegate} to {obj.data.newDelegate}

+
+ } else if (obj.name == "Rebond") { + eventSpecificInfo =
+

Rebond: {obj.data.delegator} @ {obj.data.delegate}

+
+ } else if (obj.name == "WithdrawFees") { + eventSpecificInfo =
+

WithdrawFees: {obj.data.amount / 1000000000000000000} Eth {obj.data.delegator} to {obj.data.recipient}

+
+ } else { + eventSpecificInfo =
+

UNIMPLEMENTED: {obj.event}

+
+ } + + return ( +
+ + + +
+ ) +} + +export default EventButton; \ No newline at end of file diff --git a/src/grafana.js b/src/grafana.js new file mode 100644 index 0000000..0e0ce6c --- /dev/null +++ b/src/grafana.js @@ -0,0 +1,71 @@ +import React, { useEffect, useState } from "react"; +import './style.css'; +import { + Navigate, useParams +} from "react-router-dom"; + +const Grafana = () => { + let params = useParams(); + const [redirectToHome, setRedirectToHome] = useState(false); + + useEffect(() => { + + }, []) + + if (redirectToHome) { + return ; + } + return ( +
+
+ +
+
+
+
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+ ); +} + +export default Grafana; \ No newline at end of file diff --git a/src/home.js b/src/home.js new file mode 100644 index 0000000..110183a --- /dev/null +++ b/src/home.js @@ -0,0 +1,116 @@ +import * as React from "react"; +import './style.css'; +import { + Navigate +} from "react-router-dom"; +import { connect } from "react-redux"; +import { + getVisitorStats +} from "./actions/user"; + +const mapStateToProps = (state) => { + return { + session: state.session, + userstate: state.userstate, + errors: state.errors + } +}; + +const mapDispatchToProps = dispatch => ({ + getVisitorStats: () => dispatch(getVisitorStats()) +}); + + +class Home extends React.Component { + state = { + redirectToGrafana: false, + redirectToLPT: false + }; + + constructor(props) { + super(props); + } + + render() { + if (this.state.redirectToRunningServices) { + return ; + } + else if (this.state.redirectToWavePortal) { + return ; + } + if (this.state.redirectToTimelapses) { + return ; + } + if (this.state.redirectToTutorialMistOcto) { + return ; + } + if (this.state.redirectToGrafana) { + return ; + } + if (this.state.redirectToVideoNFT) { + return ; + } + if (this.state.redirectToLPT) { + return ; + } + + + var totalVisitorCount = 0; + var activeVisitorCount = 0; + if (this.props.userstate.visitorStats) { + totalVisitorCount = this.props.userstate.visitorStats.totalVisitorCount; + activeVisitorCount = this.props.userstate.visitorStats.activeVisitorCount + } + + return ( +
+
+ +
+
+
+
+

Home

+
+
+ +
+
+ +
+
+
+
+
+

+ Connected as {this.props.session.ip || "?"} +

+
+
+

+ {totalVisitorCount} unique visitors / {activeVisitorCount} of which have interacted with this website +

+
+
+
+
+ nframe.tech / nframe.nl +
+
+
+ ) + } +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(Home); diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..4e88239 --- /dev/null +++ b/src/index.js @@ -0,0 +1,19 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; +import configureStore from "./store/store"; +import { Provider } from "react-redux"; +import { checkLoggedIn } from "./util/session"; + +const renderApp = preloadedState => { + const store = configureStore(preloadedState); + window.state = store.getState; + + ReactDOM.render(, document.getElementById('root')); +}; + +(async () => renderApp(await checkLoggedIn()))(); + + + + diff --git a/src/livepeer.js b/src/livepeer.js new file mode 100644 index 0000000..a0c7f1f --- /dev/null +++ b/src/livepeer.js @@ -0,0 +1,186 @@ +import * as React from "react"; +import './style.css'; +import { + Navigate +} from "react-router-dom"; +import ScrollContainer from 'react-indiana-drag-scroll'; +import { connect } from "react-redux"; +import { + getQuotes, getBlockchainData, getEvents +} from "./actions/livepeer"; +import EventButton from "./eventButton"; + +const mapStateToProps = (state) => { + return { + session: state.session, + userstate: state.userstate, + errors: state.errors, + livepeer: state.livepeerstate + } +}; + +const mapDispatchToProps = dispatch => ({ + getQuotes: () => dispatch(getQuotes()), + getBlockchainData: () => dispatch(getBlockchainData()), + getEvents: () => dispatch(getEvents()) +}); + +class Livepeer extends React.Component { + state = { + redirectToHome: false, + }; + + constructor(props) { + super(props); + } + + componentDidMount() { + this.props.getQuotes(); + this.props.getBlockchainData(); + this.props.getEvents(); + } + + render() { + if (this.state.redirectToHome) { + return ; + } + + let lptPrice = 0; + let ethPrice = 0; + let lptPriceChange24h = 0; + let ethPriceChange24h = 0; + if (this.props.livepeer.quotes) { + if (this.props.livepeer.quotes.LPT) { + lptPrice = this.props.livepeer.quotes.LPT.price; + lptPriceChange24h = this.props.livepeer.quotes.LPT.percent_change_24h; + } + if (this.props.livepeer.quotes.ETH) { + ethPrice = this.props.livepeer.quotes.ETH.price; + ethPriceChange24h = this.props.livepeer.quotes.ETH.percent_change_24h; + } + } + + let blockchainTime = 0; + let l1Block = 0; + let l2Block = 0; + let l1GasFeeInGwei = 0; + let l2GasFeeInGwei = 0; + let redeemRewardCostL1 = 0; + let redeemRewardCostL2 = 0; + let claimTicketCostL1 = 0; + let claimTicketCostL2 = 0; + let withdrawFeeCostL1 = 0; + let withdrawFeeCostL2 = 0; + if (this.props.livepeer.blockchains) { + blockchainTime = this.props.livepeer.blockchains.timestamp; + l1GasFeeInGwei = this.props.livepeer.blockchains.l1GasFeeInGwei; + l2GasFeeInGwei = this.props.livepeer.blockchains.l2GasFeeInGwei; + redeemRewardCostL1 = this.props.livepeer.blockchains.redeemRewardCostL1; + redeemRewardCostL2 = this.props.livepeer.blockchains.redeemRewardCostL2; + claimTicketCostL1 = this.props.livepeer.blockchains.claimTicketCostL1; + claimTicketCostL2 = this.props.livepeer.blockchains.claimTicketCostL2; + withdrawFeeCostL1 = this.props.livepeer.blockchains.withdrawFeeCostL1; + withdrawFeeCostL2 = this.props.livepeer.blockchains.withdrawFeeCostL2; + l1Block = this.props.livepeer.blockchains.l1block; + l2Block = this.props.livepeer.blockchains.l2block; + } + + let redeemRewardCostL1USD; + let redeemRewardCostL2USD; + let claimTicketCostL1USD; + let claimTicketCostL2USD; + let withdrawFeeCostL1USD; + let withdrawFeeCostL2USD; + if (l1GasFeeInGwei && ethPrice) { + if (redeemRewardCostL1) { + redeemRewardCostL1USD = redeemRewardCostL1 * ethPrice; + } + if (claimTicketCostL1) { + claimTicketCostL1USD = claimTicketCostL1 * ethPrice; + } + if (withdrawFeeCostL1) { + withdrawFeeCostL1USD = withdrawFeeCostL1 * ethPrice; + } + } + if (l2GasFeeInGwei && ethPrice) { + if (redeemRewardCostL2) { + redeemRewardCostL2USD = redeemRewardCostL2 * ethPrice; + } + if (claimTicketCostL2) { + claimTicketCostL2USD = claimTicketCostL2 * ethPrice; + } + if (withdrawFeeCostL2) { + withdrawFeeCostL2USD = withdrawFeeCostL2 * ethPrice; + } + } + + let eventsList = []; + if (this.props.livepeer.events){ + eventsList = this.props.livepeer.events; + } + + return ( +
+
+ +
+
+
+ +
+
+ {eventsList.map((eventObj, idx) => { + console.log(eventObj); + // TODO: make something that groups shit as long as the eventObj.transactionUrl is the same + return + })} +
+
+
+
+
+
+ +
+

Price Info

+

Current LPT price: {lptPrice}

+

Current LPT price change: {lptPriceChange24h}%

+

Current ETH price: {ethPrice}

+

Current ETH price change: {ethPriceChange24h}%

+

Cost Info

+
Last updated @ {blockchainTime}
+

Current layer 1 gas fee in GWEI: {l1GasFeeInGwei}

+

Current layer 1 is at block: {l1Block}

+

Current layer 1 cost to redeem daily reward: {redeemRewardCostL1} eth = ${redeemRewardCostL1USD}

+

Current layer 1 cost to claim a winning ticket: {claimTicketCostL1} eth = ${claimTicketCostL1USD}

+

Current layer 1 cost to withdraw Eth fees: {withdrawFeeCostL1} eth = ${withdrawFeeCostL1USD}

+

Current layer 2 gas fee in GWEI: {l2GasFeeInGwei}

+

Current layer 2 is at block: {l2Block}

+

Current layer 2 cost to redeem daily reward: {redeemRewardCostL2} eth = ${redeemRewardCostL2USD}

+

Current layer 2 cost to claim a winning ticket: {claimTicketCostL2} eth = ${claimTicketCostL2USD}

+

Current layer 2 cost to withdraw Eth fees: {withdrawFeeCostL2} eth = ${withdrawFeeCostL2USD}

+
+
+
+
+
+
+ ); + } +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(Livepeer); diff --git a/src/loadingScreen.js b/src/loadingScreen.js new file mode 100644 index 0000000..9383a7f --- /dev/null +++ b/src/loadingScreen.js @@ -0,0 +1,35 @@ +import * as React from "react"; +import { connect } from "react-redux"; +import { + getVisitorStats +} from "./actions/user"; +import { login } from "./actions/session"; + +const mapStateToProps = (state) => { + return { + session: state.session, + userstate: state.userstate, + errors: state.errors + } +}; + +const mapDispatchToProps = dispatch => ({ + getVisitorStats: () => dispatch(getVisitorStats()), + login: () => dispatch(login()) +}); + + +class Startup extends React.Component { + componentDidMount() { + this.props.login(); + this.props.getVisitorStats(); + } + render() { + return this.props.children; + } +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(Startup); \ No newline at end of file diff --git a/src/reducers/errors/errors.js b/src/reducers/errors/errors.js new file mode 100644 index 0000000..d25a590 --- /dev/null +++ b/src/reducers/errors/errors.js @@ -0,0 +1,25 @@ +import { RECEIVE_CURRENT_USER } from "../../actions/session"; +import { CLEAR_ERRORS, RECEIVE_ERRORS, RECEIVE_NOTIFICATIONS } from "../../actions/error"; + +export default (state = [], { message, type }) => { + Object.freeze(state); + switch (type) { + case RECEIVE_ERRORS: + return [...state, { + title: "Foutmelding", + message: message, + } + ]; + case RECEIVE_NOTIFICATIONS: + return [...state, { + title: message.title, + message: message.message, + } + ]; + case RECEIVE_CURRENT_USER: + case CLEAR_ERRORS: + return []; + default: + return state; + } +}; \ No newline at end of file diff --git a/src/reducers/livepeer/livepeerstate.js b/src/reducers/livepeer/livepeerstate.js new file mode 100644 index 0000000..bb7d2e4 --- /dev/null +++ b/src/reducers/livepeer/livepeerstate.js @@ -0,0 +1,19 @@ +import { + RECEIVE_QUOTES, + RECEIVE_BLOCKCHAIN_DATA, + RECEIVE_EVENTS +} from "../../actions/livepeer"; + +export default (state = {}, { type, message }) => { + Object.freeze(state); + switch (type) { + case RECEIVE_QUOTES: + return { ...state, quotes: message }; + case RECEIVE_BLOCKCHAIN_DATA: + return { ...state, blockchains: message }; + case RECEIVE_EVENTS: + return { ...state, events: message }; + default: + return { ...state }; + } +}; diff --git a/src/reducers/root.js b/src/reducers/root.js new file mode 100644 index 0000000..b110ec9 --- /dev/null +++ b/src/reducers/root.js @@ -0,0 +1,13 @@ +import { combineReducers } from "redux"; +import errors from "./errors/errors"; +import session from "./session/session"; +import userstate from "./userstate/userstate"; +import livepeerstate from "./livepeer/livepeerstate"; +{/*Reducers define how the state of the application changes when actions are sent into the store. They take in the current state and the action that was performed. +This file combines all reducers in use so they are all accessible for redux*/} +export default combineReducers({ + session, + errors, + userstate, + livepeerstate +}); \ No newline at end of file diff --git a/src/reducers/session/session.js b/src/reducers/session/session.js new file mode 100644 index 0000000..e0e3b1c --- /dev/null +++ b/src/reducers/session/session.js @@ -0,0 +1,13 @@ +import { + RECEIVE_CURRENT_USER +} from "../../actions/session"; +const _nullSession = { userId: null, username: null, ip: null } +export default (state = _nullSession, { type, user }) => { + Object.freeze(state); + switch (type) { + case RECEIVE_CURRENT_USER: + return user; + default: + return state; + } +}; \ No newline at end of file diff --git a/src/reducers/userstate/userstate.js b/src/reducers/userstate/userstate.js new file mode 100644 index 0000000..02de3ef --- /dev/null +++ b/src/reducers/userstate/userstate.js @@ -0,0 +1,16 @@ +import { + RECEIVE_VISITOR_STATS, + RECEIVE_CURRENT_USER_VOTES +} from "../../actions/user"; + +export default (state = {}, { type, message }) => { + Object.freeze(state); + switch (type) { + case RECEIVE_VISITOR_STATS: + return { ...state, visitorStats: message}; + case RECEIVE_CURRENT_USER_VOTES: + return { ...state, currentVotes: message}; + default: + return { ...state }; + } +}; diff --git a/src/store/store.js b/src/store/store.js new file mode 100644 index 0000000..da4e3b8 --- /dev/null +++ b/src/store/store.js @@ -0,0 +1,18 @@ +import { createStore, applyMiddleware, compose } from "redux"; +import thunk from "redux-thunk"; +import reducer from "../reducers/root"; + + +function configureStore(preloadedState) { + const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; + const store = createStore(reducer, preloadedState, composeEnhancers( + applyMiddleware(thunk) + )); + + return store; +} + + +export default (preloadedState) => ( + configureStore(preloadedState) +); \ No newline at end of file diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..1d69f43 --- /dev/null +++ b/src/style.css @@ -0,0 +1,550 @@ +a:hover, a:visited, a:link, a:active{ + text-decoration: none; + color: rgba(0, 0, 0, 0.875); + text-align: center; + justify-content: center; + align-items: center; +} + +img { + margin: 5px; + -webkit-user-drag: none; +} + +body { + margin: 0 auto; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + background-image: url("/background.jpg"); + background-repeat: no-repeat center center fixed; + overflow-x: hidden; + overflow-y: auto; + user-select: none; +} + +code, pre{ + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} + +h2, h3, h1, h4, h5, h6 { + text-shadow: 0.5px 0.5px 0.8px #948dff; + color: #1a1b26; + cursor: default; + text-align: center; + justify-content: center; + align-items: center; + display: flex; + justify-content: space-evenly; +} + +a { + text-shadow: 0.5px 0.5px 0.8px #948dff; + color: #1a1b26; +} + +p { + text-shadow: 0.5px 0.5px 0.8px #948dff; + color: #1a1b26; + font-size: 1.2em; +} + +/* width */ +::-webkit-scrollbar { + width: 10px; + box-shadow: 0px 0px 8px 4px rgba(8, 7, 56, 0.692); + border-radius: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background-color: rgba(146, 144, 196, 0.9); + border-radius: 10px; +} + +/* Handle */ +::-webkit-scrollbar-thumb { + background-color: rgba(51, 50, 78, 0.9); + border-radius: 10px; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background-color: rgba(25, 25, 59, 0.9); +} + +#dvdlogo { + display: block; + position: absolute; + z-index: 1; + -webkit-animation: moveX 10s linear 0s infinite alternate, moveY 17s linear 0s infinite alternate, changeColour 30s, linear, 0s, infinite, normal, none, infinite; + -moz-animation: moveX 10s linear 0s infinite alternate, moveY 17s linear 0s infinite alternate, changeColour 30s, linear, 0s, infinite, normal, none, infinite; + -o-animation: moveX 10s linear 0s infinite alternate, moveY 17s linear 0s infinite alternate, changeColour 30s, linear, 0s, infinite, normal, none, infinite; + animation: moveX 10s linear 0s infinite alternate, moveY 17s linear 0s infinite alternate, changeColour 30s, linear, 0s, infinite, normal, none, infinite; + animation-iteration-count:infinite; +} +svg { + display: block; +} +@-webkit-keyframes moveX { + from { left: 0; } to { left: calc(100vw - 153px); } +} +@-moz-keyframes moveX { + from { left: 0; } to { left: calc(100vw - 153px); } +} +@-o-keyframes moveX { + from { left: 0; } to { left: calc(100vw - 153px); } +} +@keyframes moveX { + from { left: 0; } to { left: calc(100vw - 153px); } +} + +@keyframes changeColour { + 0% { fill: #ff6969; } + 14% { fill: #fd9644; } + 28% { fill: #fed330; } + 42% { fill: #2dc22d; } + 56% { fill: #45d8f2; } + 70% { fill: #5e6cea; } + 84% { fill: #c22dc2; } + 100% { fill: #ff6969; } +} + +@-webkit-keyframes moveY { + from { top: 0; } to { top: calc(100vh - 69px); } +} +@-moz-keyframes moveY { + from { top: 0; } to { top: calc(100vh - 69px); } +} +@-o-keyframes moveY { + from { top: 0; } to { top: calc(100vh - 69px); } +} +@keyframes moveY { + from { top: 0; } to { top: calc(100vh - 69px); } +} + +.serviceButton { + width: 100%; + margin: 0.4em; + margin-left: 2em; + margin-right: 2em; + text-decoration: none; + color: rgba(0, 0, 0, 0.875); + text-align: center; + justify-content: center; + align-items: center; +} + +.camBox { + display: flex; + text-align: center; + justify-content: center; + align-items: center; + justify-content: space-evenly; +} + +.cam { + display: flex; + width: 1920px; + height: 1080px; + align-self: center; + margin: auto; +} + +.fullGrafana { + width: 900px; +} +.halfGrafana { + width: 450px; +} + +.lightText { + color: rgba(162, 161, 255, 0.5); +} + +.hostinfo { + cursor: default; + text-align: start; + padding: 10px; + margin: 10px; + user-select: text; + margin-top: 0; + margin-bottom: 0; + font-size: x-small; + color: rgba(15, 15, 15, 0.8750); + background-color: rgba(255, 255, 255, 0.06); + -webkit-box-shadow: inset 3px 3px 12px 2px rgba(28, 28, 170, 0.2); + -moz-box-shadow: inset 3px 3px 12px 2px rgba(28, 28, 170, 0.2); + box-shadow: inset 3px 3px 12px 2px rgba(28, 28, 170, 0.2); +} + +.flexContainer { + box-sizing: border-box; + height: 100%; + padding: 0; + margin: auto; + display: flex; + align-items: flex-start; + justify-content: center; + flex-direction: row; + width: auto; +} + +.stroke { + box-sizing: border-box; + height: 100%; + padding-bottom: 20px; + padding-top: 20px; + margin: 10px; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + z-index: 2; +} + +.row { + box-sizing: border-box; + width: 100%; + text-align: center; + justify-content: center; + align-items: center; + display: flex; + justify-content: space-evenly; + vertical-align: middle; + margin-left: 10px; + margin-right: 10px; +} + +.flexItem { + padding: 5px; + width: 20px; + height: 20px; + margin: 10px; + line-height: 20px; + font-weight: bold; + font-size: 2em; + text-align: center; +} + +.waveButton { + min-width: 200px; + cursor: pointer; + margin-left: 12px; + margin-right: 12px; + margin-top: 8px; + margin-bottom: 8px; + padding: 8px; + border: 0; + border-radius: 5px; + background-color: rgba(163, 161, 255, 0.9); + box-shadow: 4px 5px 3px 2px rgba(8, 7, 56, 0.692); + text-align: center; + justify-content: center; + align-items: center; + display: flex; + justify-content: space-evenly; + z-index: 3; + backdrop-filter: blur(6px); +} +.waveButton:hover { + background-color: rgba(122, 121, 207, 0.9); +} +.waveButton:disabled { + cursor: default; + opacity: 0.7; +} + +.homeButton { + min-width: 200px; + cursor: pointer; + padding: 8px; + border: 0; + border-radius: 20px; + background-color: transparent; + text-align: center; + justify-content: center; + align-items: center; + display: flex; + justify-content: space-evenly; + z-index: 10; +} +.homeButton:hover { + box-shadow: 4px 5px 3px 2px rgba(8, 7, 56, 0.692); + backdrop-filter: blur(6px); +} +.homeButton:disabled { + cursor: default; + opacity: 0.7; +} + +.searchField { + margin: auto; + display: flex; + background-color: rgba(44, 96, 238, 0.199); + padding: 5px; + border-radius: 20px; + color:rgba(8, 7, 56, 0.747); +} +.searchField::placeholder { + color:rgba(8, 7, 56, 0.445); +} +.searchField:focus { + outline: none !important; + border:2px solid rgba(49, 13, 134, 0.459); + box-shadow: 0px 0px 3px 2px rgba(53, 118, 138, 0.8); +} + +.main-container { + height: calc(100vh - 40px); + display: flex; + flex-direction: column; +} + +.fixed-container { + height: 50px; + padding: 10px; + border-radius: 50px; + color: white; + text-align: center; + justify-content: center; + align-items: center; + display: flex; + justify-content: space-evenly; + vertical-align: middle; +} + +.content-wrapper { + display: flex; + flex: 1; + min-height: 0px; /* IMPORTANT: you need this for non-chrome browsers */ +} + +.overflow-container { + flex: 1; + overflow: auto; +} +.overflow-content { + color: black; + padding: 20px; +} + + +.noCursor { + cursor: default; +} + +.roundedOpaque { + background-color: rgba(180, 175, 252, 0.80); + box-shadow: 9px 13px 18px 8px rgba(8, 7, 56, 0.692); + border-radius: 30px; + box-sizing: border-box; + backdrop-filter: blur(6px); +} + +.mainContainer { + display: flex; + justify-content: center; + width: 100%; + margin-top: 64px; +} + +.dataContainer { + display: flex; + flex-direction: column; + justify-content: center; + max-width: 600px; +} + +.header { + text-align: center; + font-size: 32px; + font-weight: 600; +} + +.bio { + text-align: center; + color: black; + margin-top: 16px; +} + +.waveDiv { + text-align: center; + margin-top: 16px; + padding: 8px; + border: 0; + border-radius: 5px; +} + +.blockyBlockRoundedCornersWazzup{ + background-color: rgba(163, 161, 255, 0.9); + margin-top: 6px; + padding: 8px; + border-radius: 10px; +} + +.stilo { + -webkit-user-select: none; + background-color: hsl(0, 0%, 90%); + transition: background-color 300ms; + object-fit: cover; + width: 100%; +} + +.grid-item { + padding: 20px; + font-size: 30px; + text-align: center; +} + +.grid-container { + display: grid; + grid-template-columns: auto auto auto; + padding: 10px; + width: 100%; +} + +.showOnlyOnMobile { + visibility: hidden; + display:none; +} + +.showNeverOnMobile { + visibility: visible; + display:block; +} + +.mistvideo { + margin-top: 10px; + margin-bottom: 10px; + width: calc(50vw); + height: calc((9 / 16 ) * 50vw); + display: flex; + justify-content: center; + align-items: center; + align-content: center; + opacity: 0.95; +} + +.separator { + border:none; + border-top:25px dotted rgba(56, 19, 124, 0.6); + width: 30vw; + height: 10px; + margin: 0; +} + +.mistvideo-controls svg.mist.icon:hover .fill, +.mistvideo-controls svg.mist.icon:hover .semiFill, +.mistvideo-volume_container:hover .fill, +.mistvideo-volume_container:hover .semiFill { + fill: rgba(179, 14, 14, 0.875); +} +.mistvideo-controls svg.mist.icon:hover .stroke, +.mistvideo-volume_container:hover .stroke { + stroke: rgba(179, 14, 14, 0.875); +} + +.markdown { + padding: 50px; + width: 50vw; + z-index: 5; +} + +.markdown img { + align-self: center; + margin: auto; + width: 100%; +} + +.container { + position: relative; + text-align: center; +} + +.centered { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.alwaysOnBottom { + z-index: 0; + position: fixed; + left: 50%; + bottom: 0px; + transform: translate(-50%, 0); + margin: 0 auto; + user-select: none; +} +.alwaysOnBottomRight { + z-index: 0; + position: fixed; + right: 0; + bottom: 0px; + /* transform: translate(-50%, -50%); */ + margin: 0 auto; + user-select: none; +} + + + +@media (max-aspect-ratio: 1/1) { + .fullGrafana { + width: calc(100vw - 2em); + } + .halfGrafana { + width: calc(100vw - 2em); + } + .shrinkSize { + width: 50%; + } + .flexContainer { + height: 100%; + padding: 0; + margin: 0; + display: flex; + align-items: flex-start; + justify-content: center; + flex-direction: column; + } + .roundedOpaque { + background-color: none; + width: 100%; + box-shadow: none; + border-radius: 10px; + box-sizing: border-box; + } + .stroke { + margin-left: 0; + margin-right: 0; + } + .showOnlyOnMobile { + visibility: visible; + display:block; + } + .showNeverOnMobile { + visibility: hidden; + display:none; + } + .mistvideo { + width: calc(100vw - 20px); + height: calc((9 / 16 ) * (100vw - 20px)); + } + .mobileNoPadding { + padding: 0; + } + .main-container { + height: calc(100vh - 60px); + } + .markdown { + width: 80vw; + margin: 20px; + padding: 20px; + } +} \ No newline at end of file diff --git a/src/util/livepeer.js b/src/util/livepeer.js new file mode 100644 index 0000000..0ee325e --- /dev/null +++ b/src/util/livepeer.js @@ -0,0 +1,28 @@ + + +export const getQuotes = () => ( + fetch("api/livepeer/quotes", { + method: "GET", + headers: { + "Content-Type": "application/json" + } + }) +); + +export const getBlockchainData = () => ( + fetch("api/livepeer/blockchains", { + method: "GET", + headers: { + "Content-Type": "application/json" + } + }) +); + +export const getEvents = () => ( + fetch("api/livepeer/getEvents", { + method: "GET", + headers: { + "Content-Type": "application/json" + } + }) +); \ No newline at end of file diff --git a/src/util/session.js b/src/util/session.js new file mode 100644 index 0000000..8fc9a98 --- /dev/null +++ b/src/util/session.js @@ -0,0 +1,35 @@ +export const login = user => ( + fetch("api/session", { + method: "POST", + body: JSON.stringify(user), + headers: { + "Content-Type": "application/json" + } + }) +); + +export const signup = user => ( + fetch("api/users", { + method: "POST", + body: JSON.stringify(user), + headers: { + "Content-Type": "application/json" + } + }) +); + +export const logout = () => ( + fetch("api/session", { method: "DELETE" }) +); + +export const checkLoggedIn = async () => { + const response = await fetch('/api/session'); + const { user } = await response.json(); + let preloadedState = {}; + if (user) { + preloadedState = { + session: user + }; + } + return preloadedState; +}; diff --git a/src/util/user.js b/src/util/user.js new file mode 100644 index 0000000..ce1d0dc --- /dev/null +++ b/src/util/user.js @@ -0,0 +1,40 @@ + + +export const getVisitorStats = () => ( + fetch("api/users/getVisitorStats", { + method: "POST", + headers: { + "Content-Type": "application/json" + } + }) +); + +export const getCurrentUserVotes = () => ( + fetch("api/users/getCurrentUserVotes", { + method: "POST", + headers: { + "Content-Type": "application/json" + } + }) +); + +export const getScoreByTimelapeFilename = (fullFilename) => ( + fetch("api/users/getScoreByTimelapeFilename", { + method: "POST", + body: JSON.stringify({ fullFilename }), + headers: { + "Content-Type": "application/json" + } + }) +); + +export const setVoteOnTimelapse = (voteValue, fullFilename) => ( + fetch("api/users/setVoteOnTimelapse", { + method: "POST", + body: JSON.stringify({ voteValue, fullFilename }), + headers: { + "Content-Type": "application/json" + } + }) +); +