{"file_path":"src/USG/Tokens/USG.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport {IUSG} from \"../../interfaces/internals/USG/IUSG.sol\";\nimport {IControlTower} from \"../../interfaces/internals/USG/IControlTower.sol\";\nimport {LightOwnable} from \"../../USG/Utilities/abstract/LightOwnable.sol\";\n\n/// @title Tangent USG\n/// @author Tangent Finance\n/// @notice Locking NFT contract of TAN.\ncontract USG is ERC20, IUSG, LightOwnable {\n    IControlTower public controlTower;\n\n    mapping(address => bool) public isMinter;\n\n    mapping(address => bool) public isBurner;\n\n    mapping(address => bool) public isIRProducer;\n\n    mapping(address => bool) public isPegKeeper;\n\n    error OnlyMinterCaller();\n    error OnlyBurnerCaller();\n    error OnlyIRProducer();\n    error OnlyMarketCreator();\n    error MintOnlyOnPegKeeper();\n    error BurnOnlyFromPegKeeper();\n\n    event SetIsMinter(address minter, bool isMinter);\n    event SetIsBurner(address burner, bool isBurner);\n    event SetIsIRProducer(address irProducer, bool isIRProducer);\n    event SetIsPegKeeper(address pegKeeper, bool isPegKeeper);\n\n    /**\n     * @notice Constructor of USG\n     * @param _dao           Address of the DAO that becomes the owner of the contract\n     * @param _controlTower Address of the control tower\n     */\n    constructor(address _dao, IControlTower _controlTower) ERC20(\"Tangent USD\", \"USG\") {\n        owner = _dao;\n        controlTower = _controlTower;\n    }\n\n    /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\n                        MINT\n    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= */\n\n    /**\n     * @notice Markets call this function to mint USG when users borrow.\n     * @param to     Receiver of the USG\n     * @param amount Amount of USG borrowed to mint\n     */\n    function mintDebt(address to, uint256 amount) external {\n        require(isMinter[msg.sender], OnlyMinterCaller());\n        _mint(to, amount);\n    }\n\n    /**\n     * @notice IRCalculator call this function to mint USG inflated through interests.\n     * @dev    Only callable by an ir producer\n     * @param amount Amount of USG produced by interest rate since last mint on the\n     */\n    function mintIR(uint256 amount) external {\n        require(isIRProducer[msg.sender], OnlyIRProducer());\n        _mint(controlTower.feeTreasury(), amount);\n    }\n\n    /**\n     * @notice Mints USG on a pegKeeper to be able to provide LP in USG in case USG is overpeg.\n     * @dev    Only callable by the DAO.\n     * @param pegKeeper PegKeeper address to mint USG on\n     * @param amount    Amount of USG to mint on the pegKeeper\n     */\n    function mintPegKeeper(address pegKeeper, uint256 amount) external onlyOwner {\n        require(isPegKeeper[pegKeeper], MintOnlyOnPegKeeper());\n        _mint(pegKeeper, amount);\n    }\n\n    /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\n                        BURN\n    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= */\n\n    /**\n     * @notice Markets call this function to burn USG when users repay their loans.\n     * @param from    Address to burn the USG from\n     * @param amount  Amount of USG to burn from the address\n     */\n    function burnDebt(address from, uint256 amount) external {\n        require(isBurner[msg.sender], OnlyBurnerCaller());\n        _burn(from, amount);\n    }\n\n    /**\n     * @notice Burn USG from a pegKeeper if we deprecate a pegkeeper or want to reduce debt to be allocated to peg keeping\n     * @dev    Only callable by the DAO.\n     * @param pegKeeper PegKeeper address to burn USG from\n     * @param amount    Amount of USG to burn from the pegKeeper\n     */\n    function burnPegKeeper(address pegKeeper, uint256 amount) external onlyOwner {\n        require(isPegKeeper[pegKeeper], BurnOnlyFromPegKeeper());\n        _burn(pegKeeper, amount);\n    }\n\n    /**\n     * @notice Burns USG of the caller\n     * @dev    Callable by anyone that have USG.\n     * @param amount Amount of USG to burn from the caller\n     */\n    function burn(uint256 amount) external {\n        _burn(msg.sender, amount);\n    }\n\n    /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\n                        SETTERS\n    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= */\n\n    /**\n     *  @notice Called by a Market Creator to set a new market as minter and burner\n     *  @param  market  Address set as minter and burner\n     */\n    function initializeMarket(address market) external {\n        require(controlTower.isMarketCreator(msg.sender), OnlyMarketCreator());\n        isMinter[market] = true;\n        isBurner[market] = true;\n    }\n\n    /**\n     * @notice Adds or removes an address from the minter role.\n     * @dev Updates the `isMinter` mapping. Callable only by the contract owner.\n     * @param minter    The address whose minter status will be updated.\n     * @param _isMinter `true` to assign the minter role, `false` to revoke it.\n     */\n    function setIsMinter(address minter, bool _isMinter) external onlyOwner {\n        isMinter[minter] = _isMinter;\n        emit SetIsMinter(minter, _isMinter);\n    }\n\n    /**\n     * @notice Adds or removes an address from the burner role.\n     * @dev Updates the `isBurner` mapping. Callable only by the contract owner.\n     * @param burner    The address whose burner status will be updated.\n     * @param _isBurner `true` to assign the burner role, `false` to revoke it.\n     */\n    function setIsBurner(address burner, bool _isBurner) external onlyOwner {\n        isBurner[burner] = _isBurner;\n        emit SetIsBurner(burner, _isBurner);\n    }\n\n    /**\n     * @notice Adds or removes an address from the ir producer role.\n     * @dev Updates the `isIRProducer` mapping. Callable only by the contract owner.\n     * @param irProducer    The address whose ir Producer status will be updated.\n     * @param _isIRProducer `true` to assign the ir producer role, `false` to revoke it.\n     */\n    function setIsIRProducer(address irProducer, bool _isIRProducer) external onlyOwner {\n        isIRProducer[irProducer] = _isIRProducer;\n        emit SetIsIRProducer(irProducer, _isIRProducer);\n    }\n\n    /**\n     * @notice Adds or removes an address from the peg keeper role.\n     * @dev Updates the `isPegKeeper` mapping. Callable only by the contract owner.\n     * @param pegKeeper    The address whose peg keeper status will be updated.\n     * @param _isPegKeeper `true` to assign the peg keeper role, `false` to revoke it.\n     */\n    function setIsPegKeeper(address pegKeeper, bool _isPegKeeper) external onlyOwner {\n        isPegKeeper[pegKeeper] = _isPegKeeper;\n        emit SetIsPegKeeper(pegKeeper, _isPegKeeper);\n    }\n}\n","deployed_bytecode":"0x608060405234801561000f575f5ffd5b50600436106101b0575f3560e01c80638da5cb5b116100f3578063bea688c311610093578063dd62ed3e1161006e578063dd62ed3e14610404578063e3fef41a14610449578063e9734c121461046b578063f2fde38b1461047e575f5ffd5b8063bea688c3146103bc578063c4f654de146103cf578063cc13de9c146103f1575f5ffd5b80639d0bee03116100ce5780639d0bee0314610361578063a9059cbb14610374578063aa271e1a14610387578063b2080e95146103a9575f5ffd5b80638da5cb5b14610326578063936474cc1461034657806395d89b4114610359575f5ffd5b8063313ce5671161015e57806346bf079b1161013957806346bf079b146102b857806366eb399f146102cb57806370a08231146102de57806382112b4f14610313575f5ffd5b8063313ce5671461027457806342966c68146102835780634334614a14610296575f5ffd5b806318160ddd1161018e57806318160ddd1461023a57806323b872dd1461024c5780632a869a4d1461025f575f5ffd5b806306fdde03146101b4578063095ea7b3146101d25780630975bb7e146101f5575b5f5ffd5b6101bc610491565b6040516101c991906111a0565b60405180910390f35b6101e56101e0366004611214565b610521565b60405190151581526020016101c9565b6006546102159073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101c9565b6002545b6040519081526020016101c9565b6101e561025a36600461123e565b61053a565b61027261026d36600461127c565b61055d565b005b604051601281526020016101c9565b61027261029136600461129e565b610689565b6101e56102a436600461127c565b60086020525f908152604090205460ff1681565b6102726102c63660046112c2565b610696565b6102726102d93660046112c2565b61072c565b61023e6102ec36600461127c565b73ffffffffffffffffffffffffffffffffffffffff165f9081526020819052604090205490565b610272610321366004611214565b6107ba565b6005546102159073ffffffffffffffffffffffffffffffffffffffff1681565b610272610354366004611214565b61082e565b6101bc610876565b61027261036f366004611214565b610885565b6101e5610382366004611214565b6108d7565b6101e561039536600461127c565b60076020525f908152604090205460ff1681565b6102726103b73660046112c2565b6108e4565b6102726103ca366004611214565b610972565b6101e56103dd36600461127c565b600a6020525f908152604090205460ff1681565b6102726103ff3660046112c2565b6109d8565b61023e6104123660046112f9565b73ffffffffffffffffffffffffffffffffffffffff9182165f90815260016020908152604080832093909416825291909152205490565b6101e561045736600461127c565b60096020525f908152604090205460ff1681565b61027261047936600461129e565b610a66565b61027261048c36600461127c565b610b47565b6060600380546104a090611325565b80601f01602080910402602001604051908101604052809291908181526020018280546104cc90611325565b80156105175780601f106104ee57610100808354040283529160200191610517565b820191905f5260205f20905b8154815290600101906020018083116104fa57829003601f168201915b5050505050905090565b5f3361052e818585610bac565b60019150505b92915050565b5f33610547858285610bbe565b610552858585610c8c565b506001949350505050565b6006546040517ff97b7a3b00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063f97b7a3b90602401602060405180830381865afa1580156105c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ed9190611376565b610623576040517f38993a4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff165f908152600760209081526040808320805460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091821681179092556008909352922080549091169091179055565b6106933382610d35565b50565b61069e610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f818152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f504f1a49576a537f885e54bf1895e37ee914ea4b69f74d358470af30755b281891015b60405180910390a15050565b610734610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f60475603ebaf63fcfd229e007ed76eadd15ccbdede7e79bac0655826a91229369101610720565b6107c2610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f908152600a602052604090205460ff16610820576040517f2583ce0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61082a8282610d35565b5050565b335f9081526008602052604090205460ff16610820576040517f4c606fda00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060600480546104a090611325565b335f9081526007602052604090205460ff166108cd576040517f868c71f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61082a8282610de4565b5f3361052e818585610c8c565b6108ec610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f8f28e0c96d86fa612e88ee0cf2f691757404c42d885120dd814919ea80db96609101610720565b61097a610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f908152600a602052604090205460ff166108cd576040517f97b9760400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109e0610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526009602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f1cdf9da3d1ef2de401a96539c7c841dd5468148c7a4d1627b3a5c39ad3ac90e29101610720565b335f9081526009602052604090205460ff16610aae576040517f621f678000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600654604080517f60dc234000000000000000000000000000000000000000000000000000000000815290516106939273ffffffffffffffffffffffffffffffffffffffff16916360dc23409160048083019260209291908290030181865afa158015610b1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b419190611391565b82610de4565b610b4f610d8f565b73ffffffffffffffffffffffffffffffffffffffff8116610ba3576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b61069381610e3e565b610bb98383836001610eb4565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610c865781811015610c78576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024810182905260448101839052606401610b9a565b610c8684848484035f610eb4565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610cdb576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8216610d2a576040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b610bb9838383610ff9565b73ffffffffffffffffffffffffffffffffffffffff8216610d84576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b61082a825f83610ff9565b60055473ffffffffffffffffffffffffffffffffffffffff163314610de2576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610b9a565b565b73ffffffffffffffffffffffffffffffffffffffff8216610e33576040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b61082a5f8383610ff9565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b73ffffffffffffffffffffffffffffffffffffffff8416610f03576040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8316610f52576040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8085165f9081526001602090815260408083209387168352929052208290558015610c86578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610feb91815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff8316611030578060025f82825461102591906113ac565b909155506110e09050565b73ffffffffffffffffffffffffffffffffffffffff83165f90815260208190526040902054818110156110b5576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024810182905260448101839052606401610b9a565b73ffffffffffffffffffffffffffffffffffffffff84165f9081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff821661110957600280548290039055611134565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161119391815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b73ffffffffffffffffffffffffffffffffffffffff81168114610693575f5ffd5b5f5f60408385031215611225575f5ffd5b8235611230816111f3565b946020939093013593505050565b5f5f5f60608486031215611250575f5ffd5b833561125b816111f3565b9250602084013561126b816111f3565b929592945050506040919091013590565b5f6020828403121561128c575f5ffd5b8135611297816111f3565b9392505050565b5f602082840312156112ae575f5ffd5b5035919050565b8015158114610693575f5ffd5b5f5f604083850312156112d3575f5ffd5b82356112de816111f3565b915060208301356112ee816112b5565b809150509250929050565b5f5f6040838503121561130a575f5ffd5b8235611315816111f3565b915060208301356112ee816111f3565b600181811c9082168061133957607f821691505b602082108103611370577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f60208284031215611386575f5ffd5b8151611297816112b5565b5f602082840312156113a1575f5ffd5b8151611297816111f3565b80820180821115610534577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffdfea2646970667358221220b5418256195e6b1307342d24590c1035dc39edb1c7e6a3eea3cce84df01d46b064736f6c634300081c0033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"cancun","libraries":{},"optimizer":{"enabled":true,"runs":1000000},"outputSelection":{"*":{"":["*"],"*":["*"]}}},"optimization_runs":1000000,"sourcify_repo_url":null,"decoded_constructor_args":[["0x461B62CB3A7e9Df8f800aE058AE92F855F2c27Ca",{"internalType":"address","name":"_dao","type":"address"}],["0xF3f7669dcEED2f985815011C19eD68F667267215",{"internalType":"contract IControlTower","name":"_controlTower","type":"address"}]],"compiler_version":"v0.8.28+commit.7893614a","is_verified_via_verifier_alliance":false,"verified_at":"2026-05-11T16:18:35.468691Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x608060405234801561000f575f5ffd5b5060405161168a38038061168a83398101604081905261002e916100d9565b6040518060400160405280600b81526020016a15185b99d95b9d081554d160aa1b8152506040518060400160405280600381526020016255534760e81b815250816003908161007d91906101a9565b50600461008a82826101a9565b5050600580546001600160a01b039485166001600160a01b031991821617909155600680549390941692169190911790915550610263565b6001600160a01b03811681146100d6575f5ffd5b50565b5f5f604083850312156100ea575f5ffd5b82516100f5816100c2565b6020840151909250610106816100c2565b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061013957607f821691505b60208210810361015757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156101a457805f5260205f20601f840160051c810160208510156101825750805b601f840160051c820191505b818110156101a1575f815560010161018e565b50505b505050565b81516001600160401b038111156101c2576101c2610111565b6101d6816101d08454610125565b8461015d565b6020601f821160018114610208575f83156101f15750848201515b5f19600385901b1c1916600184901b1784556101a1565b5f84815260208120601f198516915b828110156102375787850151825560209485019460019092019101610217565b508482101561025457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b61141a806102705f395ff3fe608060405234801561000f575f5ffd5b50600436106101b0575f3560e01c80638da5cb5b116100f3578063bea688c311610093578063dd62ed3e1161006e578063dd62ed3e14610404578063e3fef41a14610449578063e9734c121461046b578063f2fde38b1461047e575f5ffd5b8063bea688c3146103bc578063c4f654de146103cf578063cc13de9c146103f1575f5ffd5b80639d0bee03116100ce5780639d0bee0314610361578063a9059cbb14610374578063aa271e1a14610387578063b2080e95146103a9575f5ffd5b80638da5cb5b14610326578063936474cc1461034657806395d89b4114610359575f5ffd5b8063313ce5671161015e57806346bf079b1161013957806346bf079b146102b857806366eb399f146102cb57806370a08231146102de57806382112b4f14610313575f5ffd5b8063313ce5671461027457806342966c68146102835780634334614a14610296575f5ffd5b806318160ddd1161018e57806318160ddd1461023a57806323b872dd1461024c5780632a869a4d1461025f575f5ffd5b806306fdde03146101b4578063095ea7b3146101d25780630975bb7e146101f5575b5f5ffd5b6101bc610491565b6040516101c991906111a0565b60405180910390f35b6101e56101e0366004611214565b610521565b60405190151581526020016101c9565b6006546102159073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101c9565b6002545b6040519081526020016101c9565b6101e561025a36600461123e565b61053a565b61027261026d36600461127c565b61055d565b005b604051601281526020016101c9565b61027261029136600461129e565b610689565b6101e56102a436600461127c565b60086020525f908152604090205460ff1681565b6102726102c63660046112c2565b610696565b6102726102d93660046112c2565b61072c565b61023e6102ec36600461127c565b73ffffffffffffffffffffffffffffffffffffffff165f9081526020819052604090205490565b610272610321366004611214565b6107ba565b6005546102159073ffffffffffffffffffffffffffffffffffffffff1681565b610272610354366004611214565b61082e565b6101bc610876565b61027261036f366004611214565b610885565b6101e5610382366004611214565b6108d7565b6101e561039536600461127c565b60076020525f908152604090205460ff1681565b6102726103b73660046112c2565b6108e4565b6102726103ca366004611214565b610972565b6101e56103dd36600461127c565b600a6020525f908152604090205460ff1681565b6102726103ff3660046112c2565b6109d8565b61023e6104123660046112f9565b73ffffffffffffffffffffffffffffffffffffffff9182165f90815260016020908152604080832093909416825291909152205490565b6101e561045736600461127c565b60096020525f908152604090205460ff1681565b61027261047936600461129e565b610a66565b61027261048c36600461127c565b610b47565b6060600380546104a090611325565b80601f01602080910402602001604051908101604052809291908181526020018280546104cc90611325565b80156105175780601f106104ee57610100808354040283529160200191610517565b820191905f5260205f20905b8154815290600101906020018083116104fa57829003601f168201915b5050505050905090565b5f3361052e818585610bac565b60019150505b92915050565b5f33610547858285610bbe565b610552858585610c8c565b506001949350505050565b6006546040517ff97b7a3b00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063f97b7a3b90602401602060405180830381865afa1580156105c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ed9190611376565b610623576040517f38993a4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff165f908152600760209081526040808320805460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091821681179092556008909352922080549091169091179055565b6106933382610d35565b50565b61069e610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f818152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f504f1a49576a537f885e54bf1895e37ee914ea4b69f74d358470af30755b281891015b60405180910390a15050565b610734610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f60475603ebaf63fcfd229e007ed76eadd15ccbdede7e79bac0655826a91229369101610720565b6107c2610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f908152600a602052604090205460ff16610820576040517f2583ce0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61082a8282610d35565b5050565b335f9081526008602052604090205460ff16610820576040517f4c606fda00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060600480546104a090611325565b335f9081526007602052604090205460ff166108cd576040517f868c71f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61082a8282610de4565b5f3361052e818585610c8c565b6108ec610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f8f28e0c96d86fa612e88ee0cf2f691757404c42d885120dd814919ea80db96609101610720565b61097a610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f908152600a602052604090205460ff166108cd576040517f97b9760400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109e0610d8f565b73ffffffffffffffffffffffffffffffffffffffff82165f8181526009602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f1cdf9da3d1ef2de401a96539c7c841dd5468148c7a4d1627b3a5c39ad3ac90e29101610720565b335f9081526009602052604090205460ff16610aae576040517f621f678000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600654604080517f60dc234000000000000000000000000000000000000000000000000000000000815290516106939273ffffffffffffffffffffffffffffffffffffffff16916360dc23409160048083019260209291908290030181865afa158015610b1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b419190611391565b82610de4565b610b4f610d8f565b73ffffffffffffffffffffffffffffffffffffffff8116610ba3576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b61069381610e3e565b610bb98383836001610eb4565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610c865781811015610c78576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024810182905260448101839052606401610b9a565b610c8684848484035f610eb4565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610cdb576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8216610d2a576040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b610bb9838383610ff9565b73ffffffffffffffffffffffffffffffffffffffff8216610d84576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b61082a825f83610ff9565b60055473ffffffffffffffffffffffffffffffffffffffff163314610de2576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610b9a565b565b73ffffffffffffffffffffffffffffffffffffffff8216610e33576040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b61082a5f8383610ff9565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b73ffffffffffffffffffffffffffffffffffffffff8416610f03576040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8316610f52576040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152602401610b9a565b73ffffffffffffffffffffffffffffffffffffffff8085165f9081526001602090815260408083209387168352929052208290558015610c86578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610feb91815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff8316611030578060025f82825461102591906113ac565b909155506110e09050565b73ffffffffffffffffffffffffffffffffffffffff83165f90815260208190526040902054818110156110b5576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024810182905260448101839052606401610b9a565b73ffffffffffffffffffffffffffffffffffffffff84165f9081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff821661110957600280548290039055611134565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161119391815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b73ffffffffffffffffffffffffffffffffffffffff81168114610693575f5ffd5b5f5f60408385031215611225575f5ffd5b8235611230816111f3565b946020939093013593505050565b5f5f5f60608486031215611250575f5ffd5b833561125b816111f3565b9250602084013561126b816111f3565b929592945050506040919091013590565b5f6020828403121561128c575f5ffd5b8135611297816111f3565b9392505050565b5f602082840312156112ae575f5ffd5b5035919050565b8015158114610693575f5ffd5b5f5f604083850312156112d3575f5ffd5b82356112de816111f3565b915060208301356112ee816112b5565b809150509250929050565b5f5f6040838503121561130a575f5ffd5b8235611315816111f3565b915060208301356112ee816111f3565b600181811c9082168061133957607f821691505b602082108103611370577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f60208284031215611386575f5ffd5b8151611297816112b5565b5f602082840312156113a1575f5ffd5b8151611297816111f3565b80820180821115610534577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffdfea2646970667358221220b5418256195e6b1307342d24590c1035dc39edb1c7e6a3eea3cce84df01d46b064736f6c634300081c0033000000000000000000000000461b62cb3a7e9df8f800ae058ae92f855f2c27ca000000000000000000000000f3f7669dceed2f985815011c19ed68f667267215","name":"USG","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":false,"language":"solidity","evm_version":"cancun","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"@openzeppelin/contracts/interfaces/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},{"file_path":"src/interfaces/internals/USG/IIRCalculator.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nstruct IRParams {\n    /// @dev Flag to determine if a Market is HEC or LEC\n    bool isHEC;\n    /// @dev Minimum IR reached at pMax.\n    ///      1_000 <=> 1% / 100_000 <=> 100%.\n    uint24 rMin;\n    /// @dev Maximum IR reached at pMin.\n    ///      1_000 <=> 1% / 100_000 <=> 100%.\n    uint32 rMax;\n    /// @dev Minimum price of USG where rMax is reached.\n    ///      980_000 <=> 0.98$ / 1_000_000 <=> 1$\n    uint32 pMin;\n    /// @dev Inflexion price of USG where IR starts to increases more significantly.\n    ///      980_000 <=> 0.98$ / 1_000_000 <=> 1$\n    uint32 pInf;\n    /// @dev Maximum price of USG where IR increases more significantly.\n    ///      980_000 <=> 0.98$ / 1_000_000 <=> 1$\n    uint32 pMax;\n    /// @dev Convexity of the curve before pInf\n    ///      2_000 <=> 2 / 4_500 <=> 4.5\n    uint32 a1;\n    /// @dev Convexity of the curve after pInf\n    ///      2_000 <=> 2 / 4_500 <=> 4.5\n    uint32 a2;\n    /// @dev Velocity of the transition between a1 and a2\n    ///      It's an integer. 250 <=> 250\n    uint32 k;\n}\n\nstruct IRCheckpoint {\n    uint216 ir;\n    uint40 timestamp;\n}\ninterface IIRCalculator {\n    function initializeMarket(address market, IRParams calldata _irParam) external;\n\n    function simulateIR(uint256 USGPrice, IRParams memory irParam) external view returns (uint256);\n\n    function computeIRForMarket(address market) external returns (uint256);\n\n    function checkpointIR(address market) external returns (uint256);\n\n    function newDebtIndex(address market) external view returns (uint256);\n\n    function irCheckpoints(address market) external view returns (uint216, uint40);\n\n    function debtIndexes(address market) external view returns (uint256);\n\n    function indexDelta(address market) external view returns (uint256);\n\n    function mintableInterests() external view returns (uint256);\n\n    function getIRParams(address market) external view returns (IRParams memory);\n\n    function getIRCheckpoint(address market) external view returns (IRCheckpoint memory);\n}\n"},{"file_path":"src/interfaces/internals/USG/IUSG.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\ninterface IUSG is IERC20 {\n    function mintDebt(address to, uint256 amount) external;\n\n    function burnDebt(address from, uint256 amount) external;\n\n    function mintIR(uint256 amount) external;\n\n    function initializeMarket(address market) external;\n}\n"},{"file_path":"@openzeppelin/contracts/interfaces/draft-IERC6093.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/ERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     *\n     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance < type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\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    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) 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 a `value` amount of tokens as the allowance of `spender` over the\n     * 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 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` 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(address from, address to, uint256 value) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},{"file_path":"src/USG/Utilities/abstract/LightOwnable.sol","source_code":"// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nabstract contract LightOwnable {\n    address public owner;\n\n    error OwnableUnauthorizedAccount(address account);\n\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner != msg.sender) {\n            revert OwnableUnauthorizedAccount(msg.sender);\n        }\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = owner;\n        owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"src/interfaces/internals/USG/IControlTower.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {IERC20, IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport {IDebtIR} from \"./IDebtIR.sol\";\n\ninterface IControlTower {\n    function isMarketCreator(address marketCreator) external view returns (bool);\n\n    function isPositionMigrator(address migrator) external view returns (bool);\n\n    function isPauser(address pauser) external view returns (bool);\n\n    function feeTreasury() external view returns (address);\n}\n"},{"file_path":"src/interfaces/internals/USG/IDebtIR.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {IIRCalculator} from \"./IIRCalculator.sol\";\n\ninterface IDebtIR {\n    function maxMarketDebt() external view returns (uint256);\n    function irCalculator() external view returns (IIRCalculator);\n    function minimumLoan() external view returns (uint256);\n    function userDebtShares(address user) external view returns (uint256);\n    function totalDebtShares() external view returns (uint256);\n    function badDebt() external view returns (uint256);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"contract IControlTower","name":"_controlTower","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BurnOnlyFromPegKeeper","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"MintOnlyOnPegKeeper","type":"error"},{"inputs":[],"name":"OnlyBurnerCaller","type":"error"},{"inputs":[],"name":"OnlyIRProducer","type":"error"},{"inputs":[],"name":"OnlyMarketCreator","type":"error"},{"inputs":[],"name":"OnlyMinterCaller","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"burner","type":"address"},{"indexed":false,"internalType":"bool","name":"isBurner","type":"bool"}],"name":"SetIsBurner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"irProducer","type":"address"},{"indexed":false,"internalType":"bool","name":"isIRProducer","type":"bool"}],"name":"SetIsIRProducer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"bool","name":"isMinter","type":"bool"}],"name":"SetIsMinter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pegKeeper","type":"address"},{"indexed":false,"internalType":"bool","name":"isPegKeeper","type":"bool"}],"name":"SetIsPegKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pegKeeper","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnPegKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controlTower","outputs":[{"internalType":"contract IControlTower","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"initializeMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBurner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isIRProducer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isPegKeeper","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintIR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pegKeeper","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintPegKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"burner","type":"address"},{"internalType":"bool","name":"_isBurner","type":"bool"}],"name":"setIsBurner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"irProducer","type":"address"},{"internalType":"bool","name":"_isIRProducer","type":"bool"}],"name":"setIsIRProducer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"_isMinter","type":"bool"}],"name":"setIsMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pegKeeper","type":"address"},{"internalType":"bool","name":"_isPegKeeper","type":"bool"}],"name":"setIsPegKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x000000000000000000000000461b62cb3a7e9df8f800ae058ae92f855f2c27ca000000000000000000000000f3f7669dceed2f985815011c19ed68f667267215"}