From 63706f7d2ec9f1e56d875ee941f925b4b5994dd6 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Mon, 10 Feb 2025 18:59:00 +0000 Subject: [PATCH 1/3] feat: Buy Back Burner set of contracts and Oracles --- abis/0.8.28/BalancerPriceOracle.json | 231 +++++++++++ abis/0.8.28/BuyBackBurnerBalancer.json | 388 ++++++++++++++++++ abis/0.8.28/BuyBackBurnerProxy.json | 72 ++++ abis/0.8.28/BuyBackBurnerUniswap.json | 375 +++++++++++++++++ abis/0.8.28/UniswapPriceOracle.json | 116 ++++++ contracts/interfaces/IUniswapV3.sol | 118 ++++++ contracts/libraries/TickMath.sol | 214 ++++++++++ contracts/oracles/BalancerPriceOracle.sol | 157 +++++++ contracts/oracles/UniswapPriceOracle.sol | 92 +++++ contracts/utils/BuyBackBurner.sol | 281 +++++++++++++ contracts/utils/BuyBackBurnerBalancer.sol | 75 ++++ contracts/utils/BuyBackBurnerProxy.sol | 75 ++++ contracts/utils/BuyBackBurnerUniswap.sol | 62 +++ .../deploy_01_balancer_price_oracle.js | 77 ++++ .../oracles/deploy_02_uniswap_price_oracle.js | 77 ++++ .../oracles/globals_base_mainnet.json | 1 + .../oracles/globals_gnosis_mainnet.json | 1 + .../verify_01_balancer_price_oracle.js | 13 + .../oracles/verify_02_uniswap_price_oracle.js | 11 + .../deploy_01_buy_back_burner_balancer.js | 75 ++++ .../deploy_02_buy_back_burner_uniswap.js | 75 ++++ ...eploy_03_buy_back_burner_balancer_proxy.js | 83 ++++ ...deploy_04_buy_back_burner_uniswap_proxy.js | 84 ++++ .../utils/globals_base_mainnet.json | 1 + .../utils/globals_gnosis_mainnet.json | 1 + ...erify_03_buy_back_burner_balancer_proxy.js | 16 + ...verify_04_buy_back_burner_uniswap_proxy.js | 17 + 27 files changed, 2788 insertions(+) create mode 100644 abis/0.8.28/BalancerPriceOracle.json create mode 100644 abis/0.8.28/BuyBackBurnerBalancer.json create mode 100644 abis/0.8.28/BuyBackBurnerProxy.json create mode 100644 abis/0.8.28/BuyBackBurnerUniswap.json create mode 100644 abis/0.8.28/UniswapPriceOracle.json create mode 100644 contracts/interfaces/IUniswapV3.sol create mode 100644 contracts/libraries/TickMath.sol create mode 100644 contracts/oracles/BalancerPriceOracle.sol create mode 100644 contracts/oracles/UniswapPriceOracle.sol create mode 100644 contracts/utils/BuyBackBurner.sol create mode 100644 contracts/utils/BuyBackBurnerBalancer.sol create mode 100644 contracts/utils/BuyBackBurnerProxy.sol create mode 100644 contracts/utils/BuyBackBurnerUniswap.sol create mode 100644 scripts/deployment/oracles/deploy_01_balancer_price_oracle.js create mode 100644 scripts/deployment/oracles/deploy_02_uniswap_price_oracle.js create mode 100644 scripts/deployment/oracles/globals_base_mainnet.json create mode 100644 scripts/deployment/oracles/globals_gnosis_mainnet.json create mode 100644 scripts/deployment/oracles/verify_01_balancer_price_oracle.js create mode 100644 scripts/deployment/oracles/verify_02_uniswap_price_oracle.js create mode 100644 scripts/deployment/utils/deploy_01_buy_back_burner_balancer.js create mode 100644 scripts/deployment/utils/deploy_02_buy_back_burner_uniswap.js create mode 100644 scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js create mode 100644 scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js create mode 100644 scripts/deployment/utils/globals_base_mainnet.json create mode 100644 scripts/deployment/utils/globals_gnosis_mainnet.json create mode 100644 scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js create mode 100644 scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js diff --git a/abis/0.8.28/BalancerPriceOracle.json b/abis/0.8.28/BalancerPriceOracle.json new file mode 100644 index 00000000..68ec3ba6 --- /dev/null +++ b/abis/0.8.28/BalancerPriceOracle.json @@ -0,0 +1,231 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BalancerPriceOracle", + "sourceName": "contracts/oracles/BalancerPriceOracle.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_olas", + "type": "address" + }, + { + "internalType": "address", + "name": "_nativeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_maxSlippage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minUpdateTimePeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_balancerVault", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_balancerPoolId", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cumulativePrice", + "type": "uint256" + } + ], + "name": "PriceUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "balancerPoolId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancerVault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "direction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxSlippage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minUpdateTimePeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nativeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "olas", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "snapshotHistory", + "outputs": [ + { + "internalType": "uint256", + "name": "cumulativePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdated", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "averagePrice", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "updatePrice", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slippage", + "type": "uint256" + } + ], + "name": "validatePrice", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x610160604052348015610010575f5ffd5b5060405161124738038061124783398101604081905261002f91610467565b606484106100845760405162461bcd60e51b815260206004820152601f60248201527f536c697070616765206d757374206265206c657373207468616e20313030250060448201526064015b60405180910390fd5b6001600160a01b038681166101005285811660e052608085905260a08490528216610120819052610140829052604051631f29a8cd60e31b8152600481018390525f919063f94d4668906024015f60405180830381865afa1580156100eb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526101129190810190610593565b50509050856001600160a01b0316815f8151811061013257610132610661565b60200260200101516001600160a01b03161461014e57600160c0525b610156610163565b5050505050505050610706565b5f8061016d610354565b90505f81116101be5760405162461bcd60e51b815260206004820152601660248201527f5072696365206d757374206265206e6f6e2d7a65726f00000000000000000000604482015260640161007b565b6001545f908103610211575f8082556002820183905542600183015560405133915f5160206112275f395f51905f529161020091868252602082015260400190565b60405180910390a260019250505090565b60a0516001546102219190610689565b421015610230575f9250505090565b5f81600101544261024191906106a2565b905080826002015461025391906106b5565b825f015f8282546102649190610689565b9091555050600282015482545f91839161027e91906106e0565b6102889190610689565b61029283866106b5565b845461029e9190610689565b6102a891906106e0565b90506064608051826102ba91906106b5565b6102c491906106e0565b6102ce90826106a2565b8410806102fd57506064608051826102e691906106b5565b6102f091906106e0565b6102fa9082610689565b84115b1561030c575f94505050505090565b60028301819055426001840155825460405133915f5160206112275f395f51905f529161034191888252602082015260400190565b60405180910390a2600194505050505090565b5f5f610120516001600160a01b031663f94d4668610140516040518263ffffffff1660e01b815260040161038a91815260200190565b5f60405180830381865afa1580156103a4573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526103cb9190810190610593565b509150505f8160c051815181106103e4576103e4610661565b602002602001015190505f82600260c05160016104019190610689565b61040b91906106f3565b8151811061041b5761041b610661565b602002602001015190508181670de0b6b3a764000061043a91906106b5565b61044491906106e0565b935050505090565b80516001600160a01b0381168114610462575f5ffd5b919050565b5f5f5f5f5f5f60c0878903121561047c575f5ffd5b6104858761044c565b95506104936020880161044c565b60408801516060890151919650945092506104b06080880161044c565b915060a087015190509295509295509295565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b03811182821017156104ff576104ff6104c3565b604052919050565b5f6001600160401b0382111561051f5761051f6104c3565b5060051b60200190565b5f82601f830112610538575f5ffd5b815161054b61054682610507565b6104d7565b8082825260208201915060208360051b86010192508583111561056c575f5ffd5b602085015b83811015610589578051835260209283019201610571565b5095945050505050565b5f5f5f606084860312156105a5575f5ffd5b83516001600160401b038111156105ba575f5ffd5b8401601f810186136105ca575f5ffd5b80516105d861054682610507565b8082825260208201915060208360051b8501019250888311156105f9575f5ffd5b6020840193505b82841015610622576106118461044c565b825260209384019390910190610600565b6020880151909650925050506001600160401b03811115610641575f5ffd5b61064d86828701610529565b604095909501519396949550929392505050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8082018082111561069c5761069c610675565b92915050565b8181038181111561069c5761069c610675565b808202811582820484141761069c5761069c610675565b634e487b7160e01b5f52601260045260245ffd5b5f826106ee576106ee6106cc565b500490565b5f82610701576107016106cc565b500690565b60805160a05160c05160e051610100516101205161014051610a9961078e5f395f8181610226015261068401525f818161014001526106c301525f60cc01525f61024d01525f818161019c01528181610736015261077501525f818161016701526104b901525f81816101cb015281816102720152818161056e01526105b60152610a995ff3fe608060405234801561000f575f5ffd5b50600436106100c3575f3560e01c8063673a7e281161007d578063a9ed0e1f11610058578063a9ed0e1f146101f5578063dbbb64b914610221578063e1758bd814610248575f5ffd5b8063673a7e28146101be5780638c04166f146101c657806398d5fdca146101ed575f5ffd5b8063158274a5116100ad578063158274a51461013b578063441cc37a14610162578063645539ed14610197575f5ffd5b806231d115146100c7578063136d6f2114610118575b5f5ffd5b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61012b6101263660046107eb565b61026f565b604051901515815260200161010f565b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161010f565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b61012b6103ef565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b61018961065c565b5f5460015460025461020692919083565b6040805193845260208401929092529082015260600161010f565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b5f7f00000000000000000000000000000000000000000000000000000000000000008211156102e55760405162461bcd60e51b815260206004820152601160248201527f536c697070616765206f766572666c6f7700000000000000000000000000000060448201526064015b60405180910390fd5b604080516060810182525f8054825260015460208301819052600254938301939093529091900361031857505f92915050565b5f8160200151426103299190610816565b9050805f0361033b57505f9392505050565b5f818360400151845f01516103509190610843565b61035a9190610856565b82846040015161036a9190610869565b84516103769190610856565b6103809190610843565b90505f61038b61065c565b90505f606461039a8882610816565b6103a49085610869565b6103ae9190610843565b90505f60646103bd8982610856565b6103c79086610869565b6103d19190610843565b90508183101580156103e35750808311155b98975050505050505050565b5f5f6103f961065c565b90505f811161044a5760405162461bcd60e51b815260206004820152601660248201527f5072696365206d757374206265206e6f6e2d7a65726f0000000000000000000060448201526064016102dc565b6001545f9081036104b0575f8082556002820183905542600183015560405133917fb556fac599c3c70efb9ab1fa725ecace6c81cc48d1455f886607def065f3e0c09161049f91868252602082015260400190565b60405180910390a260019250505090565b6001546104de907f000000000000000000000000000000000000000000000000000000000000000090610856565b4210156104ed575f9250505090565b5f8160010154426104fe9190610816565b90508082600201546105109190610869565b825f015f8282546105219190610856565b9091555050600282015482545f91839161053b9190610843565b6105459190610856565b61054f8386610869565b845461055b9190610856565b6105659190610843565b905060646105937f000000000000000000000000000000000000000000000000000000000000000083610869565b61059d9190610843565b6105a79082610816565b8410806105f2575060646105db7f000000000000000000000000000000000000000000000000000000000000000083610869565b6105e59190610843565b6105ef9082610856565b84115b15610601575f94505050505090565b60028301819055426001840155825460405133917fb556fac599c3c70efb9ab1fa725ecace6c81cc48d1455f886607def065f3e0c09161064991888252602082015260400190565b60405180910390a2600194505050505090565b6040517ff94d46680000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201525f90819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063f94d4668906024015f60405180830381865afa158015610707573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261072e9190810190610952565b509150505f817f00000000000000000000000000000000000000000000000000000000000000008151811061076557610765610a3c565b602002602001015190505f8260027f000000000000000000000000000000000000000000000000000000000000000060016107a09190610856565b6107aa9190610a50565b815181106107ba576107ba610a3c565b602002602001015190508181670de0b6b3a76400006107d99190610869565b6107e39190610843565b935050505090565b5f602082840312156107fb575f5ffd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561082957610829610802565b92915050565b634e487b7160e01b5f52601260045260245ffd5b5f826108515761085161082f565b500490565b8082018082111561082957610829610802565b808202811582820484141761082957610829610802565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108bd576108bd610880565b604052919050565b5f67ffffffffffffffff8211156108de576108de610880565b5060051b60200190565b5f82601f8301126108f7575f5ffd5b815161090a610905826108c5565b610894565b8082825260208201915060208360051b86010192508583111561092b575f5ffd5b602085015b83811015610948578051835260209283019201610930565b5095945050505050565b5f5f5f60608486031215610964575f5ffd5b835167ffffffffffffffff81111561097a575f5ffd5b8401601f8101861361098a575f5ffd5b8051610998610905826108c5565b8082825260208201915060208360051b8501019250888311156109b9575f5ffd5b6020840193505b828410156109fc57835173ffffffffffffffffffffffffffffffffffffffff811681146109eb575f5ffd5b8252602093840193909101906109c0565b80965050505050602084015167ffffffffffffffff811115610a1c575f5ffd5b610a28868287016108e8565b604095909501519396949550929392505050565b634e487b7160e01b5f52603260045260245ffd5b5f82610a5e57610a5e61082f565b50069056fea264697066735822122038e4118795fce04de91fb00a7d1b3a3aa70daaf211deedd05071229ae0692aa564736f6c634300081c0033b556fac599c3c70efb9ab1fa725ecace6c81cc48d1455f886607def065f3e0c0", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b50600436106100c3575f3560e01c8063673a7e281161007d578063a9ed0e1f11610058578063a9ed0e1f146101f5578063dbbb64b914610221578063e1758bd814610248575f5ffd5b8063673a7e28146101be5780638c04166f146101c657806398d5fdca146101ed575f5ffd5b8063158274a5116100ad578063158274a51461013b578063441cc37a14610162578063645539ed14610197575f5ffd5b806231d115146100c7578063136d6f2114610118575b5f5ffd5b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61012b6101263660046107eb565b61026f565b604051901515815260200161010f565b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161010f565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b61012b6103ef565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b61018961065c565b5f5460015460025461020692919083565b6040805193845260208401929092529082015260600161010f565b6101897f000000000000000000000000000000000000000000000000000000000000000081565b6100ee7f000000000000000000000000000000000000000000000000000000000000000081565b5f7f00000000000000000000000000000000000000000000000000000000000000008211156102e55760405162461bcd60e51b815260206004820152601160248201527f536c697070616765206f766572666c6f7700000000000000000000000000000060448201526064015b60405180910390fd5b604080516060810182525f8054825260015460208301819052600254938301939093529091900361031857505f92915050565b5f8160200151426103299190610816565b9050805f0361033b57505f9392505050565b5f818360400151845f01516103509190610843565b61035a9190610856565b82846040015161036a9190610869565b84516103769190610856565b6103809190610843565b90505f61038b61065c565b90505f606461039a8882610816565b6103a49085610869565b6103ae9190610843565b90505f60646103bd8982610856565b6103c79086610869565b6103d19190610843565b90508183101580156103e35750808311155b98975050505050505050565b5f5f6103f961065c565b90505f811161044a5760405162461bcd60e51b815260206004820152601660248201527f5072696365206d757374206265206e6f6e2d7a65726f0000000000000000000060448201526064016102dc565b6001545f9081036104b0575f8082556002820183905542600183015560405133917fb556fac599c3c70efb9ab1fa725ecace6c81cc48d1455f886607def065f3e0c09161049f91868252602082015260400190565b60405180910390a260019250505090565b6001546104de907f000000000000000000000000000000000000000000000000000000000000000090610856565b4210156104ed575f9250505090565b5f8160010154426104fe9190610816565b90508082600201546105109190610869565b825f015f8282546105219190610856565b9091555050600282015482545f91839161053b9190610843565b6105459190610856565b61054f8386610869565b845461055b9190610856565b6105659190610843565b905060646105937f000000000000000000000000000000000000000000000000000000000000000083610869565b61059d9190610843565b6105a79082610816565b8410806105f2575060646105db7f000000000000000000000000000000000000000000000000000000000000000083610869565b6105e59190610843565b6105ef9082610856565b84115b15610601575f94505050505090565b60028301819055426001840155825460405133917fb556fac599c3c70efb9ab1fa725ecace6c81cc48d1455f886607def065f3e0c09161064991888252602082015260400190565b60405180910390a2600194505050505090565b6040517ff94d46680000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201525f90819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063f94d4668906024015f60405180830381865afa158015610707573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261072e9190810190610952565b509150505f817f00000000000000000000000000000000000000000000000000000000000000008151811061076557610765610a3c565b602002602001015190505f8260027f000000000000000000000000000000000000000000000000000000000000000060016107a09190610856565b6107aa9190610a50565b815181106107ba576107ba610a3c565b602002602001015190508181670de0b6b3a76400006107d99190610869565b6107e39190610843565b935050505090565b5f602082840312156107fb575f5ffd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561082957610829610802565b92915050565b634e487b7160e01b5f52601260045260245ffd5b5f826108515761085161082f565b500490565b8082018082111561082957610829610802565b808202811582820484141761082957610829610802565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108bd576108bd610880565b604052919050565b5f67ffffffffffffffff8211156108de576108de610880565b5060051b60200190565b5f82601f8301126108f7575f5ffd5b815161090a610905826108c5565b610894565b8082825260208201915060208360051b86010192508583111561092b575f5ffd5b602085015b83811015610948578051835260209283019201610930565b5095945050505050565b5f5f5f60608486031215610964575f5ffd5b835167ffffffffffffffff81111561097a575f5ffd5b8401601f8101861361098a575f5ffd5b8051610998610905826108c5565b8082825260208201915060208360051b8501019250888311156109b9575f5ffd5b6020840193505b828410156109fc57835173ffffffffffffffffffffffffffffffffffffffff811681146109eb575f5ffd5b8252602093840193909101906109c0565b80965050505050602084015167ffffffffffffffff811115610a1c575f5ffd5b610a28868287016108e8565b604095909501519396949550929392505050565b634e487b7160e01b5f52603260045260245ffd5b5f82610a5e57610a5e61082f565b50069056fea264697066735822122038e4118795fce04de91fb00a7d1b3a3aa70daaf211deedd05071229ae0692aa564736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/BuyBackBurnerBalancer.json b/abis/0.8.28/BuyBackBurnerBalancer.json new file mode 100644 index 00000000..518ff8bc --- /dev/null +++ b/abis/0.8.28/BuyBackBurnerBalancer.json @@ -0,0 +1,388 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BuyBackBurnerBalancer", + "sourceName": "contracts/utils/BuyBackBurnerBalancer.sol", + "abi": [ + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerOnly", + "type": "error" + }, + { + "inputs": [], + "name": "T", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "olasAmount", + "type": "uint256" + } + ], + "name": "BuyBack", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OraclePriceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "OracleUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "BUY_BACK_BURNER_PROXY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_ALLOWED_DEVIATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OLAS_BURNER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SECONDS_AGO", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancerPoolId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancerVault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nativeTokenAmount", + "type": "uint256" + } + ], + "name": "buyBack", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "changeImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOracle", + "type": "address" + } + ], + "name": "changeOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "changeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "address", + "name": "uniV3PositionManager", + "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" + } + ], + "name": "checkPoolPrices", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mapAccountActivities", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxSlippage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nativeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "olas", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "updateOraclePrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405260016005553480156013575f5ffd5b50611e59806100215f395ff3fe608060405234801561000f575f5ffd5b5060043610610162575f3560e01c80638b9ee610116100c7578063c0bbd8841161007d578063e1758bd811610063578063e1758bd8146102d1578063f9cc3e9c146102e4578063ffa1ad741461030b575f5ffd5b8063c0bbd884146102c0578063dbbb64b9146102c8575f5ffd5b80638da5cb5b116100ad5780638da5cb5b1461027d578063a6f9dae11461028f578063aeb2d711146102a2575f5ffd5b80638b9ee610146102595780638c04166f14610274575f5ffd5b8063439fab911161011c57806347c421b51161010257806347c421b5146102245780637c9e639f146102375780637dc0d1d014610246575f5ffd5b8063439fab91146101fe57806343b23a1b14610211575f5ffd5b8063158274a51161014c578063158274a5146101ab57806317a68dd8146101be57806340b67a9b146101d1575f5ffd5b806231d11514610166578063053f904014610196575b5f5ffd5b600154610179906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101a96101a436600461168c565b610354565b005b600754610179906001600160a01b031681565b6101a96101cc3660046116b7565b610507565b6101f06101df3660046116b7565b60066020525f908152604090205481565b60405190815260200161018d565b6101a961020c36600461171e565b6105c6565b6101a961021f3660046117b2565b610637565b6101a96102323660046116b7565b610978565b6101f067016345785d8a000081565b600354610179906001600160a01b031681565b6101797351eb65012ca5ceb07320c497f4151ac207fea4e081565b6101f060045481565b5f54610179906001600160a01b031681565b6101a961029d3660046116b7565b610a33565b6102ab61070881565b60405163ffffffff909116815260200161018d565b6101a9610aec565b6101f060085481565b600254610179906001600160a01b031681565b6101f07fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b6103476040518060400160405280600581526020017f302e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161018d9190611840565b6005546001146103ab5760405162461bcd60e51b815260206004820152601060248201527f5265656e7472616e63792067756172640000000000000000000000000000000060448201526064015b60405180910390fd5b60026005819055546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa15801561040f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104339190611852565b905081158061044157508082115b1561044a578091505b5f82116104995760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74206e617469766520746f6b656e20616d6f756e7460448201526064016103a2565b335f9081526006602052604081208054916104b38361187d565b91905055505f6104c283610c19565b90507fce4ecff3fe64868b2d2c7c1125babbbff1d01a1a2566d1edd4ed0f91deaa9350816040516104f591815260200190565b60405180910390a15050600160055550565b5f546001600160a01b03163314610545575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b03811661056c5760405163d92e233d60e01b815260040160405180910390fd5b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc198190556040516001600160a01b038216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b5f546001600160a01b031615610608576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff191633179055600160055561063481610ef3565b50565b5f826001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610674573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106989190611895565b6040517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152868116602483015262ffffff851660448301529192505f91831690631698ee8290606401602060405180830381865afa15801561070d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107319190611895565b90506001600160a01b0381166107895760405162461bcd60e51b815260206004820152601360248201527f506f6f6c20646f6573206e6f742065786973740000000000000000000000000060448201526064016103a2565b5f5f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156107c7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107eb91906118d5565b50506040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff841660048201529496509194505f936001600160a01b038816935063252c09d792506024019050608060405180830381865afa158015610858573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087c9190611979565b5050509050426107088261089091906119d6565b63ffffffff1610156108a6575050505050610972565b5f6108b085611015565b90505f6108d06001600160a01b0386168068010000000000000000611173565b90505f821561091157828211610901576108fc6108ed83856119f8565b670de0b6b3a764000085611173565b61090e565b61090e6108ed84846119f8565b90505b67016345785d8a00008111156109695760405162461bcd60e51b815260206004820152601860248201527f507269636520646576696174696f6e20746f6f2068696768000000000000000060448201526064016103a2565b50505050505050505b50505050565b5f546001600160a01b031633146109b6575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b0381166109dd5760405163d92e233d60e01b815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b8180940394905f90a250565b5f546001600160a01b03163314610a71575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b038116610a985760405163d92e233d60e01b815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b335f908152600660205260408120805491610b068361187d565b9091555050600354604080517f673a7e2800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163673a7e28916004808301926020929190829003018187875af1158015610b6c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b909190611a0b565b905080610bdf5760405162461bcd60e51b815260206004820152601a60248201527f4f7261636c6520707269636520757064617465206661696c656400000000000060448201526064016103a2565b60035460405133916001600160a01b0316907fccf049defd051e7117a233e0f6c01636afab6fb9b1824ae42b5bf7e034fdba37905f90a350565b600354600480546040517f136d6f21000000000000000000000000000000000000000000000000000000008152918201525f916001600160a01b03169063136d6f2190602401602060405180830381865afa158015610c7a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9e9190611a0b565b610d105760405162461bcd60e51b815260206004820152602660248201527f4265666f7265207377617020736c697070616765206c696d697420697320627260448201527f656163686564000000000000000000000000000000000000000000000000000060648201526084016103a2565b600354604080517f98d5fdca00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916398d5fdca9160048083019260209291908290030181865afa158015610d70573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d949190611852565b9050610d9f83611191565b91505f60035f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190611852565b90505f60646004546064610e2a91906119f8565b610e349085611a24565b610e3e9190611a4f565b90505f60646004546064610e529190611a62565b610e5c9086611a24565b610e669190611a4f565b9050818310158015610e785750808311155b610eea5760405162461bcd60e51b815260206004820152602560248201527f4166746572207377617020736c697070616765206c696d69742069732062726560448201527f616368656400000000000000000000000000000000000000000000000000000060648201526084016103a2565b50505050919050565b606081806020019051810190610f099190611a98565b600455600855805190915081905f90610f2457610f24611b49565b602002602001015160015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610f6457610f64611b49565b602002602001015160025f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600281518110610fa457610fa4611b49565b602002602001015160035f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110610fe457610fe4611b49565b602002602001015160075f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b6040805160028082526060820183525f9283929190602083019080368337019050509050610708815f8151811061104e5761104e611b49565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081525f906001600160a01b0385169063883bdbfd906110aa908590600401611b5d565b5f60405180830381865afa1580156110c4573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110eb9190810190611c13565b5090505f815f8151811061110157611101611b49565b60200260200101518260018151811061111c5761111c611b49565b602002602001015161112e9190611cd8565b90505f61113d61070883611d05565b90505f6111498261134b565b90506111686001600160a01b0382168068010000000000000000611173565b979650505050505050565b82820281151584158583048514171661118a575f5ffd5b0492915050565b6002546007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018490525f92919091169063095ea7b3906044016020604051808303815f875af1158015611200573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112249190611a0b565b506040805160c08101825260085481525f6020808301829052600280546001600160a01b0390811685870152600154811660608087019190915260808087018a9052875180890189529384527f30780000000000000000000000000000000000000000000000000000000000008486015260a087019390935286519283018752308084529383018590528287019390935291810183905260075494517f52bbbe29000000000000000000000000000000000000000000000000000000008152939490939116916352bbbe29916113039186918691904290600401611d41565b6020604051808303815f875af115801561131f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113439190611852565b949350505050565b5f5f5f8360020b12611360578260020b611367565b8260020b5f035b9050620d89e88111156113a6576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f036113c8577001000000000000000000000000000000006113da565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561140e576ffff97272373d413259a46990580e213a0260801c5b600482161561142d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561144c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b601082161561146b576fffcb9843d60f6159c9db58835c9266440260801c5b602082161561148a576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156114a9576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156114c8576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156114e8576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615611508576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611528576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611548576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611568576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611588576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156115a8576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156115c8576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156115e9576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615611609576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611628576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611645576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561166457805f198161166057611660611a3b565b0490505b64010000000081061561167857600161167a565b5f5b60ff16602082901c0192505050919050565b5f6020828403121561169c575f5ffd5b5035919050565b6001600160a01b0381168114610634575f5ffd5b5f602082840312156116c7575f5ffd5b81356116d2816116a3565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611716576117166116d9565b604052919050565b5f6020828403121561172e575f5ffd5b813567ffffffffffffffff811115611744575f5ffd5b8201601f81018413611754575f5ffd5b803567ffffffffffffffff81111561176e5761176e6116d9565b611781601f8201601f19166020016116ed565b818152856020838501011115611795575f5ffd5b816020840160208301375f91810160200191909152949350505050565b5f5f5f5f608085870312156117c5575f5ffd5b84356117d0816116a3565b935060208501356117e0816116a3565b925060408501356117f0816116a3565b9150606085013562ffffff81168114611807575f5ffd5b939692955090935050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6116d26020830184611812565b5f60208284031215611862575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f6001820161188e5761188e611869565b5060010190565b5f602082840312156118a5575f5ffd5b81516116d2816116a3565b805161ffff811681146118c1575f5ffd5b919050565b805180151581146118c1575f5ffd5b5f5f5f5f5f5f5f60e0888a0312156118eb575f5ffd5b87516118f6816116a3565b8097505060208801518060020b811461190d575f5ffd5b955061191b604089016118b0565b9450611929606089016118b0565b9350611937608089016118b0565b925060a088015160ff8116811461194c575f5ffd5b915061195a60c089016118c6565b905092959891949750929550565b8051600681900b81146118c1575f5ffd5b5f5f5f5f6080858703121561198c575f5ffd5b845163ffffffff8116811461199f575f5ffd5b93506119ad60208601611968565b925060408501516119bd816116a3565b91506119cb606086016118c6565b905092959194509250565b63ffffffff81811683821601908111156119f2576119f2611869565b92915050565b818103818111156119f2576119f2611869565b5f60208284031215611a1b575f5ffd5b6116d2826118c6565b80820281158282048414176119f2576119f2611869565b634e487b7160e01b5f52601260045260245ffd5b5f82611a5d57611a5d611a3b565b500490565b808201808211156119f2576119f2611869565b5f67ffffffffffffffff821115611a8e57611a8e6116d9565b5060051b60200190565b5f5f5f60608486031215611aaa575f5ffd5b835167ffffffffffffffff811115611ac0575f5ffd5b8401601f81018613611ad0575f5ffd5b8051611ae3611ade82611a75565b6116ed565b8082825260208201915060208360051b850101925088831115611b04575f5ffd5b6020840193505b82841015611b2f578351611b1e816116a3565b825260209384019390910190611b0b565b602088015160409098015190999798509695505050505050565b634e487b7160e01b5f52603260045260245ffd5b602080825282518282018190525f918401906040840190835b81811015611b9a57835163ffffffff16835260209384019390920191600101611b76565b509095945050505050565b5f82601f830112611bb4575f5ffd5b8151611bc2611ade82611a75565b8082825260208201915060208360051b860101925085831115611be3575f5ffd5b602085015b83811015611c09578051611bfb816116a3565b835260209283019201611be8565b5095945050505050565b5f5f60408385031215611c24575f5ffd5b825167ffffffffffffffff811115611c3a575f5ffd5b8301601f81018513611c4a575f5ffd5b8051611c58611ade82611a75565b8082825260208201915060208360051b850101925087831115611c79575f5ffd5b6020840193505b82841015611ca257611c9184611968565b825260209384019390910190611c80565b80955050505050602083015167ffffffffffffffff811115611cc2575f5ffd5b611cce85828601611ba5565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff821317156119f2576119f2611869565b5f8160060b8360060b80611d1b57611d1b611a3b565b667fffffffffffff1982145f1982141615611d3857611d38611869565b90059392505050565b60e08152845160e08201525f602086015160028110611d6e57634e487b7160e01b5f52602160045260245ffd5b61010083015260408601516001600160a01b03166101208301526060860151611da36101408401826001600160a01b03169052565b50608086015161016083015260a086015160c0610180840152611dca6101a0840182611812565b915050611e1160208301866001600160a01b0381511682526020810151151560208301526001600160a01b0360408201511660408301526060810151151560608301525050565b60a082019390935260c001529291505056fea2646970667358221220cb15ff4903e829d88bad9f507be3c8452e0630fe55682a4938fee1dcd37c304b64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b5060043610610162575f3560e01c80638b9ee610116100c7578063c0bbd8841161007d578063e1758bd811610063578063e1758bd8146102d1578063f9cc3e9c146102e4578063ffa1ad741461030b575f5ffd5b8063c0bbd884146102c0578063dbbb64b9146102c8575f5ffd5b80638da5cb5b116100ad5780638da5cb5b1461027d578063a6f9dae11461028f578063aeb2d711146102a2575f5ffd5b80638b9ee610146102595780638c04166f14610274575f5ffd5b8063439fab911161011c57806347c421b51161010257806347c421b5146102245780637c9e639f146102375780637dc0d1d014610246575f5ffd5b8063439fab91146101fe57806343b23a1b14610211575f5ffd5b8063158274a51161014c578063158274a5146101ab57806317a68dd8146101be57806340b67a9b146101d1575f5ffd5b806231d11514610166578063053f904014610196575b5f5ffd5b600154610179906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101a96101a436600461168c565b610354565b005b600754610179906001600160a01b031681565b6101a96101cc3660046116b7565b610507565b6101f06101df3660046116b7565b60066020525f908152604090205481565b60405190815260200161018d565b6101a961020c36600461171e565b6105c6565b6101a961021f3660046117b2565b610637565b6101a96102323660046116b7565b610978565b6101f067016345785d8a000081565b600354610179906001600160a01b031681565b6101797351eb65012ca5ceb07320c497f4151ac207fea4e081565b6101f060045481565b5f54610179906001600160a01b031681565b6101a961029d3660046116b7565b610a33565b6102ab61070881565b60405163ffffffff909116815260200161018d565b6101a9610aec565b6101f060085481565b600254610179906001600160a01b031681565b6101f07fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b6103476040518060400160405280600581526020017f302e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161018d9190611840565b6005546001146103ab5760405162461bcd60e51b815260206004820152601060248201527f5265656e7472616e63792067756172640000000000000000000000000000000060448201526064015b60405180910390fd5b60026005819055546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa15801561040f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104339190611852565b905081158061044157508082115b1561044a578091505b5f82116104995760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74206e617469766520746f6b656e20616d6f756e7460448201526064016103a2565b335f9081526006602052604081208054916104b38361187d565b91905055505f6104c283610c19565b90507fce4ecff3fe64868b2d2c7c1125babbbff1d01a1a2566d1edd4ed0f91deaa9350816040516104f591815260200190565b60405180910390a15050600160055550565b5f546001600160a01b03163314610545575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b03811661056c5760405163d92e233d60e01b815260040160405180910390fd5b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc198190556040516001600160a01b038216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b5f546001600160a01b031615610608576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff191633179055600160055561063481610ef3565b50565b5f826001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610674573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106989190611895565b6040517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152868116602483015262ffffff851660448301529192505f91831690631698ee8290606401602060405180830381865afa15801561070d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107319190611895565b90506001600160a01b0381166107895760405162461bcd60e51b815260206004820152601360248201527f506f6f6c20646f6573206e6f742065786973740000000000000000000000000060448201526064016103a2565b5f5f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156107c7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107eb91906118d5565b50506040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff841660048201529496509194505f936001600160a01b038816935063252c09d792506024019050608060405180830381865afa158015610858573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087c9190611979565b5050509050426107088261089091906119d6565b63ffffffff1610156108a6575050505050610972565b5f6108b085611015565b90505f6108d06001600160a01b0386168068010000000000000000611173565b90505f821561091157828211610901576108fc6108ed83856119f8565b670de0b6b3a764000085611173565b61090e565b61090e6108ed84846119f8565b90505b67016345785d8a00008111156109695760405162461bcd60e51b815260206004820152601860248201527f507269636520646576696174696f6e20746f6f2068696768000000000000000060448201526064016103a2565b50505050505050505b50505050565b5f546001600160a01b031633146109b6575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b0381166109dd5760405163d92e233d60e01b815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b8180940394905f90a250565b5f546001600160a01b03163314610a71575f5460405163521eb56d60e11b81523360048201526001600160a01b0390911660248201526044016103a2565b6001600160a01b038116610a985760405163d92e233d60e01b815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b335f908152600660205260408120805491610b068361187d565b9091555050600354604080517f673a7e2800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163673a7e28916004808301926020929190829003018187875af1158015610b6c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b909190611a0b565b905080610bdf5760405162461bcd60e51b815260206004820152601a60248201527f4f7261636c6520707269636520757064617465206661696c656400000000000060448201526064016103a2565b60035460405133916001600160a01b0316907fccf049defd051e7117a233e0f6c01636afab6fb9b1824ae42b5bf7e034fdba37905f90a350565b600354600480546040517f136d6f21000000000000000000000000000000000000000000000000000000008152918201525f916001600160a01b03169063136d6f2190602401602060405180830381865afa158015610c7a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9e9190611a0b565b610d105760405162461bcd60e51b815260206004820152602660248201527f4265666f7265207377617020736c697070616765206c696d697420697320627260448201527f656163686564000000000000000000000000000000000000000000000000000060648201526084016103a2565b600354604080517f98d5fdca00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916398d5fdca9160048083019260209291908290030181865afa158015610d70573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d949190611852565b9050610d9f83611191565b91505f60035f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190611852565b90505f60646004546064610e2a91906119f8565b610e349085611a24565b610e3e9190611a4f565b90505f60646004546064610e529190611a62565b610e5c9086611a24565b610e669190611a4f565b9050818310158015610e785750808311155b610eea5760405162461bcd60e51b815260206004820152602560248201527f4166746572207377617020736c697070616765206c696d69742069732062726560448201527f616368656400000000000000000000000000000000000000000000000000000060648201526084016103a2565b50505050919050565b606081806020019051810190610f099190611a98565b600455600855805190915081905f90610f2457610f24611b49565b602002602001015160015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610f6457610f64611b49565b602002602001015160025f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600281518110610fa457610fa4611b49565b602002602001015160035f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110610fe457610fe4611b49565b602002602001015160075f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b6040805160028082526060820183525f9283929190602083019080368337019050509050610708815f8151811061104e5761104e611b49565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081525f906001600160a01b0385169063883bdbfd906110aa908590600401611b5d565b5f60405180830381865afa1580156110c4573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110eb9190810190611c13565b5090505f815f8151811061110157611101611b49565b60200260200101518260018151811061111c5761111c611b49565b602002602001015161112e9190611cd8565b90505f61113d61070883611d05565b90505f6111498261134b565b90506111686001600160a01b0382168068010000000000000000611173565b979650505050505050565b82820281151584158583048514171661118a575f5ffd5b0492915050565b6002546007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018490525f92919091169063095ea7b3906044016020604051808303815f875af1158015611200573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112249190611a0b565b506040805160c08101825260085481525f6020808301829052600280546001600160a01b0390811685870152600154811660608087019190915260808087018a9052875180890189529384527f30780000000000000000000000000000000000000000000000000000000000008486015260a087019390935286519283018752308084529383018590528287019390935291810183905260075494517f52bbbe29000000000000000000000000000000000000000000000000000000008152939490939116916352bbbe29916113039186918691904290600401611d41565b6020604051808303815f875af115801561131f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113439190611852565b949350505050565b5f5f5f8360020b12611360578260020b611367565b8260020b5f035b9050620d89e88111156113a6576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f036113c8577001000000000000000000000000000000006113da565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561140e576ffff97272373d413259a46990580e213a0260801c5b600482161561142d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561144c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b601082161561146b576fffcb9843d60f6159c9db58835c9266440260801c5b602082161561148a576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156114a9576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156114c8576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156114e8576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615611508576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611528576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611548576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611568576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611588576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156115a8576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156115c8576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156115e9576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615611609576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611628576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611645576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561166457805f198161166057611660611a3b565b0490505b64010000000081061561167857600161167a565b5f5b60ff16602082901c0192505050919050565b5f6020828403121561169c575f5ffd5b5035919050565b6001600160a01b0381168114610634575f5ffd5b5f602082840312156116c7575f5ffd5b81356116d2816116a3565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611716576117166116d9565b604052919050565b5f6020828403121561172e575f5ffd5b813567ffffffffffffffff811115611744575f5ffd5b8201601f81018413611754575f5ffd5b803567ffffffffffffffff81111561176e5761176e6116d9565b611781601f8201601f19166020016116ed565b818152856020838501011115611795575f5ffd5b816020840160208301375f91810160200191909152949350505050565b5f5f5f5f608085870312156117c5575f5ffd5b84356117d0816116a3565b935060208501356117e0816116a3565b925060408501356117f0816116a3565b9150606085013562ffffff81168114611807575f5ffd5b939692955090935050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6116d26020830184611812565b5f60208284031215611862575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f6001820161188e5761188e611869565b5060010190565b5f602082840312156118a5575f5ffd5b81516116d2816116a3565b805161ffff811681146118c1575f5ffd5b919050565b805180151581146118c1575f5ffd5b5f5f5f5f5f5f5f60e0888a0312156118eb575f5ffd5b87516118f6816116a3565b8097505060208801518060020b811461190d575f5ffd5b955061191b604089016118b0565b9450611929606089016118b0565b9350611937608089016118b0565b925060a088015160ff8116811461194c575f5ffd5b915061195a60c089016118c6565b905092959891949750929550565b8051600681900b81146118c1575f5ffd5b5f5f5f5f6080858703121561198c575f5ffd5b845163ffffffff8116811461199f575f5ffd5b93506119ad60208601611968565b925060408501516119bd816116a3565b91506119cb606086016118c6565b905092959194509250565b63ffffffff81811683821601908111156119f2576119f2611869565b92915050565b818103818111156119f2576119f2611869565b5f60208284031215611a1b575f5ffd5b6116d2826118c6565b80820281158282048414176119f2576119f2611869565b634e487b7160e01b5f52601260045260245ffd5b5f82611a5d57611a5d611a3b565b500490565b808201808211156119f2576119f2611869565b5f67ffffffffffffffff821115611a8e57611a8e6116d9565b5060051b60200190565b5f5f5f60608486031215611aaa575f5ffd5b835167ffffffffffffffff811115611ac0575f5ffd5b8401601f81018613611ad0575f5ffd5b8051611ae3611ade82611a75565b6116ed565b8082825260208201915060208360051b850101925088831115611b04575f5ffd5b6020840193505b82841015611b2f578351611b1e816116a3565b825260209384019390910190611b0b565b602088015160409098015190999798509695505050505050565b634e487b7160e01b5f52603260045260245ffd5b602080825282518282018190525f918401906040840190835b81811015611b9a57835163ffffffff16835260209384019390920191600101611b76565b509095945050505050565b5f82601f830112611bb4575f5ffd5b8151611bc2611ade82611a75565b8082825260208201915060208360051b860101925085831115611be3575f5ffd5b602085015b83811015611c09578051611bfb816116a3565b835260209283019201611be8565b5095945050505050565b5f5f60408385031215611c24575f5ffd5b825167ffffffffffffffff811115611c3a575f5ffd5b8301601f81018513611c4a575f5ffd5b8051611c58611ade82611a75565b8082825260208201915060208360051b850101925087831115611c79575f5ffd5b6020840193505b82841015611ca257611c9184611968565b825260209384019390910190611c80565b80955050505050602083015167ffffffffffffffff811115611cc2575f5ffd5b611cce85828601611ba5565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff821317156119f2576119f2611869565b5f8160060b8360060b80611d1b57611d1b611a3b565b667fffffffffffff1982145f1982141615611d3857611d38611869565b90059392505050565b60e08152845160e08201525f602086015160028110611d6e57634e487b7160e01b5f52602160045260245ffd5b61010083015260408601516001600160a01b03166101208301526060860151611da36101408401826001600160a01b03169052565b50608086015161016083015260a086015160c0610180840152611dca6101a0840182611812565b915050611e1160208301866001600160a01b0381511682526020810151151560208301526001600160a01b0360408201511660408301526060810151151560608301525050565b60a082019390935260c001529291505056fea2646970667358221220cb15ff4903e829d88bad9f507be3c8452e0630fe55682a4938fee1dcd37c304b64736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/BuyBackBurnerProxy.json b/abis/0.8.28/BuyBackBurnerProxy.json new file mode 100644 index 00000000..49a11214 --- /dev/null +++ b/abis/0.8.28/BuyBackBurnerProxy.json @@ -0,0 +1,72 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BuyBackBurnerProxy", + "sourceName": "contracts/utils/BuyBackBurnerProxy.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "buyBackBurnerData", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InitializationFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroData", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroImplementationAddress", + "type": "error" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "BUY_BACK_BURNER_PROXY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561000f575f5ffd5b5060405161034f38038061034f83398101604081905261002e9161012d565b6001600160a01b0382166100555760405163d02c623d60e01b815260040160405180910390fd5b80515f036100765760405163c922446b60e01b815260040160405180910390fd5b817fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc19555f826001600160a01b0316826040516100b291906101fc565b5f60405180830381855af49150503d805f81146100ea576040519150601f19603f3d011682016040523d82523d5f602084013e6100ef565b606091505b505090508061011157604051630337323560e31b815260040160405180910390fd5b505050610212565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561013e575f5ffd5b82516001600160a01b0381168114610154575f5ffd5b60208401519092506001600160401b0381111561016f575f5ffd5b8301601f8101851361017f575f5ffd5b80516001600160401b0381111561019857610198610119565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101c6576101c6610119565b6040528181528282016020018710156101dd575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b5f82518060208501845e5f920191825250919050565b6101308061021f5f395ff3fe6080604052600436106025575f3560e01c8063aaf10f42146065578063f9cc3e9c1460bc575b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1954365f5f375f5f365f845af490503d5f5f3e806060573d5ffd5b503d5ff35b348015606f575f5ffd5b507fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc195460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801560c6575f5ffd5b5060ed7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b60405190815260200160b356fea2646970667358221220409fea36f072e886ff780e36cb9b27845d4b9c3623e34601d6d66699dcf4fff264736f6c634300081c0033", + "deployedBytecode": "0x6080604052600436106025575f3560e01c8063aaf10f42146065578063f9cc3e9c1460bc575b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1954365f5f375f5f365f845af490503d5f5f3e806060573d5ffd5b503d5ff35b348015606f575f5ffd5b507fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc195460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801560c6575f5ffd5b5060ed7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b60405190815260200160b356fea2646970667358221220409fea36f072e886ff780e36cb9b27845d4b9c3623e34601d6d66699dcf4fff264736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/BuyBackBurnerUniswap.json b/abis/0.8.28/BuyBackBurnerUniswap.json new file mode 100644 index 00000000..d76bf6ed --- /dev/null +++ b/abis/0.8.28/BuyBackBurnerUniswap.json @@ -0,0 +1,375 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BuyBackBurnerUniswap", + "sourceName": "contracts/utils/BuyBackBurnerUniswap.sol", + "abi": [ + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerOnly", + "type": "error" + }, + { + "inputs": [], + "name": "T", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "olasAmount", + "type": "uint256" + } + ], + "name": "BuyBack", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OraclePriceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "OracleUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "BUY_BACK_BURNER_PROXY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_ALLOWED_DEVIATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OLAS_BURNER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SECONDS_AGO", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nativeTokenAmount", + "type": "uint256" + } + ], + "name": "buyBack", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "changeImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOracle", + "type": "address" + } + ], + "name": "changeOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "changeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "address", + "name": "uniV3PositionManager", + "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" + } + ], + "name": "checkPoolPrices", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mapAccountActivities", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxSlippage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nativeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "olas", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "router", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "updateOraclePrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405260016005553480156013575f5ffd5b50611e52806100215f395ff3fe608060405234801561000f575f5ffd5b5060043610610148575f3560e01c80638b9ee610116100c7578063c0bbd8841161007d578063f887ea4011610063578063f887ea40146102ae578063f9cc3e9c146102c1578063ffa1ad74146102e8575f5ffd5b8063c0bbd88414610293578063e1758bd81461029b575f5ffd5b80638da5cb5b116100ad5780638da5cb5b14610250578063a6f9dae114610262578063aeb2d71114610275575f5ffd5b80638b9ee6101461022c5780638c04166f14610247575f5ffd5b8063439fab911161011c57806347c421b51161010257806347c421b5146101f75780637c9e639f1461020a5780637dc0d1d014610219575f5ffd5b8063439fab91146101d157806343b23a1b146101e4575f5ffd5b806231d1151461014c578063053f90401461017c57806317a68dd81461019157806340b67a9b146101a4575b5f5ffd5b60015461015f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61018f61018a366004611679565b610331565b005b61018f61019f3660046116a4565b6104e4565b6101c36101b23660046116a4565b60066020525f908152604090205481565b604051908152602001610173565b61018f6101df36600461170b565b6105a3565b61018f6101f236600461179f565b610614565b61018f6102053660046116a4565b610955565b6101c367016345785d8a000081565b60035461015f906001600160a01b031681565b61015f7351eb65012ca5ceb07320c497f4151ac207fea4e081565b6101c360045481565b5f5461015f906001600160a01b031681565b61018f6102703660046116a4565b610a10565b61027e61070881565b60405163ffffffff9091168152602001610173565b61018f610ac9565b60025461015f906001600160a01b031681565b60075461015f906001600160a01b031681565b6101c37fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b6103246040518060400160405280600581526020017f302e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161017391906117ff565b6005546001146103885760405162461bcd60e51b815260206004820152601060248201527f5265656e7472616e63792067756172640000000000000000000000000000000060448201526064015b60405180910390fd5b60026005819055546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa1580156103ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104109190611834565b905081158061041e57508082115b15610427578091505b5f82116104765760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74206e617469766520746f6b656e20616d6f756e74604482015260640161037f565b335f9081526006602052604081208054916104908361185f565b91905055505f61049f83610bf6565b90507fce4ecff3fe64868b2d2c7c1125babbbff1d01a1a2566d1edd4ed0f91deaa9350816040516104d291815260200190565b60405180910390a15050600160055550565b5f546001600160a01b03163314610522575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b0381166105495760405163d92e233d60e01b815260040160405180910390fd5b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc198190556040516001600160a01b038216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b5f546001600160a01b0316156105e5576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff191633179055600160055561061181610ed0565b50565b5f826001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610651573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106759190611877565b6040517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152868116602483015262ffffff851660448301529192505f91831690631698ee8290606401602060405180830381865afa1580156106ea573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061070e9190611877565b90506001600160a01b0381166107665760405162461bcd60e51b815260206004820152601360248201527f506f6f6c20646f6573206e6f7420657869737400000000000000000000000000604482015260640161037f565b5f5f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156107a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107c891906118b7565b50506040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff841660048201529496509194505f936001600160a01b038816935063252c09d792506024019050608060405180830381865afa158015610835573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610859919061195b565b5050509050426107088261086d91906119b8565b63ffffffff16101561088357505050505061094f565b5f61088d85610fef565b90505f6108ad6001600160a01b038616806801000000000000000061114d565b90505f82156108ee578282116108de576108d96108ca83856119da565b670de0b6b3a76400008561114d565b6108eb565b6108eb6108ca84846119da565b90505b67016345785d8a00008111156109465760405162461bcd60e51b815260206004820152601860248201527f507269636520646576696174696f6e20746f6f20686967680000000000000000604482015260640161037f565b50505050505050505b50505050565b5f546001600160a01b03163314610993575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b0381166109ba5760405163d92e233d60e01b815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b8180940394905f90a250565b5f546001600160a01b03163314610a4e575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b038116610a755760405163d92e233d60e01b815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b335f908152600660205260408120805491610ae38361185f565b9091555050600354604080517f673a7e2800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163673a7e28916004808301926020929190829003018187875af1158015610b49573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6d91906119ed565b905080610bbc5760405162461bcd60e51b815260206004820152601a60248201527f4f7261636c6520707269636520757064617465206661696c6564000000000000604482015260640161037f565b60035460405133916001600160a01b0316907fccf049defd051e7117a233e0f6c01636afab6fb9b1824ae42b5bf7e034fdba37905f90a350565b600354600480546040517f136d6f21000000000000000000000000000000000000000000000000000000008152918201525f916001600160a01b03169063136d6f2190602401602060405180830381865afa158015610c57573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c7b91906119ed565b610ced5760405162461bcd60e51b815260206004820152602660248201527f4265666f7265207377617020736c697070616765206c696d697420697320627260448201527f6561636865640000000000000000000000000000000000000000000000000000606482015260840161037f565b600354604080517f98d5fdca00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916398d5fdca9160048083019260209291908290030181865afa158015610d4d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d719190611834565b9050610d7c8361116b565b91505f60035f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610df39190611834565b90505f60646004546064610e0791906119da565b610e119085611a06565b610e1b9190611a31565b90505f60646004546064610e2f9190611a44565b610e399086611a06565b610e439190611a31565b9050818310158015610e555750808311155b610ec75760405162461bcd60e51b815260206004820152602560248201527f4166746572207377617020736c697070616765206c696d69742069732062726560448201527f6163686564000000000000000000000000000000000000000000000000000000606482015260840161037f565b50505050919050565b606081806020019051810190610ee69190611a7a565b600455805190915081905f90610efe57610efe611b23565b602002602001015160015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610f3e57610f3e611b23565b602002602001015160025f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600281518110610f7e57610f7e611b23565b602002602001015160035f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110610fbe57610fbe611b23565b602002602001015160075f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b6040805160028082526060820183525f9283929190602083019080368337019050509050610708815f8151811061102857611028611b23565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081525f906001600160a01b0385169063883bdbfd90611084908590600401611b37565b5f60405180830381865afa15801561109e573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110c59190810190611bed565b5090505f815f815181106110db576110db611b23565b6020026020010151826001815181106110f6576110f6611b23565b60200260200101516111089190611cb2565b90505f61111761070883611cdf565b90505f61112382611338565b90506111426001600160a01b038216806801000000000000000061114d565b979650505050505050565b828202811515841585830485141716611164575f5ffd5b0492915050565b6002546007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018490525f92919091169063095ea7b3906044016020604051808303815f875af11580156111da573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111fe91906119ed565b506040805160028082526060820183525f92602083019080368337505060025482519293506001600160a01b0316918391505f9061123e5761123e611b23565b6001600160a01b039283166020918202929092010152600180548351921691839190811061126e5761126e611b23565b6001600160a01b0392831660209182029290920101526007546040517f38ed17390000000000000000000000000000000000000000000000000000000081525f9291909116906338ed1739906112d09087908590879030904290600401611d1b565b5f604051808303815f875af11580156112eb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526113129190810190611d8b565b90508060018151811061132757611327611b23565b602002602001015192505050919050565b5f5f5f8360020b1261134d578260020b611354565b8260020b5f035b9050620d89e8811115611393576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f036113b5577001000000000000000000000000000000006113c7565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156113fb576ffff97272373d413259a46990580e213a0260801c5b600482161561141a576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611439576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611458576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611477576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611496576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156114b5576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156114d5576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156114f5576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611515576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611535576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611555576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611575576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611595576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156115b5576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156115d6576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156115f6576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611615576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611632576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561165157805f198161164d5761164d611a1d565b0490505b640100000000810615611665576001611667565b5f5b60ff16602082901c0192505050919050565b5f60208284031215611689575f5ffd5b5035919050565b6001600160a01b0381168114610611575f5ffd5b5f602082840312156116b4575f5ffd5b81356116bf81611690565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611703576117036116c6565b604052919050565b5f6020828403121561171b575f5ffd5b813567ffffffffffffffff811115611731575f5ffd5b8201601f81018413611741575f5ffd5b803567ffffffffffffffff81111561175b5761175b6116c6565b61176e601f8201601f19166020016116da565b818152856020838501011115611782575f5ffd5b816020840160208301375f91810160200191909152949350505050565b5f5f5f5f608085870312156117b2575f5ffd5b84356117bd81611690565b935060208501356117cd81611690565b925060408501356117dd81611690565b9150606085013562ffffff811681146117f4575f5ffd5b939692955090935050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f60208284031215611844575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f600182016118705761187061184b565b5060010190565b5f60208284031215611887575f5ffd5b81516116bf81611690565b805161ffff811681146118a3575f5ffd5b919050565b805180151581146118a3575f5ffd5b5f5f5f5f5f5f5f60e0888a0312156118cd575f5ffd5b87516118d881611690565b8097505060208801518060020b81146118ef575f5ffd5b95506118fd60408901611892565b945061190b60608901611892565b935061191960808901611892565b925060a088015160ff8116811461192e575f5ffd5b915061193c60c089016118a8565b905092959891949750929550565b8051600681900b81146118a3575f5ffd5b5f5f5f5f6080858703121561196e575f5ffd5b845163ffffffff81168114611981575f5ffd5b935061198f6020860161194a565b9250604085015161199f81611690565b91506119ad606086016118a8565b905092959194509250565b63ffffffff81811683821601908111156119d4576119d461184b565b92915050565b818103818111156119d4576119d461184b565b5f602082840312156119fd575f5ffd5b6116bf826118a8565b80820281158282048414176119d4576119d461184b565b634e487b7160e01b5f52601260045260245ffd5b5f82611a3f57611a3f611a1d565b500490565b808201808211156119d4576119d461184b565b5f67ffffffffffffffff821115611a7057611a706116c6565b5060051b60200190565b5f5f60408385031215611a8b575f5ffd5b825167ffffffffffffffff811115611aa1575f5ffd5b8301601f81018513611ab1575f5ffd5b8051611ac4611abf82611a57565b6116da565b8082825260208201915060208360051b850101925087831115611ae5575f5ffd5b6020840193505b82841015611b10578351611aff81611690565b825260209384019390910190611aec565b6020969096015195979596505050505050565b634e487b7160e01b5f52603260045260245ffd5b602080825282518282018190525f918401906040840190835b81811015611b7457835163ffffffff16835260209384019390920191600101611b50565b509095945050505050565b5f82601f830112611b8e575f5ffd5b8151611b9c611abf82611a57565b8082825260208201915060208360051b860101925085831115611bbd575f5ffd5b602085015b83811015611be3578051611bd581611690565b835260209283019201611bc2565b5095945050505050565b5f5f60408385031215611bfe575f5ffd5b825167ffffffffffffffff811115611c14575f5ffd5b8301601f81018513611c24575f5ffd5b8051611c32611abf82611a57565b8082825260208201915060208360051b850101925087831115611c53575f5ffd5b6020840193505b82841015611c7c57611c6b8461194a565b825260209384019390910190611c5a565b80955050505050602083015167ffffffffffffffff811115611c9c575f5ffd5b611ca885828601611b7f565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff821317156119d4576119d461184b565b5f8160060b8360060b80611cf557611cf5611a1d565b667fffffffffffff1982145f1982141615611d1257611d1261184b565b90059392505050565b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611d6b5783516001600160a01b0316835260209384019390920191600101611d44565b50506001600160a01b039590951660608401525050608001529392505050565b5f60208284031215611d9b575f5ffd5b815167ffffffffffffffff811115611db1575f5ffd5b8201601f81018413611dc1575f5ffd5b8051611dcf611abf82611a57565b8082825260208201915060208360051b850101925086831115611df0575f5ffd5b6020840193505b82841015611e12578351825260209384019390910190611df7565b969550505050505056fea26469706673582212205fbada8332bde9df1e03f3b58913ab1e8c1d16d73ad2f925cb45ae98eb760b2264736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b5060043610610148575f3560e01c80638b9ee610116100c7578063c0bbd8841161007d578063f887ea4011610063578063f887ea40146102ae578063f9cc3e9c146102c1578063ffa1ad74146102e8575f5ffd5b8063c0bbd88414610293578063e1758bd81461029b575f5ffd5b80638da5cb5b116100ad5780638da5cb5b14610250578063a6f9dae114610262578063aeb2d71114610275575f5ffd5b80638b9ee6101461022c5780638c04166f14610247575f5ffd5b8063439fab911161011c57806347c421b51161010257806347c421b5146101f75780637c9e639f1461020a5780637dc0d1d014610219575f5ffd5b8063439fab91146101d157806343b23a1b146101e4575f5ffd5b806231d1151461014c578063053f90401461017c57806317a68dd81461019157806340b67a9b146101a4575b5f5ffd5b60015461015f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61018f61018a366004611679565b610331565b005b61018f61019f3660046116a4565b6104e4565b6101c36101b23660046116a4565b60066020525f908152604090205481565b604051908152602001610173565b61018f6101df36600461170b565b6105a3565b61018f6101f236600461179f565b610614565b61018f6102053660046116a4565b610955565b6101c367016345785d8a000081565b60035461015f906001600160a01b031681565b61015f7351eb65012ca5ceb07320c497f4151ac207fea4e081565b6101c360045481565b5f5461015f906001600160a01b031681565b61018f6102703660046116a4565b610a10565b61027e61070881565b60405163ffffffff9091168152602001610173565b61018f610ac9565b60025461015f906001600160a01b031681565b60075461015f906001600160a01b031681565b6101c37fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc1981565b6103246040518060400160405280600581526020017f302e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161017391906117ff565b6005546001146103885760405162461bcd60e51b815260206004820152601060248201527f5265656e7472616e63792067756172640000000000000000000000000000000060448201526064015b60405180910390fd5b60026005819055546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa1580156103ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104109190611834565b905081158061041e57508082115b15610427578091505b5f82116104765760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74206e617469766520746f6b656e20616d6f756e74604482015260640161037f565b335f9081526006602052604081208054916104908361185f565b91905055505f61049f83610bf6565b90507fce4ecff3fe64868b2d2c7c1125babbbff1d01a1a2566d1edd4ed0f91deaa9350816040516104d291815260200190565b60405180910390a15050600160055550565b5f546001600160a01b03163314610522575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b0381166105495760405163d92e233d60e01b815260040160405180910390fd5b7fc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc198190556040516001600160a01b038216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b5f546001600160a01b0316156105e5576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff191633179055600160055561061181610ed0565b50565b5f826001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610651573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106759190611877565b6040517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152868116602483015262ffffff851660448301529192505f91831690631698ee8290606401602060405180830381865afa1580156106ea573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061070e9190611877565b90506001600160a01b0381166107665760405162461bcd60e51b815260206004820152601360248201527f506f6f6c20646f6573206e6f7420657869737400000000000000000000000000604482015260640161037f565b5f5f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156107a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107c891906118b7565b50506040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff841660048201529496509194505f936001600160a01b038816935063252c09d792506024019050608060405180830381865afa158015610835573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610859919061195b565b5050509050426107088261086d91906119b8565b63ffffffff16101561088357505050505061094f565b5f61088d85610fef565b90505f6108ad6001600160a01b038616806801000000000000000061114d565b90505f82156108ee578282116108de576108d96108ca83856119da565b670de0b6b3a76400008561114d565b6108eb565b6108eb6108ca84846119da565b90505b67016345785d8a00008111156109465760405162461bcd60e51b815260206004820152601860248201527f507269636520646576696174696f6e20746f6f20686967680000000000000000604482015260640161037f565b50505050505050505b50505050565b5f546001600160a01b03163314610993575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b0381166109ba5760405163d92e233d60e01b815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b8180940394905f90a250565b5f546001600160a01b03163314610a4e575f5460405163521eb56d60e11b81523360048201526001600160a01b03909116602482015260440161037f565b6001600160a01b038116610a755760405163d92e233d60e01b815260040160405180910390fd5b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b335f908152600660205260408120805491610ae38361185f565b9091555050600354604080517f673a7e2800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163673a7e28916004808301926020929190829003018187875af1158015610b49573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6d91906119ed565b905080610bbc5760405162461bcd60e51b815260206004820152601a60248201527f4f7261636c6520707269636520757064617465206661696c6564000000000000604482015260640161037f565b60035460405133916001600160a01b0316907fccf049defd051e7117a233e0f6c01636afab6fb9b1824ae42b5bf7e034fdba37905f90a350565b600354600480546040517f136d6f21000000000000000000000000000000000000000000000000000000008152918201525f916001600160a01b03169063136d6f2190602401602060405180830381865afa158015610c57573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c7b91906119ed565b610ced5760405162461bcd60e51b815260206004820152602660248201527f4265666f7265207377617020736c697070616765206c696d697420697320627260448201527f6561636865640000000000000000000000000000000000000000000000000000606482015260840161037f565b600354604080517f98d5fdca00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916398d5fdca9160048083019260209291908290030181865afa158015610d4d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d719190611834565b9050610d7c8361116b565b91505f60035f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610df39190611834565b90505f60646004546064610e0791906119da565b610e119085611a06565b610e1b9190611a31565b90505f60646004546064610e2f9190611a44565b610e399086611a06565b610e439190611a31565b9050818310158015610e555750808311155b610ec75760405162461bcd60e51b815260206004820152602560248201527f4166746572207377617020736c697070616765206c696d69742069732062726560448201527f6163686564000000000000000000000000000000000000000000000000000000606482015260840161037f565b50505050919050565b606081806020019051810190610ee69190611a7a565b600455805190915081905f90610efe57610efe611b23565b602002602001015160015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610f3e57610f3e611b23565b602002602001015160025f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600281518110610f7e57610f7e611b23565b602002602001015160035f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110610fbe57610fbe611b23565b602002602001015160075f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b6040805160028082526060820183525f9283929190602083019080368337019050509050610708815f8151811061102857611028611b23565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081525f906001600160a01b0385169063883bdbfd90611084908590600401611b37565b5f60405180830381865afa15801561109e573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110c59190810190611bed565b5090505f815f815181106110db576110db611b23565b6020026020010151826001815181106110f6576110f6611b23565b60200260200101516111089190611cb2565b90505f61111761070883611cdf565b90505f61112382611338565b90506111426001600160a01b038216806801000000000000000061114d565b979650505050505050565b828202811515841585830485141716611164575f5ffd5b0492915050565b6002546007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018490525f92919091169063095ea7b3906044016020604051808303815f875af11580156111da573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111fe91906119ed565b506040805160028082526060820183525f92602083019080368337505060025482519293506001600160a01b0316918391505f9061123e5761123e611b23565b6001600160a01b039283166020918202929092010152600180548351921691839190811061126e5761126e611b23565b6001600160a01b0392831660209182029290920101526007546040517f38ed17390000000000000000000000000000000000000000000000000000000081525f9291909116906338ed1739906112d09087908590879030904290600401611d1b565b5f604051808303815f875af11580156112eb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526113129190810190611d8b565b90508060018151811061132757611327611b23565b602002602001015192505050919050565b5f5f5f8360020b1261134d578260020b611354565b8260020b5f035b9050620d89e8811115611393576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f036113b5577001000000000000000000000000000000006113c7565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156113fb576ffff97272373d413259a46990580e213a0260801c5b600482161561141a576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611439576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611458576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611477576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611496576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156114b5576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156114d5576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156114f5576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611515576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611535576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611555576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611575576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611595576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156115b5576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156115d6576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156115f6576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611615576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611632576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561165157805f198161164d5761164d611a1d565b0490505b640100000000810615611665576001611667565b5f5b60ff16602082901c0192505050919050565b5f60208284031215611689575f5ffd5b5035919050565b6001600160a01b0381168114610611575f5ffd5b5f602082840312156116b4575f5ffd5b81356116bf81611690565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611703576117036116c6565b604052919050565b5f6020828403121561171b575f5ffd5b813567ffffffffffffffff811115611731575f5ffd5b8201601f81018413611741575f5ffd5b803567ffffffffffffffff81111561175b5761175b6116c6565b61176e601f8201601f19166020016116da565b818152856020838501011115611782575f5ffd5b816020840160208301375f91810160200191909152949350505050565b5f5f5f5f608085870312156117b2575f5ffd5b84356117bd81611690565b935060208501356117cd81611690565b925060408501356117dd81611690565b9150606085013562ffffff811681146117f4575f5ffd5b939692955090935050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f60208284031215611844575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f600182016118705761187061184b565b5060010190565b5f60208284031215611887575f5ffd5b81516116bf81611690565b805161ffff811681146118a3575f5ffd5b919050565b805180151581146118a3575f5ffd5b5f5f5f5f5f5f5f60e0888a0312156118cd575f5ffd5b87516118d881611690565b8097505060208801518060020b81146118ef575f5ffd5b95506118fd60408901611892565b945061190b60608901611892565b935061191960808901611892565b925060a088015160ff8116811461192e575f5ffd5b915061193c60c089016118a8565b905092959891949750929550565b8051600681900b81146118a3575f5ffd5b5f5f5f5f6080858703121561196e575f5ffd5b845163ffffffff81168114611981575f5ffd5b935061198f6020860161194a565b9250604085015161199f81611690565b91506119ad606086016118a8565b905092959194509250565b63ffffffff81811683821601908111156119d4576119d461184b565b92915050565b818103818111156119d4576119d461184b565b5f602082840312156119fd575f5ffd5b6116bf826118a8565b80820281158282048414176119d4576119d461184b565b634e487b7160e01b5f52601260045260245ffd5b5f82611a3f57611a3f611a1d565b500490565b808201808211156119d4576119d461184b565b5f67ffffffffffffffff821115611a7057611a706116c6565b5060051b60200190565b5f5f60408385031215611a8b575f5ffd5b825167ffffffffffffffff811115611aa1575f5ffd5b8301601f81018513611ab1575f5ffd5b8051611ac4611abf82611a57565b6116da565b8082825260208201915060208360051b850101925087831115611ae5575f5ffd5b6020840193505b82841015611b10578351611aff81611690565b825260209384019390910190611aec565b6020969096015195979596505050505050565b634e487b7160e01b5f52603260045260245ffd5b602080825282518282018190525f918401906040840190835b81811015611b7457835163ffffffff16835260209384019390920191600101611b50565b509095945050505050565b5f82601f830112611b8e575f5ffd5b8151611b9c611abf82611a57565b8082825260208201915060208360051b860101925085831115611bbd575f5ffd5b602085015b83811015611be3578051611bd581611690565b835260209283019201611bc2565b5095945050505050565b5f5f60408385031215611bfe575f5ffd5b825167ffffffffffffffff811115611c14575f5ffd5b8301601f81018513611c24575f5ffd5b8051611c32611abf82611a57565b8082825260208201915060208360051b850101925087831115611c53575f5ffd5b6020840193505b82841015611c7c57611c6b8461194a565b825260209384019390910190611c5a565b80955050505050602083015167ffffffffffffffff811115611c9c575f5ffd5b611ca885828601611b7f565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff821317156119d4576119d461184b565b5f8160060b8360060b80611cf557611cf5611a1d565b667fffffffffffff1982145f1982141615611d1257611d1261184b565b90059392505050565b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611d6b5783516001600160a01b0316835260209384019390920191600101611d44565b50506001600160a01b039590951660608401525050608001529392505050565b5f60208284031215611d9b575f5ffd5b815167ffffffffffffffff811115611db1575f5ffd5b8201601f81018413611dc1575f5ffd5b8051611dcf611abf82611a57565b8082825260208201915060208360051b850101925086831115611df0575f5ffd5b6020840193505b82841015611e12578351825260209384019390910190611df7565b969550505050505056fea26469706673582212205fbada8332bde9df1e03f3b58913ab1e8c1d16d73ad2f925cb45ae98eb760b2264736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/UniswapPriceOracle.json b/abis/0.8.28/UniswapPriceOracle.json new file mode 100644 index 00000000..e227ff26 --- /dev/null +++ b/abis/0.8.28/UniswapPriceOracle.json @@ -0,0 +1,116 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "UniswapPriceOracle", + "sourceName": "contracts/oracles/UniswapPriceOracle.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_nativeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_maxSlippage", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_pair", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "direction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxSlippage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pair", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "updatePrice", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slippage", + "type": "uint256" + } + ], + "name": "validatePrice", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60e060405234801561000f575f5ffd5b5060405161096938038061096983398101604081905261002e916100e6565b6001600160a01b038116608081905260a083905260408051630dfe168160e01b815290515f9291630dfe16819160048083019260209291908290030181865afa15801561007d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100a1919061011f565b9050836001600160a01b0316816001600160a01b0316146100c257600160c0525b5050505061013f565b80516001600160a01b03811681146100e1575f5ffd5b919050565b5f5f5f606084860312156100f8575f5ffd5b610101846100cb565b925060208401519150610116604085016100cb565b90509250925092565b5f6020828403121561012f575f5ffd5b610138826100cb565b9392505050565b60805160a05160c0516107ca61019f5f395f818160a0015281816101e30152818161059e01526105dd01525f818160db015261015401525f818161010a0152818161020a0152818161029e0152818161032f01526104ab01526107ca5ff3fe608060405234801561000f575f5ffd5b506004361061006f575f3560e01c80638c04166f1161004d5780638c04166f146100d657806398d5fdca146100fd578063a8aa1b3114610105575f5ffd5b8063136d6f2114610073578063645539ed1461009b578063673a7e28146100d0575b5f5ffd5b610086610081366004610653565b610151565b60405190151581526020015b60405180910390f35b6100c27f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610092565b5f610086565b6100c27f000000000000000000000000000000000000000000000000000000000000000081565b6100c2610485565b61012c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610092565b5f7f00000000000000000000000000000000000000000000000000000000000000008211156101e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f536c697070616765206f766572666c6f77000000000000000000000000000000604482015260640160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000005f0361029c577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610271573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610295919061066a565b905061032c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610305573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610329919061066a565b90505b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610396573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ba91906106a3565b63ffffffff16925050508042036103d457505f9392505050565b5f6103df8242610703565b90505f6103ea610485565b90505f6103f7838361071c565b6104019086610733565b90505f8361040f8784610703565b610419919061075a565b90505f81841161044e578161042e8582610703565b61043f90662386f26fc1000061071c565b610449919061075a565b610474565b816104598186610703565b61046a90662386f26fc1000061071c565b610474919061075a565b989098111598975050505050505050565b6040805160028082526060820183525f92839291906020830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610512573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061053691906106a3565b826dffffffffffffffffffffffffffff169250816dffffffffffffffffffffffffffff16915050825f8151811061056f5761056f61076d565b60200260200101836001815181106105895761058961076d565b60200260200101828152508281525050505f817f0000000000000000000000000000000000000000000000000000000000000000815181106105cd576105cd61076d565b602002602001015190505f8260027f000000000000000000000000000000000000000000000000000000000000000060016106089190610733565b6106129190610781565b815181106106225761062261076d565b602002602001015190508181670de0b6b3a7640000610641919061071c565b61064b919061075a565b935050505090565b5f60208284031215610663575f5ffd5b5035919050565b5f6020828403121561067a575f5ffd5b5051919050565b80516dffffffffffffffffffffffffffff8116811461069e575f5ffd5b919050565b5f5f5f606084860312156106b5575f5ffd5b6106be84610681565b92506106cc60208501610681565b9150604084015163ffffffff811681146106e4575f5ffd5b809150509250925092565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610716576107166106ef565b92915050565b8082028115828204841417610716576107166106ef565b80820180821115610716576107166106ef565b634e487b7160e01b5f52601260045260245ffd5b5f8261076857610768610746565b500490565b634e487b7160e01b5f52603260045260245ffd5b5f8261078f5761078f610746565b50069056fea2646970667358221220dca3c0f27cce09e07162a261e6bbf9e80b82b8b0e647e455db677d68690e889d64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061006f575f3560e01c80638c04166f1161004d5780638c04166f146100d657806398d5fdca146100fd578063a8aa1b3114610105575f5ffd5b8063136d6f2114610073578063645539ed1461009b578063673a7e28146100d0575b5f5ffd5b610086610081366004610653565b610151565b60405190151581526020015b60405180910390f35b6100c27f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610092565b5f610086565b6100c27f000000000000000000000000000000000000000000000000000000000000000081565b6100c2610485565b61012c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610092565b5f7f00000000000000000000000000000000000000000000000000000000000000008211156101e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f536c697070616765206f766572666c6f77000000000000000000000000000000604482015260640160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000005f0361029c577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610271573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610295919061066a565b905061032c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610305573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610329919061066a565b90505b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610396573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ba91906106a3565b63ffffffff16925050508042036103d457505f9392505050565b5f6103df8242610703565b90505f6103ea610485565b90505f6103f7838361071c565b6104019086610733565b90505f8361040f8784610703565b610419919061075a565b90505f81841161044e578161042e8582610703565b61043f90662386f26fc1000061071c565b610449919061075a565b610474565b816104598186610703565b61046a90662386f26fc1000061071c565b610474919061075a565b989098111598975050505050505050565b6040805160028082526060820183525f92839291906020830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610512573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061053691906106a3565b826dffffffffffffffffffffffffffff169250816dffffffffffffffffffffffffffff16915050825f8151811061056f5761056f61076d565b60200260200101836001815181106105895761058961076d565b60200260200101828152508281525050505f817f0000000000000000000000000000000000000000000000000000000000000000815181106105cd576105cd61076d565b602002602001015190505f8260027f000000000000000000000000000000000000000000000000000000000000000060016106089190610733565b6106129190610781565b815181106106225761062261076d565b602002602001015190508181670de0b6b3a7640000610641919061071c565b61064b919061075a565b935050505090565b5f60208284031215610663575f5ffd5b5035919050565b5f6020828403121561067a575f5ffd5b5051919050565b80516dffffffffffffffffffffffffffff8116811461069e575f5ffd5b919050565b5f5f5f606084860312156106b5575f5ffd5b6106be84610681565b92506106cc60208501610681565b9150604084015163ffffffff811681146106e4575f5ffd5b809150509250925092565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610716576107166106ef565b92915050565b8082028115828204841417610716576107166106ef565b80820180821115610716576107166106ef565b634e487b7160e01b5f52601260045260245ffd5b5f8261076857610768610746565b500490565b634e487b7160e01b5f52603260045260245ffd5b5f8261078f5761078f610746565b50069056fea2646970667358221220dca3c0f27cce09e07162a261e6bbf9e80b82b8b0e647e455db677d68690e889d64736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/contracts/interfaces/IUniswapV3.sol b/contracts/interfaces/IUniswapV3.sol new file mode 100644 index 00000000..344154b6 --- /dev/null +++ b/contracts/interfaces/IUniswapV3.sol @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +interface IUniswapV3 { + /// @notice Creates a new pool if it does not exist, then initializes if not initialized + /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool + /// @param token0 The contract address of token0 of the pool + /// @param token1 The contract address of token1 of the pool + /// @param fee The fee amount of the v3 pool for the specified token pair + /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value + /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary + function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) + external payable returns (address pool); + + struct MintParams { + address token0; + address token1; + uint24 fee; + int24 tickLower; + int24 tickUpper; + uint256 amount0Desired; + uint256 amount1Desired; + uint256 amount0Min; + uint256 amount1Min; + address recipient; + uint256 deadline; + } + + /// @notice Creates a new position wrapped in a NFT + /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized + /// a method does not exist, i.e. the pool is assumed to be initialized. + /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata + /// @return tokenId The ID of the token that represents the minted position + /// @return liquidity The amount of liquidity for this position + /// @return amount0 The amount of token0 + /// @return amount1 The amount of token1 + function mint(MintParams calldata params) external payable + returns ( + uint256 tokenId, + uint128 liquidity, + uint256 amount0, + uint256 amount1 + ); + + struct CollectParams { + uint256 tokenId; + address recipient; + uint128 amount0Max; + uint128 amount1Max; + } + + /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient + /// @param params tokenId The ID of the NFT for which tokens are being collected, + /// recipient The account that should receive the tokens, + /// amount0Max The maximum amount of token0 to collect, + /// amount1Max The maximum amount of token1 to collect + /// @return amount0 The amount of fees collected in token0 + /// @return amount1 The amount of fees collected in token1 + function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); + + /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist + /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order + /// @param tokenA The contract address of either token0 or token1 + /// @param tokenB The contract address of the other token + /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip + /// @return pool The pool address + function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address pool); + + /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas + /// when accessed externally. + /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value + /// tick The current tick of the pool, i.e. according to the last tick transition that was run. + /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick + /// boundary. + /// observationIndex The index of the last oracle observation that was written, + /// observationCardinality The current maximum number of observations stored in the pool, + /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. + /// feeProtocol The protocol fee for both tokens of the pool. + /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 + /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. + /// unlocked Whether the pool is currently locked to reentrancy + function slot0() external view + returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, + uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked); + + /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp + /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing + /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, + /// you must call it with secondsAgos = [3600, 0]. + /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in + /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. + /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned + /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp + /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block + /// timestamp + function observe(uint32[] calldata secondsAgos) + external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); + + /// @notice Returns data about a specific observation index + /// @param index The element of the observations array to fetch + /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time + /// ago, rather than at a specific index in the array. + /// @return blockTimestamp The timestamp of the observation, + /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, + /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, + /// @return initialized whether the observation has been initialized and the values are safe to use + function observations(uint256 index) external view returns (uint32 blockTimestamp, int56 tickCumulative, + uint160 secondsPerLiquidityCumulativeX128, bool initialized); + + /// @notice Increase the maximum number of price and liquidity observations that this pool will store + /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to + /// the input observationCardinalityNext. + /// @param observationCardinalityNext The desired minimum number of observations for the pool to store + function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; + + function factory() external view returns (address); +} + diff --git a/contracts/libraries/TickMath.sol b/contracts/libraries/TickMath.sol new file mode 100644 index 00000000..715a9fd3 --- /dev/null +++ b/contracts/libraries/TickMath.sol @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity ^0.8.0; + +/// @title Math library for computing sqrt prices from ticks and vice versa +/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports +/// prices between 2**-128 and 2**128 +library TickMath { + error T(); + error R(); + + /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 + int24 internal constant MIN_TICK = -887272; + /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 + int24 internal constant MAX_TICK = -MIN_TICK; + + /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) + uint160 internal constant MIN_SQRT_RATIO = 4295128739; + /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) + uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; + + /// @notice Calculates sqrt(1.0001^tick) * 2^96 + /// @dev Throws if |tick| > max tick + /// @param tick The input tick for the above formula + /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) + /// at the given tick + function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { + unchecked { + uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); + if (absTick > uint256(int256(MAX_TICK))) revert T(); + + uint256 ratio = absTick & 0x1 != 0 + ? 0xfffcb933bd6fad37aa2d162d1a594001 + : 0x100000000000000000000000000000000; + if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; + if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; + if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; + if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; + if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; + if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; + if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; + if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; + if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; + if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; + if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; + if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; + if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; + if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; + if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; + if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; + if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; + if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; + if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; + + if (tick > 0) ratio = type(uint256).max / ratio; + + // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. + // we then downcast because we know the result always fits within 160 bits due to our tick input constraint + // we round up in the division so getTickAtSqrtRatio of the output price is always consistent + sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); + } + } + + /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio + /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may + /// ever return. + /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 + /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio + function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { + unchecked { + // second inequality must be < because the price can never reach the price at the max tick + if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R(); + uint256 ratio = uint256(sqrtPriceX96) << 32; + + uint256 r = ratio; + uint256 msb = 0; + + assembly { + let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(5, gt(r, 0xFFFFFFFF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(4, gt(r, 0xFFFF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(3, gt(r, 0xFF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(2, gt(r, 0xF)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := shl(1, gt(r, 0x3)) + msb := or(msb, f) + r := shr(f, r) + } + assembly { + let f := gt(r, 0x1) + msb := or(msb, f) + } + + if (msb >= 128) r = ratio >> (msb - 127); + else r = ratio << (127 - msb); + + int256 log_2 = (int256(msb) - 128) << 64; + + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(63, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(62, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(61, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(60, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(59, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(58, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(57, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(56, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(55, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(54, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(53, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(52, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(51, f)) + r := shr(f, r) + } + assembly { + r := shr(127, mul(r, r)) + let f := shr(128, r) + log_2 := or(log_2, shl(50, f)) + } + + int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number + + int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); + int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); + + tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; + } + } +} diff --git a/contracts/oracles/BalancerPriceOracle.sol b/contracts/oracles/BalancerPriceOracle.sol new file mode 100644 index 00000000..06c8b3e1 --- /dev/null +++ b/contracts/oracles/BalancerPriceOracle.sol @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +interface IVault { + function getPoolTokens(bytes32 poolId) external view + returns (address[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock); +} + +/// @title BalancerPriceOracle - a smart contract oracle for Balancer V2 pools +/// @dev This contract acts as an oracle for a specific Balancer V2 pool. It allows: +/// 1) Updating the price by any caller +/// 2) Getting the price by any caller +/// 3) Validating slippage against the oracle +contract BalancerPriceOracle { + event PriceUpdated(address indexed sender, uint256 currentPrice, uint256 cumulativePrice); + + struct PriceSnapshot { + // Time-weighted cumulative price + uint256 cumulativePrice; + // Timestamp of the last update + uint256 lastUpdated; + // Most recent calculated average price + uint256 averagePrice; + } + + // Snapshot history struct + PriceSnapshot public snapshotHistory; + + // Maximum allowed update slippage in % + uint256 public immutable maxSlippage; + // Minimum update time period in seconds + uint256 public immutable minUpdateTimePeriod; + // LP token direction + uint256 public immutable direction; + // Native token (ERC-20) address + address public immutable nativeToken; + // OLAS token address + address public immutable olas; + // Balancer vault address + address public immutable balancerVault; + // Balancer pool Id + bytes32 public immutable balancerPoolId; + + constructor( + address _olas, + address _nativeToken, + uint256 _maxSlippage, + uint256 _minUpdateTimePeriod, + address _balancerVault, + bytes32 _balancerPoolId + ) { + require(_maxSlippage < 100, "Slippage must be less than 100%"); + + olas = _olas; + nativeToken = _nativeToken; + maxSlippage = _maxSlippage; + minUpdateTimePeriod = _minUpdateTimePeriod; + balancerVault = _balancerVault; + balancerPoolId = _balancerPoolId; + + // Get token direction + (address[] memory tokens, , ) = IVault(balancerVault).getPoolTokens(_balancerPoolId); + if (tokens[0] != _nativeToken) { + direction = 1; + } + + // Initialize price snapshot + updatePrice(); + } + + /// @dev Gets the current OLAS token price in 1e18 format. + function getPrice() public view returns (uint256) { + (, uint256[] memory balances, ) = IVault(balancerVault).getPoolTokens(balancerPoolId); + // Native token + uint256 balanceIn = balances[direction]; + // OLAS + uint256 balanceOut = balances[(direction + 1) % 2]; + + return (balanceOut * 1e18) / balanceIn; + } + + /// @dev Updates the time-weighted average price. + /// @notice This implementation only accounts for the first price update in a block. + function updatePrice() public returns (bool) { + uint256 currentPrice = getPrice(); + require(currentPrice > 0, "Price must be non-zero"); + + PriceSnapshot storage snapshot = snapshotHistory; + + if (snapshot.lastUpdated == 0) { + // Initialize snapshot + snapshot.cumulativePrice = 0; + snapshot.averagePrice = currentPrice; + snapshot.lastUpdated = block.timestamp; + emit PriceUpdated(msg.sender, currentPrice, 0); + return true; + } + + // Check if update is too soon + if (block.timestamp < snapshotHistory.lastUpdated + minUpdateTimePeriod) { + return false; + } + + // This implementation only accounts for the first price update in a block. + // Calculate elapsed time since the last update + uint256 elapsedTime = block.timestamp - snapshot.lastUpdated; + + // Update cumulative price with the previous average over the elapsed time + snapshot.cumulativePrice += snapshot.averagePrice * elapsedTime; + + // Update the average price to reflect the current price + uint256 averagePrice = (snapshot.cumulativePrice + (currentPrice * elapsedTime)) / + ((snapshot.cumulativePrice / snapshot.averagePrice) + elapsedTime); + + // Check if price deviation is too high + if (currentPrice < averagePrice - (averagePrice * maxSlippage / 100) || + currentPrice > averagePrice + (averagePrice * maxSlippage / 100)) + { + return false; + } + + snapshot.averagePrice = averagePrice; + snapshot.lastUpdated = block.timestamp; + + emit PriceUpdated(msg.sender, currentPrice, snapshot.cumulativePrice); + + return true; + } + + /// @dev Validates Current price against a TWAP according to slippage tolerance. + /// @param slippage Acceptable slippage tolerance. + function validatePrice(uint256 slippage) external view returns (bool) { + require(slippage <= maxSlippage, "Slippage overflow"); + + PriceSnapshot memory snapshot = snapshotHistory; + + // Ensure there is historical price data + if (snapshot.lastUpdated == 0) return false; + + // Calculate elapsed time + uint256 elapsedTime = block.timestamp - snapshot.lastUpdated; + // Require at least one block since last update + if (elapsedTime == 0) return false; + + // Compute time-weighted average price + uint256 timeWeightedAverage = (snapshot.cumulativePrice + (snapshot.averagePrice * elapsedTime)) / + ((snapshot.cumulativePrice / snapshot.averagePrice) + elapsedTime); + + uint256 tradePrice = getPrice(); + + // Validate against slippage thresholds + uint256 lowerBound = (timeWeightedAverage * (100 - slippage)) / 100; + uint256 upperBound = (timeWeightedAverage * (100 + slippage)) / 100; + + return tradePrice >= lowerBound && tradePrice <= upperBound; + } +} diff --git a/contracts/oracles/UniswapPriceOracle.sol b/contracts/oracles/UniswapPriceOracle.sol new file mode 100644 index 00000000..85e7bcb8 --- /dev/null +++ b/contracts/oracles/UniswapPriceOracle.sol @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +interface IUniswapV2 { + function token0() external view returns (address); + function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast); + function price0CumulativeLast() external view returns (uint256); + function price1CumulativeLast() external view returns (uint256); +} + +/// @title UniswapPriceOracle - a smart contract oracle wrapper for Uniswap V2 pools +/// @dev This contract acts as an oracle wrapper for a specific Uniswap V2 pool. It allows: +/// 1) Getting the price by any caller +/// 2) Validating slippage against the oracle +contract UniswapPriceOracle { + // LP token address + address public immutable pair; + // Max allowable slippage + uint256 public immutable maxSlippage; + // LP token direction + uint256 public immutable direction; + + constructor(address _nativeToken, uint256 _maxSlippage, address _pair) { + pair = _pair; + maxSlippage = _maxSlippage; + + // Get token direction + address token0 = IUniswapV2(pair).token0(); + if (token0 != _nativeToken) { + direction = 1; + } + } + + /// @dev Gets the current OLAS token price in 1e18 format. + function getPrice() public view returns (uint256) { + uint256[] memory balances = new uint256[](2); + (balances[0], balances[1], ) = IUniswapV2(pair).getReserves(); + // Native token + uint256 balanceIn = balances[direction]; + // OLAS + uint256 balanceOut = balances[(direction + 1) % 2]; + + return (balanceOut * 1e18) / balanceIn; + } + + /// @dev Updates the time-weighted average price. + /// @notice This is a compatibility function, which always needs to return false, as TWAP is updated automatically. + function updatePrice() external pure returns (bool) { + // Nothing to update; use built-in TWAP from Uniswap V2 pool + return false; + } + + /// @dev Validates the current price against a TWAP according to slippage tolerance. + /// @param slippage the acceptable slippage tolerance + function validatePrice(uint256 slippage) external view returns (bool) { + require(slippage <= maxSlippage, "Slippage overflow"); + + // Compute time-weighted average price + // Fetch the cumulative prices from the pair + uint256 cumulativePriceLast; + if (direction == 0) { + cumulativePriceLast = IUniswapV2(pair).price1CumulativeLast(); + } else { + cumulativePriceLast = IUniswapV2(pair).price0CumulativeLast(); + } + + // Fetch the reserves and the last block timestamp + (, , uint256 blockTimestampLast) = IUniswapV2(pair).getReserves(); + + // Require at least one block since last update + if (block.timestamp == blockTimestampLast) { + return false; + } + uint256 elapsedTime = block.timestamp - blockTimestampLast; + + uint256 tradePrice = getPrice(); + + // Calculate cumulative prices + uint256 cumulativePrice = cumulativePriceLast + (tradePrice * elapsedTime); + + // Calculate the TWAP for OLAS in terms of native token + uint256 timeWeightedAverage = (cumulativePrice - cumulativePriceLast) / elapsedTime; + + // Get the final derivation to compare with slippage + // Final derivation value must be + uint256 derivation = (tradePrice > timeWeightedAverage) + ? ((tradePrice - timeWeightedAverage) * 1e16) / timeWeightedAverage + : ((timeWeightedAverage - tradePrice) * 1e16) / timeWeightedAverage; + + return derivation <= slippage; + } +} diff --git a/contracts/utils/BuyBackBurner.sol b/contracts/utils/BuyBackBurner.sol new file mode 100644 index 00000000..dcadf45f --- /dev/null +++ b/contracts/utils/BuyBackBurner.sol @@ -0,0 +1,281 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import {FixedPointMathLib} from "../../lib/solmate/src/utils/FixedPointMathLib.sol"; +import {IUniswapV3} from "../interfaces/IUniswapV3.sol"; +import {TickMath} from "../libraries/TickMath.sol"; + +// ERC20 interface +interface IERC20 { + /// @dev Gets the amount of tokens owned by a specified account. + /// @param account Account address. + /// @return Amount of tokens owned. + function balanceOf(address account) external view returns (uint256); +} + +interface IOracle { + /// @dev Gets the current OLAS token price in 1e18 format. + function getPrice() external view returns (uint256); + + /// @dev Validates price according to slippage. + function validatePrice(uint256 slippage) external view returns (bool); + + /// @dev Updates the time-weighted average price. + function updatePrice() external returns (bool); +} + +/// @dev Only `owner` has a privilege, but the `sender` was provided. +/// @param sender Sender address. +/// @param owner Required sender address as an owner. +error OwnerOnly(address sender, address owner); + +/// @dev Provided zero address. +error ZeroAddress(); + +/// @dev Provided zero value. +error ZeroValue(); + +/// @dev The contract is already initialized. +error AlreadyInitialized(); + +/// @title BuyBackBurner - BuyBackBurner implementation contract +abstract contract BuyBackBurner { + event ImplementationUpdated(address indexed implementation); + event OwnerUpdated(address indexed owner); + event OracleUpdated(address indexed oracle); + event BuyBack(uint256 olasAmount); + event OraclePriceUpdated(address indexed oracle, address indexed sender); + + // Version number + string public constant VERSION = "0.2.0"; + // Code position in storage is keccak256("BUY_BACK_BURNER_PROXY") = "c6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc19" + bytes32 public constant BUY_BACK_BURNER_PROXY = 0xc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc19; + // L1 OLAS Burner address + address public constant OLAS_BURNER = 0x51eb65012ca5cEB07320c497F4151aC207FEa4E0; + // Max allowed price deviation for TWAP pool values (10%) in 1e18 format + uint256 public constant MAX_ALLOWED_DEVIATION = 1e17; + // Seconds ago to look back for TWAP pool values + uint32 public constant SECONDS_AGO = 1800; + + // Contract owner + address public owner; + // OLAS token address + address public olas; + // Native token (ERC-20) address + address public nativeToken; + // Oracle address + address public oracle; + + // Oracle max slippage for ERC-20 native token <=> OLAS + uint256 public maxSlippage; + // Reentrancy lock + uint256 internal _locked = 1; + + // Map of account => activity counter + mapping(address => uint256) public mapAccountActivities; + + /// @dev Buys OLAS on DEX. + /// @param nativeTokenAmount Suggested native token amount. + /// @return olasAmount Obtained OLAS amount. + function _buyOLAS(uint256 nativeTokenAmount) internal virtual returns (uint256 olasAmount) { + // Apply slippage protection + require(IOracle(oracle).validatePrice(maxSlippage), "Before swap slippage limit is breached"); + + // Get current pool price + uint256 previousPrice = IOracle(oracle).getPrice(); + + olasAmount = _performSwap(nativeTokenAmount); + + // Get current pool price + uint256 tradePrice = IOracle(oracle).getPrice(); + + // Validate against slippage thresholds + uint256 lowerBound = (previousPrice * (100 - maxSlippage)) / 100; + uint256 upperBound = (previousPrice * (100 + maxSlippage)) / 100; + + require(tradePrice >= lowerBound && tradePrice <= upperBound, "After swap slippage limit is breached"); + } + + /// @dev Gets TWAP price via the built-in Uniswap V3 oracle. + /// @param pool Pool address. + /// @return price Calculated price. + function _getTwapFromOracle(address pool) internal view returns (uint256 price) { + // Query the pool for the current and historical tick + uint32[] memory secondsAgos = new uint32[](2); + // Start of the period + secondsAgos[0] = SECONDS_AGO; + + // Fetch the tick cumulative values from the pool + (int56[] memory tickCumulatives, ) = IUniswapV3(pool).observe(secondsAgos); + + // Calculate the average tick over the time period + int56 tickCumulativeDelta = tickCumulatives[1] - tickCumulatives[0]; + int24 averageTick = int24(tickCumulativeDelta / int56(int32(SECONDS_AGO))); + + // Convert the average tick to sqrtPriceX96 + uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(averageTick); + + // Calculate the price using the sqrtPriceX96 + // Max result is uint160 * uint160 == uint320, not to overflow: 320 - 256 = 64 (2^64) + price = FixedPointMathLib.mulDivDown(uint256(sqrtPriceX96), uint256(sqrtPriceX96), (1 << 64)); + } + + /// @dev BuyBackBurner initializer. + /// @param payload Initializer payload. + function _initialize(bytes memory payload) internal virtual; + + /// @dev Performs swap for OLAS on DEX. + /// @param nativeTokenAmount Native token amount. + /// @return olasAmount Obtained OLAS amount. + function _performSwap(uint256 nativeTokenAmount) internal virtual returns (uint256 olasAmount); + + /// @dev BuyBackBurner initializer. + /// @param payload Initializer payload. + function initialize(bytes memory payload) external { + // Check for already being initialized + if (owner != address(0)) { + revert AlreadyInitialized(); + } + + owner = msg.sender; + _locked = 1; + + _initialize(payload); + } + + /// @dev Changes the implementation contract address. + /// @param newImplementation New implementation contract address. + function changeImplementation(address newImplementation) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for zero address + if (newImplementation == address(0)) { + revert ZeroAddress(); + } + + // Store the implementation address + assembly { + sstore(BUY_BACK_BURNER_PROXY, newImplementation) + } + + emit ImplementationUpdated(newImplementation); + } + + /// @dev Changes contract owner address. + /// @param newOwner Address of a new owner. + function changeOwner(address newOwner) external virtual { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newOwner == address(0)) { + revert ZeroAddress(); + } + + owner = newOwner; + emit OwnerUpdated(newOwner); + } + + /// @dev Changes contract oracle address. + /// @param newOracle Address of a new oracle. + function changeOracle(address newOracle) external virtual { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newOracle == address(0)) { + revert ZeroAddress(); + } + + oracle = newOracle; + emit OracleUpdated(newOracle); + } + + /// @dev Checks pool prices via Uniswap V3 built-in oracle. + /// @param token0 Token0 address. + /// @param token1 Token1 address. + /// @param fee Fee tier. + function checkPoolPrices( + address token0, + address token1, + address uniV3PositionManager, + uint24 fee + ) external view { + // Get factory address + address factory = IUniswapV3(uniV3PositionManager).factory(); + + // Verify pool reserves before proceeding + address pool = IUniswapV3(factory).getPool(token0, token1, fee); + require(pool != address(0), "Pool does not exist"); + + // Get current pool reserves and observation index + (uint160 sqrtPriceX96, , uint16 observationIndex, , , , ) = IUniswapV3(pool).slot0(); + + // Check if the pool has sufficient observation history + (uint32 oldestTimestamp, , , ) = IUniswapV3(pool).observations(observationIndex); + if (oldestTimestamp + SECONDS_AGO < block.timestamp) { + return; + } + + // Check TWAP or historical data + uint256 twapPrice = _getTwapFromOracle(pool); + // Get instant price + // Max result is uint160 * uint160 == uint320, not to overflow: 320 - 256 = 64 (2^64) + uint256 instantPrice = FixedPointMathLib.mulDivDown(uint256(sqrtPriceX96), uint256(sqrtPriceX96), (1 << 64)); + + uint256 deviation; + if (twapPrice > 0) { + deviation = (instantPrice > twapPrice) ? + FixedPointMathLib.mulDivDown((instantPrice - twapPrice), 1e18, twapPrice) : + FixedPointMathLib.mulDivDown((twapPrice - instantPrice), 1e18, twapPrice); + } + + require(deviation <= MAX_ALLOWED_DEVIATION, "Price deviation too high"); + } + + /// @dev Buys OLAS on DEX. + /// @notice if nativeTokenAmount is zero or above the balance, it will be adjusted to current native token balance. + /// @param nativeTokenAmount Suggested native token amount. + function buyBack(uint256 nativeTokenAmount) external virtual { + require(_locked == 1, "Reentrancy guard"); + _locked = 2; + + // Get nativeToken balance + uint256 balance = IERC20(nativeToken).balanceOf(address(this)); + + // Adjust native token amount, if needed + if (nativeTokenAmount == 0 || nativeTokenAmount > balance) { + nativeTokenAmount = balance; + } + require(nativeTokenAmount > 0, "Insufficient native token amount"); + + // Record msg.sender activity + mapAccountActivities[msg.sender]++; + + // Buy OLAS + uint256 olasAmount = _buyOLAS(nativeTokenAmount); + + emit BuyBack(olasAmount); + + _locked = 1; + } + + /// @dev Triggers oracle price update. + function updateOraclePrice() external { + // Record msg.sender activity + mapAccountActivities[msg.sender]++; + + // Update price + bool success = IOracle(oracle).updatePrice(); + require(success, "Oracle price update failed"); + + emit OraclePriceUpdated(oracle, msg.sender); + } +} \ No newline at end of file diff --git a/contracts/utils/BuyBackBurnerBalancer.sol b/contracts/utils/BuyBackBurnerBalancer.sol new file mode 100644 index 00000000..762e002b --- /dev/null +++ b/contracts/utils/BuyBackBurnerBalancer.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import {BuyBackBurner} from "./BuyBackBurner.sol"; + +// Balancer interface +interface IBalancer { + enum SwapKind { GIVEN_IN, GIVEN_OUT } + + struct SingleSwap { + bytes32 poolId; + SwapKind kind; + address assetIn; + address assetOut; + uint256 amount; + bytes userData; + } + + struct FundManagement { + address sender; + bool fromInternalBalance; + address payable recipient; + bool toInternalBalance; + } + + /// @dev Swaps tokens on Balancer. + function swap(SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline) + external payable returns (uint256); +} + +// ERC20 interface +interface IERC20 { + /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + /// @param spender Account address that will be able to transfer tokens on behalf of the caller. + /// @param amount Token amount. + /// @return True if the function execution is successful. + function approve(address spender, uint256 amount) external returns (bool); +} + +/// @title BuyBackBurnerBalancer - BuyBackBurner implementation contract for interaction with Balancer +contract BuyBackBurnerBalancer is BuyBackBurner { + // Balancer vault address + address public balancerVault; + // Balancer pool Id + bytes32 public balancerPoolId; + + /// @dev Performs swap for OLAS on DEX. + /// @param nativeTokenAmount Native token amount. + /// @return olasAmount Obtained OLAS amount. + function _performSwap(uint256 nativeTokenAmount) internal virtual override returns (uint256 olasAmount) { + // Approve nativeToken for the Balancer Vault + IERC20(nativeToken).approve(balancerVault, nativeTokenAmount); + + // Prepare Balancer data for the nativeToken-OLAS pool + IBalancer.SingleSwap memory singleSwap = IBalancer.SingleSwap(balancerPoolId, IBalancer.SwapKind.GIVEN_IN, + nativeToken, olas, nativeTokenAmount, "0x"); + IBalancer.FundManagement memory fundManagement = IBalancer.FundManagement(address(this), false, + payable(address(this)), false); + + // Perform swap + olasAmount = IBalancer(balancerVault).swap(singleSwap, fundManagement, 0, block.timestamp); + } + + /// @dev BuyBackBurner initializer. + /// @param payload Initializer payload. + function _initialize(bytes memory payload) internal override virtual { + address[] memory accounts; + (accounts, balancerPoolId, maxSlippage) = abi.decode(payload, (address[], bytes32, uint256)); + + olas = accounts[0]; + nativeToken = accounts[1]; + oracle = accounts[2]; + balancerVault = accounts[3]; + } +} \ No newline at end of file diff --git a/contracts/utils/BuyBackBurnerProxy.sol b/contracts/utils/BuyBackBurnerProxy.sol new file mode 100644 index 00000000..49f04068 --- /dev/null +++ b/contracts/utils/BuyBackBurnerProxy.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +/// @dev Zero implementation address. +error ZeroImplementationAddress(); + +/// @dev Zero data. +error ZeroData(); + +/// @dev Proxy initialization failed. +error InitializationFailed(); + +/* +* This is a BuyBackBurner proxy contract. +* Proxy implementation is created based on the Universal Upgradeable Proxy Standard (UUPS) EIP-1822. +* The implementation address must be located in a unique storage slot of the proxy contract. +* The upgrade logic must be located in the implementation contract. +* Special buyBackBurner implementation address slot is produced by hashing the "BUY_BACK_BURNER_PROXY" +* string in order to make the slot unique. +* The fallback() implementation for all the delegatecall-s is inspired by the Gnosis Safe set of contracts. +*/ + +/// @title BuyBackBurnerProxy - Smart contract for buyBackBurner proxy +contract BuyBackBurnerProxy { + // Code position in storage is keccak256("BUY_BACK_BURNER_PROXY") = "c6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc19" + bytes32 public constant BUY_BACK_BURNER_PROXY = 0xc6d7bd4bd971fa336816fe30b665cc6caccce8b123cc8ea692d132f342c4fc19; + + /// @dev BuyBackBurnerProxy constructor. + /// @param implementation BuyBackBurner implementation address. + /// @param buyBackBurnerData BuyBackBurner initialization data. + constructor(address implementation, bytes memory buyBackBurnerData) { + // Check for the zero address, since the delegatecall works even with the zero one + if (implementation == address(0)) { + revert ZeroImplementationAddress(); + } + + // Check for the zero data + if (buyBackBurnerData.length == 0) { + revert ZeroData(); + } + + // Store the buyBackBurner implementation address + assembly { + sstore(BUY_BACK_BURNER_PROXY, implementation) + } + // Initialize proxy storage + (bool success, ) = implementation.delegatecall(buyBackBurnerData); + if (!success) { + revert InitializationFailed(); + } + } + + /// @dev Delegatecall to all the incoming data. + fallback() external payable { + assembly { + let implementation := sload(BUY_BACK_BURNER_PROXY) + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { + revert(0, returndatasize()) + } + return(0, returndatasize()) + } + } + + /// @dev Gets the implementation address. + /// @return implementation Implementation address. + function getImplementation() external view returns (address implementation) { + // solhint-disable-next-line avoid-low-level-calls + assembly { + implementation := sload(BUY_BACK_BURNER_PROXY) + } + } +} \ No newline at end of file diff --git a/contracts/utils/BuyBackBurnerUniswap.sol b/contracts/utils/BuyBackBurnerUniswap.sol new file mode 100644 index 00000000..86201981 --- /dev/null +++ b/contracts/utils/BuyBackBurnerUniswap.sol @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import {BuyBackBurner} from "./BuyBackBurner.sol"; + +// ERC20 interface +interface IERC20 { + /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + /// @param spender Account address that will be able to transfer tokens on behalf of the caller. + /// @param amount Token amount. + /// @return True if the function execution is successful. + function approve(address spender, uint256 amount) external returns (bool); +} + +// UniswapV2 interface +interface IUniswap { + /// @dev Swaps an exact amount of input tokens along the route determined by the path. + function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, + uint256 deadline) external returns (uint256[] memory amounts); +} + +/// @title BuyBackBurnerUniswap - BuyBackBurner implementation contract for interaction with UniswapV2 +contract BuyBackBurnerUniswap is BuyBackBurner { + // Router address + address public router; + + /// @dev Performs swap for OLAS on DEX. + /// @param nativeTokenAmount Native token amount. + /// @return olasAmount Obtained OLAS amount. + function _performSwap(uint256 nativeTokenAmount) internal virtual override returns (uint256 olasAmount) { + // Approve nativeToken for the router + IERC20(nativeToken).approve(router, nativeTokenAmount); + + address[] memory path = new address[](2); + path[0] = nativeToken; + path[1] = olas; + + // Swap nativeToken for OLAS + uint256[] memory amounts = IUniswap(router).swapExactTokensForTokens( + nativeTokenAmount, + 0, + path, + address(this), + block.timestamp + ); + + // Record OLAS amount + olasAmount = amounts[1]; + } + + /// @dev BuyBackBurner initializer. + /// @param payload Initializer payload. + function _initialize(bytes memory payload) internal override virtual { + address[] memory accounts; + (accounts, maxSlippage) = abi.decode(payload, (address[], uint256)); + + olas = accounts[0]; + nativeToken = accounts[1]; + oracle = accounts[2]; + router = accounts[3]; + } +} \ No newline at end of file diff --git a/scripts/deployment/oracles/deploy_01_balancer_price_oracle.js b/scripts/deployment/oracles/deploy_01_balancer_price_oracle.js new file mode 100644 index 00000000..cfb93820 --- /dev/null +++ b/scripts/deployment/oracles/deploy_01_balancer_price_oracle.js @@ -0,0 +1,77 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("1. EOA to deploy BalancerPriceOracle"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const BalancerPriceOracle = await ethers.getContractFactory("BalancerPriceOracle"); + console.log("You are signing the following transaction: BalancerPriceOracle.connect(EOA).deploy()"); + const balancerPriceOracle = await BalancerPriceOracle.connect(EOA).deploy(parsedData.olasAddress, parsedData.nativeTokenAddress, + parsedData.maxOracleSlippage, parsedData.minUpdateTimePeriod, parsedData.balancerVaultAddress, + parsedData.balancerPoolId, { gasPrice }); + const result = await balancerPriceOracle.deployed(); + + // Transaction details + console.log("Contract deployment: BalancerPriceOracle"); + console.log("Contract address:", balancerPriceOracle.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.balancerPriceOracleAddress = balancerPriceOracle.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/oracles/verify_01_balancer_price_oracle.js --network " + providerName + " " + balancerPriceOracle.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/oracles/deploy_02_uniswap_price_oracle.js b/scripts/deployment/oracles/deploy_02_uniswap_price_oracle.js new file mode 100644 index 00000000..5b582b5b --- /dev/null +++ b/scripts/deployment/oracles/deploy_02_uniswap_price_oracle.js @@ -0,0 +1,77 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const nativeTokenAddress = parsedData.nativeTokenAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("2. EOA to deploy UniswapPriceOracle"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const UniswapPriceOracle = await ethers.getContractFactory("UniswapPriceOracle"); + console.log("You are signing the following transaction: UniswapPriceOracle.connect(EOA).deploy()"); + const uniswapPriceOracle = await UniswapPriceOracle.connect(EOA).deploy(nativeTokenAddress, + parsedData.maxOracleSlippage, parsedData.pairAddress, { gasPrice }); + const result = await uniswapPriceOracle.deployed(); + + // Transaction details + console.log("Contract deployment: UniswapPriceOracle"); + console.log("Contract address:", uniswapPriceOracle.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.uniswapPriceOracleAddress = uniswapPriceOracle.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/oracles/verify_02_uniswap_price_oracle.js --network " + providerName + " " + uniswapPriceOracle.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/oracles/globals_base_mainnet.json b/scripts/deployment/oracles/globals_base_mainnet.json new file mode 100644 index 00000000..11585c1f --- /dev/null +++ b/scripts/deployment/oracles/globals_base_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.base.org","gasPriceInGwei":"0.5","olasAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","nativeTokenAddress":"0x4200000000000000000000000000000000000006","balancerVaultAddress":"0xBA12222222228d8Ba445958a75a0704d566BF2C8","balancerPoolId":"0x2da6e67c45af2aaa539294d9fa27ea50ce4e2c5f0002000000000000000001a3","maxOracleSlippage":"50","minUpdateTimePeriod":"900","balancerPriceOracleAddress":"0x586D916819d9B707101f81e4cDD22cE119D1C220"} diff --git a/scripts/deployment/oracles/globals_gnosis_mainnet.json b/scripts/deployment/oracles/globals_gnosis_mainnet.json new file mode 100644 index 00000000..b81db979 --- /dev/null +++ b/scripts/deployment/oracles/globals_gnosis_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"gnosis","networkURL":"https://rpc.gnosischain.com","gasPriceInGwei":"2","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","nativeTokenAddress":"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d","balancerVaultAddress":"0xBA12222222228d8Ba445958a75a0704d566BF2C8","balancerPoolId":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985000200000000000000000067","maxOracleSlippage":"50","minUpdateTimePeriod":"900","balancerPriceOracleAddress":""} diff --git a/scripts/deployment/oracles/verify_01_balancer_price_oracle.js b/scripts/deployment/oracles/verify_01_balancer_price_oracle.js new file mode 100644 index 00000000..710bc074 --- /dev/null +++ b/scripts/deployment/oracles/verify_01_balancer_price_oracle.js @@ -0,0 +1,13 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); + +module.exports = [ + parsedData.olasAddress, + parsedData.nativeTokenAddress, + parsedData.maxOracleSlippage, + parsedData.minUpdateTimePeriod, + parsedData.balancerVaultAddress, + parsedData.balancerPoolId +]; \ No newline at end of file diff --git a/scripts/deployment/oracles/verify_02_uniswap_price_oracle.js b/scripts/deployment/oracles/verify_02_uniswap_price_oracle.js new file mode 100644 index 00000000..5f46e1be --- /dev/null +++ b/scripts/deployment/oracles/verify_02_uniswap_price_oracle.js @@ -0,0 +1,11 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const nativeTokenAddress = parsedData.nativeTokenAddress; + +module.exports = [ + nativeTokenAddress, + parsedData.maxOracleSlippage, + parsedData.pairAddress +]; \ No newline at end of file diff --git a/scripts/deployment/utils/deploy_01_buy_back_burner_balancer.js b/scripts/deployment/utils/deploy_01_buy_back_burner_balancer.js new file mode 100644 index 00000000..6eb73c08 --- /dev/null +++ b/scripts/deployment/utils/deploy_01_buy_back_burner_balancer.js @@ -0,0 +1,75 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("1. EOA to deploy BuyBackBurnerBalancer"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const BuyBackBurnerBalancer = await ethers.getContractFactory("BuyBackBurnerBalancer"); + console.log("You are signing the following transaction: BuyBackBurnerBalancer.connect(EOA).deploy()"); + const buyBackBurner = await BuyBackBurnerBalancer.connect(EOA).deploy({ gasPrice }); + const result = await buyBackBurner.deployed(); + + // Transaction details + console.log("Contract deployment: BuyBackBurnerBalancer"); + console.log("Contract address:", buyBackBurner.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.buyBackBurnerAddress = buyBackBurner.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --network " + providerName + " " + buyBackBurner.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/utils/deploy_02_buy_back_burner_uniswap.js b/scripts/deployment/utils/deploy_02_buy_back_burner_uniswap.js new file mode 100644 index 00000000..98efd310 --- /dev/null +++ b/scripts/deployment/utils/deploy_02_buy_back_burner_uniswap.js @@ -0,0 +1,75 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("2. EOA to deploy BuyBackBurnerUniswap"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const BuyBackBurnerUniswap = await ethers.getContractFactory("BuyBackBurnerUniswap"); + console.log("You are signing the following transaction: BuyBackBurnerUniswap.connect(EOA).deploy()"); + const buyBackBurner = await BuyBackBurnerUniswap.connect(EOA).deploy({ gasPrice }); + const result = await buyBackBurner.deployed(); + + // Transaction details + console.log("Contract deployment: BuyBackBurnerUniswap"); + console.log("Contract address:", buyBackBurner.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.buyBackBurnerAddress = buyBackBurner.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --network " + providerName + " " + buyBackBurner.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js new file mode 100644 index 00000000..fe83f51b --- /dev/null +++ b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js @@ -0,0 +1,83 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Assemble the contributors proxy data + const buyBackBurner = await ethers.getContractAt("BuyBackBurnerBalancer", buyBackBurnerAddress); + const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], + [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); + const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); + + // Transaction signing and execution + console.log("3. EOA to deploy BuyBackBurnerProxy based on BuyBackBurnerBalancer"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const BuyBackBurnerProxy = await ethers.getContractFactory("BuyBackBurnerProxy"); + console.log("You are signing the following transaction: BuyBackBurnerProxy.connect(EOA).deploy()"); + const buyBackBurnerProxy = await BuyBackBurnerProxy.connect(EOA).deploy(buyBackBurnerAddress, proxyData, { gasPrice }); + const result = await buyBackBurnerProxy.deployed(); + + // Transaction details + console.log("Contract deployment: buyBackBurnerProxy"); + console.log("Contract address:", buyBackBurnerProxy.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.buyBackBurnerProxyAddress = buyBackBurnerProxy.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js --network " + providerName + " " + buyBackBurnerProxy.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js new file mode 100644 index 00000000..6beda28e --- /dev/null +++ b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js @@ -0,0 +1,84 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + let dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; + const nativeTokenAddress = parsedData.nativeTokenAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Assemble the contributors proxy data + const buyBackBurner = await ethers.getContractAt("BuyBackBurnerUniswap", buyBackBurnerAddress); + const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], + [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); + const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); + + // Transaction signing and execution + console.log("4. EOA to deploy BuyBackBurnerProxy based on BuyBackBurnerUniswap"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const BuyBackBurnerProxy = await ethers.getContractFactory("BuyBackBurnerProxy"); + console.log("You are signing the following transaction: BuyBackBurnerProxy.connect(EOA).deploy()"); + const buyBackBurnerProxy = await BuyBackBurnerProxy.connect(EOA).deploy(buyBackBurnerAddress, proxyData, { gasPrice }); + const result = await buyBackBurnerProxy.deployed(); + + // Transaction details + console.log("Contract deployment: buyBackBurnerProxy"); + console.log("Contract address:", buyBackBurnerProxy.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.buyBackBurnerProxyAddress = buyBackBurnerProxy.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js --network " + providerName + " " + buyBackBurnerProxy.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/utils/globals_base_mainnet.json b/scripts/deployment/utils/globals_base_mainnet.json new file mode 100644 index 00000000..ef6ff9ec --- /dev/null +++ b/scripts/deployment/utils/globals_base_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.base.org","gasPriceInGwei":"0.5","olasAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","nativeTokenAddress":"0x4200000000000000000000000000000000000006","l2TokenBridgeAddress":"0x4200000000000000000000000000000000000010","routerV2Address":"0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24","balancerVaultAddress":"0xBA12222222228d8Ba445958a75a0704d566BF2C8","balancerPoolId":"0x2da6e67c45af2aaa539294d9fa27ea50ce4e2c5f0002000000000000000001a3","maxBuyBackSlippage":"10","minBridgedAmount":"1000000000000000000000","balancerPriceOracleAddress":"0x586D916819d9B707101f81e4cDD22cE119D1C220","buyBackBurnerAddress":"0xEea5F1e202dc43607273d54101fF8b58FB008A99","buyBackBurnerProxyAddress":"0x3FD8C757dE190bcc82cF69Df3Cd9Ab15bCec1426"} diff --git a/scripts/deployment/utils/globals_gnosis_mainnet.json b/scripts/deployment/utils/globals_gnosis_mainnet.json new file mode 100644 index 00000000..821c7e24 --- /dev/null +++ b/scripts/deployment/utils/globals_gnosis_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"gnosis","networkURL":"https://rpc.gnosischain.com","gasPriceInGwei":"2","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","nativeTokenAddress":"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d","l2TokenBridgeAddress":"0x4200000000000000000000000000000000000010","balancerVaultAddress":"0xBA12222222228d8Ba445958a75a0704d566BF2C8","balancerPoolId":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985000200000000000000000067","maxBuyBackSlippage":"10","minBridgedAmount":"1000000000000000000000","balancerPriceOracleAddress":"","buyBackBurnerAddress":"","buyBackBurnerProxyAddress":""} diff --git a/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js new file mode 100644 index 00000000..bbc4b7d8 --- /dev/null +++ b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js @@ -0,0 +1,16 @@ +const { ethers } = require("hardhat"); +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; +const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], + [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); +const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); +const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]); + +module.exports = [ + buyBackBurnerAddress, + proxyData +]; \ No newline at end of file diff --git a/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js new file mode 100644 index 00000000..43c9e99c --- /dev/null +++ b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js @@ -0,0 +1,17 @@ +const { ethers } = require("hardhat"); +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; +const nativeTokenAddress = parsedData.nativeTokenAddress; +const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], + [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); +const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); +const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]); + +module.exports = [ + buyBackBurnerAddress, + proxyData +]; \ No newline at end of file From 0e977c51cc20bf766341ef4de638a9333f05a52c Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Mon, 10 Feb 2025 19:26:03 +0000 Subject: [PATCH 2/3] chore: linters --- .gitleaksignore | 2 ++ .../utils/deploy_03_buy_back_burner_balancer_proxy.js | 4 ++-- .../utils/deploy_04_buy_back_burner_uniswap_proxy.js | 4 ++-- .../utils/verify_03_buy_back_burner_balancer_proxy.js | 4 ++-- .../utils/verify_04_buy_back_burner_uniswap_proxy.js | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitleaksignore b/.gitleaksignore index 9aa4d4ab..093798e7 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -208,3 +208,5 @@ ec017f7f1095f26fe63906ec36c9ede28030ea8a:scripts/deployment/staking/globals_main 1926300a5ccfafa48b72a6a5aaf7ad481e9a8b8b:scripts/deployment/staking/globals_mainnet.json:generic-api-key:1 1926300a5ccfafa48b72a6a5aaf7ad481e9a8b8b:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 69c58101b6c8fb564757ba133ad01d2725e51d93:scripts/deployment/globals_mainnet.json:generic-api-key:1 +63706f7d2ec9f1e56d875ee941f925b4b5994dd6:scripts/deployment/oracles/globals_gnosis_mainnet.json:generic-api-key:1 +63706f7d2ec9f1e56d875ee941f925b4b5994dd6:scripts/deployment/utils/globals_gnosis_mainnet.json:generic-api-key:1 diff --git a/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js index fe83f51b..a081a0d3 100644 --- a/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js +++ b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js @@ -44,8 +44,8 @@ async function main() { // Assemble the contributors proxy data const buyBackBurner = await ethers.getContractAt("BuyBackBurnerBalancer", buyBackBurnerAddress); const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], - [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, - parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); + [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); // Transaction signing and execution diff --git a/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js index 6beda28e..2c8090d6 100644 --- a/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js +++ b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js @@ -45,8 +45,8 @@ async function main() { // Assemble the contributors proxy data const buyBackBurner = await ethers.getContractAt("BuyBackBurnerUniswap", buyBackBurnerAddress); const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], - [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, - parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); + [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); // Transaction signing and execution diff --git a/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js index bbc4b7d8..1e8ead93 100644 --- a/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js +++ b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js @@ -5,8 +5,8 @@ const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); const parsedData = JSON.parse(dataFromJSON); const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], - [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, - parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); + [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]); diff --git a/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js index 43c9e99c..5cf59b8a 100644 --- a/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js +++ b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js @@ -6,8 +6,8 @@ const parsedData = JSON.parse(dataFromJSON); const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; const nativeTokenAddress = parsedData.nativeTokenAddress; const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], - [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, - parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); + [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]); From 5cdc014ccc91406367e03ce94ba89155cf232c2b Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Mon, 10 Feb 2025 19:28:09 +0000 Subject: [PATCH 3/3] chore: linters --- .../utils/deploy_03_buy_back_burner_balancer_proxy.js | 2 +- .../deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js | 2 +- .../utils/verify_03_buy_back_burner_balancer_proxy.js | 2 +- .../deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js index a081a0d3..72ea6278 100644 --- a/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js +++ b/scripts/deployment/utils/deploy_03_buy_back_burner_balancer_proxy.js @@ -45,7 +45,7 @@ async function main() { const buyBackBurner = await ethers.getContractAt("BuyBackBurnerBalancer", buyBackBurnerAddress); const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, - parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); // Transaction signing and execution diff --git a/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js index 2c8090d6..c48d3530 100644 --- a/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js +++ b/scripts/deployment/utils/deploy_04_buy_back_burner_uniswap_proxy.js @@ -46,7 +46,7 @@ async function main() { const buyBackBurner = await ethers.getContractAt("BuyBackBurnerUniswap", buyBackBurnerAddress); const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, - parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); const proxyData = buyBackBurner.interface.encodeFunctionData("initialize", [proxyPayload]); // Transaction signing and execution diff --git a/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js index 1e8ead93..675eb336 100644 --- a/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js +++ b/scripts/deployment/utils/verify_03_buy_back_burner_balancer_proxy.js @@ -6,7 +6,7 @@ const parsedData = JSON.parse(dataFromJSON); const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "bytes32", "uint256"], [[parsedData.olasAddress, parsedData.nativeTokenAddress, parsedData.balancerPriceOracleAddress, - parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); + parsedData.balancerVaultAddress], parsedData.balancerPoolId, parsedData.maxBuyBackSlippage]); const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]); diff --git a/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js index 5cf59b8a..0d1afc2e 100644 --- a/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js +++ b/scripts/deployment/utils/verify_04_buy_back_burner_uniswap_proxy.js @@ -7,7 +7,7 @@ const buyBackBurnerAddress = parsedData.buyBackBurnerAddress; const nativeTokenAddress = parsedData.nativeTokenAddress; const proxyPayload = ethers.utils.defaultAbiCoder.encode(["address[]", "uint256"], [[parsedData.olasAddress, nativeTokenAddress, parsedData.uniswapPriceOracleAddress, - parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); + parsedData.routerV2Address], parsedData.maxBuyBackSlippage]); const iface = new ethers.utils.Interface(["function initialize(bytes memory payload)"]); const proxyData = iface.encodeFunctionData("initialize", [proxyPayload]);